No preprocessor support in programs for GLSLES shaders?

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

No preprocessor support in programs for GLSLES shaders?

Post by d000hg »

It seems from my testing that using the GLSL preprocessor_defines keyword in program scripts does not work against GLSLES shaders... no errors but the shader works as if all #define-d symbols are missing. Is this supposed to work - I guessed it'd be the same as glsl (although Cg and glsl use different script keywords).
oiram
Halfling
Posts: 87
Joined: Sun Dec 13, 2009 5:06 am
x 6

Re: No preprocessor support in programs for GLSLES shaders?

Post by oiram »

d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: No preprocessor support in programs for GLSLES shaders?

Post by d000hg »

Very useful but isn't that explicitly for GLSLESCgProgram, i.e. when Ogre automatically generates a GLSLES version of Cg shaders?

My question was for native GLSLES shaders, which I expected would support the GLSL preprocessor_defines option.

BTW - do you know if you patch made it into the 1.8.x branch?
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: No preprocessor support in programs for GLSLES shaders?

Post by masterfalcon »

Read the last comment in that thread.

The preprocessor should be running. Could you give an example of something not working for you?
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: No preprocessor support in programs for GLSLES shaders?

Post by d000hg »

The last comment said it might make it in... :)

Anyway I still think there's a slight mis-communication here: that thread is talking about using compile_arguments in a Cg shader, running on GLSLES through GLSLESCgProgram. My question is about using GLSL-style preprocessor_defines in native GLSLES shaders.

I created one GLSLES shader using a #define to render either red/green, and two separate programs - one set the #define value, the other did not. Both programs rendered the same colour. However looking at OgreGLSLESProgram, I do see code for preprocessor_defines. I'll re-test now I know the codebase is definitely supposed to support it, to double-check.