I am working on GLES program using ARM GLES3.0 Emulator ver 1.4.
I want to print all active uniform detail.
I ahve 25 active Uniform in my shader code, out of these 25 uniforms, second uniform is array of uniform 'uniformArray[100]'.
But when I iterate through active uniforms to see detail of each uniform, itstarts giving garbage values after first 25 uniforms( i.e after activeUniform1, uniformArray[0], uniformArray[1], uniformArray[2],... uniformArray[23] )
Please confirm if it was an issue with EGL 1.4
pseudo code -
GLint numUniforms = 0; GL_CHECK(glGetProgramiv(uiProgram, GL_ACTIVE_UNIFORMS, &numUniforms)); printf("--------------------\nList of active uniforms:\n"); // numUniforms is 25 for my problem for (int i = 0; i < numUniforms; i++) { // now -iteratuing through uniforms GLchar name[256] = { 0 }; GLsizei len = 0; GLint size = 0; GLenum type = 0; GL_CHECK(glGetActiveUniform(uiProgram, i, 256, &len, &size, &type, name)); printf("Uniform: %s, size: %d\n", name, size); std::string modifiedName = getUniformName(name, size); // replaces uniformArray[0] by uniformArray for (i = 0; i < size; ++i) { std::stringstream ss; ss << modifiedName; if (size > 1) { ss << '[' << i << ']'; } std::string elemName = ss.str(); float uniformValue = 0.0f; GLint location = glGetUniformLocation(program, elemName.c_str()); assert(location != -1); if (location == -1) { continue; } switch (elemType) { case GL_FLOAT: glGetUniformfv(uiProgram, location, uniformValue); std::cout << elemName << ":" << uniformValue << std::endl; ..... .... } } } Output: fltUniform1:1.7 uniformArray[0]:1.5 uniformArray[1]:1.6 uniformArray[2]:1.3 uniformArray[3]:1.8 .. .. uniformArray[22]:4.8 uniformArray[23]:4.3 uniformArray[24]:4.3 uniformArray[25]:4.3 uniformArray[26]:4.3 uniformArray[27]:4.3 ... //repeats total printed uniforms become 25 ... uniformArray[98]:4.3 uniformArray[99]:4.3 fltUniform2:-1.073742e+008 intUniform3:-858993460 intUniform4:-858993460 ...
Hi Sunil,
can you provide the shader where the uniform array is declared?
Thanks,
Chris
What version of emulator you get reported by calling glGetString(GL_RENDERER); ?