ES 2.0 glShaderBinary/glShaderSource

Started by
1 comment, last by hdxpete 10 years, 11 months ago

Ok, it just dawned onto me now that glShaderSource may not be supported on a platform (from what i've seen it always is) it also seems glShaderBinary is optional, also openGL doesn't have a way for you to generate your shader binary offline.

I would like to be a defensive programmer here however...

it seems i have to rely on glShaderSource being supported on a system. am i correct here?

if god forbid glShaderSource and glShaderBinary are unsupported on a ES 2.0 chip, how exactly am i suppose to generate a shader and/or load it onto the card?

Advertisement

The docs say:

Shader compiler support is optional, and thus must be queried before use by calling glGet with argument GL_SHADER_COMPILER. glShaderSource, glCompileShader, glGetShaderPrecisionFormat, and glReleaseShaderCompiler will each generate GL_INVALID_OPERATION on implementations that do not support a shader compiler. Such implementations instead offer the glShaderBinary alternative for supplying a pre-compiled shader binary.

Which to me says that if it doesn't support glShaderSource, then you can safely fall back to glShaderBinary. If glShaderBinary is not supported, then you can safely fall back to glShaderSource. I don't think a valid implementation can offer no support for either (they must, as far as I'm aware, support at least one, if not both).

[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

Cornstalks, appreciate the answer. i didn't see that line. my eyes must have glossed over it. thxs.

This topic is closed to new replies.

Advertisement