Imagination PowerVR SDK Blog

Sampler name "texture" in fragment shader does not work (OpenGL ES Emulator 3.4 for Windows)


#1

When I define a texture sampler in my fragment shader with uniform sampler2D texture; and I try to get the uniform location with glGetUniformLocation(progId,“texture”); the function returns -1. This seems to be the same for all texture samplers names containing “texture”. glGetActiveUniform returned “PVR_TEXTURE” as uniform name. Is this a bug, some debugging feature or something else?


#2

“texture” is already a built-in function, defined in the global namespace. So I can easily see why the compiler wouldn’t like this.


#3

This can occur when using GLSL ES 1.0 shaders since ‘texture’ wasn’t a built-in function in that version of the language, so we convert it to ‘PVR_TEXTURE’ before passing the shader to the host.



However we currently have no logic in the uniform querying interface convert it back to ‘texture’ which is why you’re seeing this behaviour. I’ll file a bug report to add conversions to the uniform querying functions.