Page 1 of 1
[fixed]android ogles2 shader problem fixed
Posted: Mon Aug 10, 2015 2:22 pm
by feelthat
//in COGLES2Solid.vsh
//for (i = 0; i < int(uLightCount); i++) //will failed on some android system
{
if (uLightType == 0)
pointLight(i, Position, Normal, Ambient, Diffuse, Specular);
}
//please use this way~~~
for (i = 0; i < int(MAX_LIGHTS); i++)
{
if( i >= uLightCount )
break;
if (uLightType == 0)
pointLight(i, Position, Normal, Ambient, Diffuse, Specular);
}
Re: android ogles2 shader problem fixed
Posted: Tue Aug 11, 2015 10:34 am
by CuteAlien
Thanks for the report. Seems it's not just in COGLES2Solid.vsh, but same bug is also in COGLES2Refelction2Layer.vsh, , COGLES2Solid2.vsh and COGLES2SphereMap.vsh.
Some cards accept it, but it's not really valid in GLSL it seems. Will fix later on (when I'm back on a system where I can test Android).
Re: android ogles2 shader problem fixed
Posted: Tue Aug 11, 2015 8:43 pm
by CuteAlien
Fixed in r5117.
Re: [fixed]android ogles2 shader problem fixed
Posted: Wed Aug 12, 2015 8:10 pm
by hendu
Unrelated to this, but are you aware of the command-line shader checker?
git clone
https://github.com/clbr/glsl-optimizer.git
cd glsl-optimizer/src/glsl
make
cd ../../contrib/glslopt
make
sudo cp glslopt /usr/bin
I regularly use it to check desktop GLSL shaders, but it also supports GLES 2 and 3.
Usage: glslopt <-f|-v> <input shader> [<output shader>]
-f : fragment shader (default)
-v : vertex shader
-1 : target OpenGL (default)
-2 : target OpenGL ES 2.0
-3 : target OpenGL ES 3.0
If no output specified, output is to [input].out.
Re: [fixed]android ogles2 shader problem fixed
Posted: Wed Aug 12, 2015 10:15 pm
by CuteAlien
Didn't know it - thanks. Also for the make instructions (as it didn't build otherwise - although
https://github.com/aras-p/glsl-optimizer which seemed the original got a little further on building before it failed).
But won't use it on Irrlicht-shaders - because it does remove comments and makes the code harder to read. And Irrlicht shaders aren't really meant to be used like that in a time-critical game anyway. They do everything and have to reduce for a real game.
Re: [fixed]android ogles2 shader problem fixed
Posted: Thu Aug 13, 2015 8:31 am
by hendu
I meant use it as a checker, not as an optimizer - delete the .out optimized shaders. It will bail out if you have invalid GLSL.
Very handy when editing shaders, speedy test cycles.