Khronos public bugtracker – Bug 724
GetProgramStageiv not defined in terms of GetProgramResource
Last modified: 2013-08-22 12:55:33 PDT
Virtually all of the old program introspection functions were defined in terms of glGetProgramResource and its ilk. Except for glGetProgramStageiv.
glGetProgramStageiv with `GL_ACTIVE_SUBROUTINES` should be defined in terms of glGetProgramResource with `GL_ACTIVE_RESOURCES` and the appropriate shadertype-to-programInterface conversion in accord with Table 7.9 of the 4.3 spec. Similarly, glGetProgramStageiv with `GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS` should be defined in terms of glGetProgramResource with `GL_ACTIVE_RESOURCES` and the appropriate shadertype-to-programInterface conversion in accord with Table 7.10 of the 4.3 spec.
BTW, the uses of glGetProgramResource with `GL_ACTIVE_RESOURCES` should be glGetProgramInterface instead.
One of my colleagues at NVIDIA also noticed this issue, and filed a similar bug.
The ARB_program_interface_query changes were mostly intended to consolidate all the GetActive* APIs. When I wrote the proposal, I didn't notice that we had the opportunity to redefine GetProgramStageiv() in terms of the new APIs. Most of the GetProgramStageiv() <pname> values are already supported by
* ACTIVE_SUBROUTINE_UNIFORMS =>
ACTIVE_RESOURCES for the appropriate SUBROUTINE_UNIFORM interface
* ACTIVE_SUBROUTINES =>
ACTIVE_RESOURCES for the appropriate SUBROUTINE interface
* ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH =>
MAX_NAME_LENGTH for the appropriate SUBROUTINE_UNIFORM interface
* ACTIVE_SUBROUTINE_MAX_LENGTH =>
MAX_NAME_LENGTH for the appropriate SUBROUTINE interface
However, the enum ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS is not supported by
GetProgramIntefaceiv(). It doesn't really have anything to do with enumerating
active subroutines or subroutine locations, which is probably why I missed it.
The value is potentially needed for setting up the call to UniformSubroutinesiv(), which requires that you set all the subroutines in one pop -- <count> must be equal to the value of ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS.
I think the thinking is that we could add support for this in the future, probably just have GetProgramInterfaceiv() accept
ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS for all SUBROUTINE_UNIFORM interfaces. Obviously too late for 4.4 (sorry), but maybe the next time around.
We would definitely need to fix the uniform locations issue if we wanted to deprecate/remove the old enumeration APIs in the future and support only ARB_program_interface_query.
The primary action here seems to be a feature request for the next version of OpenGL to provide glGetProgramStageiv() support for ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS, which is the only glGetProgramStageiv() feature not directly supported by ARB_program_interface_query.
That's covered by the bug/feature request (10648) described in comment #2, so we are closing as "RESOLVED - LATER".