maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Precompiled shader binary possible on N900? (https://talk.maemo.org/showthread.php?t=68714)

Dmitriy 2011-01-21 11:26

Precompiled shader binary possible on N900?
 
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?

Dmitriy 2011-01-21 11:31

Precompiled shader binary possible on N900?
 
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?

TiagoTiago 2011-01-31 09:30

Re: Precompiled shader binary possible on N900?
 
If the source does copile in the N900 itself, can't you somehow make it save the copiled result to disk?

Dmitriy 2011-01-31 13:56

Re: Precompiled shader binary possible on N900?
 
Quote:

Originally Posted by TiagoTiago (Post 932418)
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.

jessi3k3 2011-02-02 03:22

Re: Precompiled shader binary possible on N900?
 
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.

Dmitriy 2011-02-05 03:29

Re: Precompiled shader binary possible on N900?
 
Quote:

Originally Posted by jessi3k3 (Post 933825)
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.

Quote:

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.


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

vBulletin® Version 3.8.8