Reply
Thread Tools
Posts: 4 | Thanked: 3 times | Joined on Jan 2011
#1
Hello all,

I'm trying to implement GPU-based image processing on N900. Part of this is running pieces of data through GLSL fragment shader.

The shader code itself is somewhat complex, but nothing extraordinary. And I am happy with performance of the shader but the time required to compile this particular shader source code on N900 is ridiculous 90 sec!

Nevertheless, the driver on N900 claims that it has support for shader precompiled binary (GL_IMG_shader_binary) with correspondent shader binary format GL_SGX_BINARY_IMG.

So, I decided it should be possible to load pre-compiled binary instead
and avoid on-line compilation altogether.

I've tried to pre-compile shader with PVRUniSco compiler from POWERVR Inside SDK at
http://www.imgtec.com/powervr/inside...ndex.asp#GLES2
(the version marked for N900) and then load it simply with

Code:
FILE *fr = fopen ("shader.fsc", "rb");
fseek (fr, 0, SEEK_END);
int frlen = ftell(fr);
fseek (fr, 0, SEEK_SET);
unsigned char * shader_bin = (unsigned char *)malloc(frlen);
fread (shader_bin, frlen, 1, fr);
fclose(fr);

GLuint  shader = glCreateShader( GL_FRAGMENT_SHADER );

glShaderBinary  (1, &shader, GL_SGX_BINARY_IMG, (void*)shader_bin, frlen );
But this results in a rather strange error code: GL_OUT_OF_MEMORY


Any ideas ? What am I doing wrong?
 

The Following 3 Users Say Thank You to Dmitriy For This Useful Post:
Posts: 4 | Thanked: 3 times | Joined on Jan 2011
#2
Hmm. The discussion here:

http://www.imgtec.com/forum/forum_posts.asp?TID=1121

suggests that I might need some special version of compiler matching exactly the SGX driver version on N900.

So, the question is: Where do I get it?
 
Posts: 1,522 | Thanked: 392 times | Joined on Jul 2010 @ São Paulo, Brazil
#3
If the source does copile in the N900 itself, can't you somehow make it save the copiled result to disk?
 
Posts: 4 | Thanked: 3 times | Joined on Jan 2011
#4
Originally Posted by TiagoTiago View Post
If the source does copile in the N900 itself, can't you somehow make it save the copiled result to disk?
I'd be happy to. But as far as I understand there is no official way in Open GL to get a 'pointer' or something like that to the compiled binary.
 
Posts: 304 | Thanked: 176 times | Joined on Oct 2009
#5
Have you tried downloading the Khronos Windows SDK and run your shader on their emulator? This way you can make sure if it's the shader causing problems or something else.

If I remember correctly the SDK also allows you to compile your own shaders and output them to a file.
 
Posts: 4 | Thanked: 3 times | Joined on Jan 2011
#6
Originally Posted by jessi3k3 View Post
Have you tried downloading the Khronos Windows SDK and run your shader on their emulator? This way you can make sure if it's the shader causing problems or something else.
Yes, shader compiles fine under SDK.

If I remember correctly the SDK also allows you to compile your own shaders and output them to a file.
That is the problem. The shader compiled under SDK refuses to load on device and gives the error that I described above. Apparently, to be able to compile for device some very specific version of the SDK is needed.
 
Reply

Tags
n900 shaders


 
Forum Jump


All times are GMT. The time now is 09:53.