- if (is_subroutine_uniform_program_interface(programInterface)) {
- /* ARB_program_interface_query doesn't explicitly says that those
- * uniforms would need a linked shader, or that should fail if it is
- * not the case, but Section 7.6 (Uniform Variables) of the OpenGL
- * 4.4 Core Profile says:
- *
- * "A uniform is considered an active uniform if the compiler and
- * linker determine that the uniform will actually be accessed
- * when the executable code is executed. In cases where the
- * compiler and linker cannot make a conclusive determination,
- * the uniform will be considered active."
- *
- * So in order to know the real number of active subroutine uniforms
- * we would need a linked shader .
- *
- * At the same time, Section 7.3 (Program Objects) of the OpenGL 4.4
- * Core Profile says:
- *
- * "The GL provides various commands allowing applications to
- * enumerate and query properties of active variables and in-
- * terface blocks for a specified program. If one of these
- * commands is called with a program for which LinkProgram
- * succeeded, the information recorded when the program was
- * linked is returned. If one of these commands is called with a
- * program for which LinkProgram failed, no error is generated
- * unless otherwise noted."
- * <skip>
- * "If one of these commands is called with a program for which
- * LinkProgram had never been called, no error is generated
- * unless otherwise noted, and the program object is considered
- * to have no active variables or interface blocks."
- *
- * So if the program is not linked we will return 0.
- */
- struct gl_linked_shader *sh =
- lookup_linked_shader(program, programInterface, "glGetProgramInterfaceiv");
-
- *params = sh ? sh->NumSubroutineUniforms : 0;
- } else {
- for (i = 0, *params = 0; i < shProg->NumProgramResourceList; i++)
- if (shProg->ProgramResourceList[i].Type == programInterface)
- (*params)++;
- }