Aliased names for glCreateShader and glCreateShaderObjectARB

Carl Worth cworth at cworth.org
Thu Aug 2 13:23:11 PDT 2012


José,

I recently found a program mixing calls to glCreateShaderObjectARB and
glUseProgram, (rather than sticking to consistent use of
glUseProgramObjectARB).

The current apitrace code uses three different tables for mapping
shaders and programs:

	_shader_map
	_program_map
	_handleARB_map

The problem we ran into with this trace is that we could not trim out
calls to glCreateShader for unused shaders without causing link failures
for subsequent programs.

I implemented a quick hack with a single table for all of the above uses
and that fixed our particular problem, (particularly since I know that
our implementation uses a single namespace for all of the above).

Eric pointed out that an implementation supporting
glCreateShaderObjectARB is effectively forced to have a single namespace
for shaders and programs, (so that one map is the correct answer). But
an implementation without this support might have separate namespaces,
(in which case we would want one shader_map and one program_map). But in
no case do we actually want three tables.

I was trying to decide whether to write the clever code to determine
whether to use one or two tables or just punt with a single table for
now. And then I ran across this existing comment in the gltypes.py:

# Share the same mapping table for uniform locations of both core and
# GL_ARB_shader_objects programs.  For a combination of reasons:
#
# - all OpenGL implementations appear to alias the names for both kind of
#   programs;
#
# - most applications will use only one kind of shader programs;
#
# - some applications actually mix glUniformXxx calls with
#   GL_ARB_shader_objects programs and glUniformXxxARB calls with core
#   programs, and therefore, rely on a joint implementation.
#
# We use GLhandleARB as program key, since it is wider (void *) on MacOSX.

This looks like plenty of justification to merge the above three tables
into one. Do you agree, José?

-Carl

-- 
carl.d.worth at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/apitrace/attachments/20120802/44d1a94a/attachment.pgp>


More information about the apitrace mailing list