Khronos Public Bugzilla
Bug 724 - GetProgramStageiv not defined in terms of GetProgramResource
GetProgramStageiv not defined in terms of GetProgramResource
Status: RESOLVED LATER
Product: OpenGL
Classification: Unclassified
Component: API Specification
4.3
All All
: P3 normal
: ---
Assigned To: Pat Brown
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-26 18:13 PDT by Alfonse
Modified: 2013-08-22 12:55 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alfonse 2012-09-26 18:13:18 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.
Comment 1 Alfonse 2012-09-26 18:34:00 PDT
BTW, the uses of glGetProgramResource with `GL_ACTIVE_RESOURCES` should be glGetProgramInterface instead.
Comment 2 Pat Brown 2013-08-15 12:17:35 PDT
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
GetProgramInterfaceiv():

* 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.
Comment 3 Pat Brown 2013-08-22 12:55:33 PDT
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".