[Mesa-dev] [PATCH 4/5] glsl: Don't copy array of sampler parameters when inlining functions.

Fabian Bieler fabianbieler at fastmail.fm
Tue Jun 18 02:11:42 PDT 2013


On 2013-06-18 11:05, Ian Romanick wrote:
> On 06/03/2013 01:23 PM, Fabian Bieler wrote:
>> Remove The parameter from the list of parameters and replace the derefs in the
>> function body with the deref of the argument.
> 
> It seems like the existing code would break for some uses.  Is there a piglit test to go along with this change?
tests/spec/glsl-1.10/execution/samplers/in-parameter-array.shader_test is a basic test for this. Unfortunately I don't see what a shader would have to do to break ir_sampler_replacement_visitor (I presume). If you can point me in the right direction I'll write another test.
> 
>> This is the way scalar sampler variables are handled already.
>>
>> Signed-off-by: Fabian Bieler <fabianbieler at fastmail.fm>
>> ---
>>   src/glsl/opt_function_inlining.cpp | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/glsl/opt_function_inlining.cpp b/src/glsl/opt_function_inlining.cpp
>> index 0733d51..25a8ff8 100644
>> --- a/src/glsl/opt_function_inlining.cpp
>> +++ b/src/glsl/opt_function_inlining.cpp
>> @@ -123,7 +123,7 @@ ir_call::generate_inline(ir_instruction *next_ir)
>>         ir_rvalue *param = (ir_rvalue *) param_iter.get();
>>
>>         /* Generate a new variable for the parameter. */
>> -      if (sig_param->type->base_type == GLSL_TYPE_SAMPLER) {
>> +      if (sig_param->type->get_scalar_type()->is_sampler()) {
>>        /* For samplers, we want the inlined sampler references
>>         * referencing the passed in sampler variable, since that
>>         * will have the location information, which an assignment of
>> @@ -178,7 +178,7 @@ ir_call::generate_inline(ir_instruction *next_ir)
>>         ir_instruction *const param = (ir_instruction *) param_iter.get();
>>         ir_variable *sig_param = (ir_variable *) sig_param_iter.get();
>>
>> -      if (sig_param->type->base_type == GLSL_TYPE_SAMPLER) {
>> +      if (sig_param->type->get_scalar_type()->is_sampler()) {
>>        ir_dereference *deref = param->as_dereference();
>>
>>        assert(deref);
>>
> 



More information about the mesa-dev mailing list