[Mesa-dev] [PATCH 18/20] mesa: Rewrite the way uniforms are tracked and handled

Ian Romanick idr at freedesktop.org
Mon Oct 31 12:26:12 PDT 2011


On 10/28/2011 02:45 PM, Eric Anholt wrote:
> On Fri, 28 Oct 2011 10:42:45 -0700, "Ian Romanick"<idr at freedesktop.org>  wrote:
>> From: Ian Romanick<ian.d.romanick at intel.com>
>>
>> Switch all of the code in ir_to_mesa, st_glsl_to_tgsi, glUniform*,
>> glGetUniform, glGetUniformLocation, and glGetActiveUniforms to use the
>> gl_uniform_storage structures in the gl_shader_program.
>>
>> A couple of notes:
>>
>>   * Like most rewrite-the-world patches, this should be reviewed by
>>     applying the patch and examining the modified functions.
>>
>>   * This leaves a lot of dead code around in linker.cpp and
>>     uniform_query.cpp.  This will be deleted in the next patches.
>>
>> Signed-off-by: Ian Romanick<ian.d.romanick at intel.com>
>> ---
>>   src/glsl/linker.cpp                        |    2 +-
>>   src/mesa/main/shaderapi.c                  |   22 +-
>>   src/mesa/main/shaderobj.c                  |   12 +-
>>   src/mesa/main/uniform_query.cpp            |  627 +++++++++++++++++++---------
>>   src/mesa/main/uniforms.c                   |    8 +-
>>   src/mesa/main/uniforms.h                   |    4 +-
>>   src/mesa/program/ir_to_mesa.cpp            |   47 ++-
>>   src/mesa/program/sampler.cpp               |   12 +-
>>   src/mesa/state_tracker/st_draw.c           |   10 +-
>>   src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   13 +-
>>   10 files changed, 505 insertions(+), 252 deletions(-)
>>
>
>> diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
>> index db2f200..50a724b 100644
>> --- a/src/mesa/main/uniform_query.cpp
>> +++ b/src/mesa/main/uniform_query.cpp
>
>> +      log_uniform(values, basicType, components, 1, count,
>> +		  false, shProg, location, uni);
>> +   }
>> +
>> +   /* Validate the texture unit setting.
>> +    */
>> +   /* FINISHME: I cannot find any justification for this in the GL spec.
>> +    */
>
> I think this maybe comes from (2.1 spec, page 106):
>
>      "Setting a sampler’s value to i selects texture image unit number
>       i. The values of i range from zero to the implementation-dependent
>       maximum supported number of texture image units."
>
> Though the spec doesn't say what *should* happen when someone gives an i
> out of range.  This seems like a reasonable behavior, though.

Good catch!  Table 2.3 (in the Errors section) says that when a numeric 
value is out of range, the GL must generate GL_INVALID_VALUE and ignore 
the command.

>> @@ -3288,6 +3290,15 @@ get_mesa_program(struct gl_context *ctx,
>>         }
>>      }
>>
>> +   /* This has to be done last.  Any operation the can cause
>
> "that can"



More information about the mesa-dev mailing list