[Mesa-dev] [PATCH 5/8] glsl: Extract marking functions from ir_set_program_inouts.

Paul Berry stereotype441 at gmail.com
Thu Aug 1 14:26:30 PDT 2013


On 31 July 2013 18:16, Ian Romanick <idr at freedesktop.org> wrote:

> On 07/31/2013 02:17 PM, Paul Berry wrote:
>
>> This patch extracts the functions mark_whole_variable() and
>> try_mark_partial_variable() from the ir_set_program_inouts visitor
>> functions.  This will make the code easier to follow when we add
>> geometry shader support.
>> ---
>>   src/glsl/ir_set_program_**inouts.cpp | 59
>> +++++++++++++++++++++++++++++-**--------
>>   1 file changed, 45 insertions(+), 14 deletions(-)
>>
>> diff --git a/src/glsl/ir_set_program_**inouts.cpp
>> b/src/glsl/ir_set_program_**inouts.cpp
>> index 351f65b..8774338 100644
>> --- a/src/glsl/ir_set_program_**inouts.cpp
>> +++ b/src/glsl/ir_set_program_**inouts.cpp
>> @@ -59,6 +59,10 @@ public:
>>      virtual ir_visitor_status visit_enter(ir_discard *);
>>      virtual ir_visitor_status visit(ir_dereference_variable *);
>>
>> +private:
>> +   void mark_whole_variable(ir_**variable *var);
>> +   bool try_mark_partial_variable(ir_**variable *var, ir_rvalue *index);
>> +
>>      struct gl_program *prog;
>>      GLenum shader_type;
>>   };
>> @@ -103,6 +107,17 @@ mark(struct gl_program *prog, ir_variable *var, int
>> offset, int len,
>>      }
>>   }
>>
>> +/**
>> + * Mark an entire variable as used.  Caller must ensure that the variable
>> + * represents a shader input or output.
>> + */
>> +void
>> +ir_set_program_inouts_**visitor::mark_whole_variable(**ir_variable *var)
>> +{
>> +   mark(this->prog, var, 0, var->type->count_attribute_**slots(),
>> +        this->shader_type == GL_FRAGMENT_SHADER);
>> +}
>> +
>>   /* Default handler: Mark all the locations in the variable as used. */
>>   ir_visitor_status
>>   ir_set_program_inouts_visitor:**:visit(ir_dereference_variable *ir)
>> @@ -110,17 +125,43 @@ ir_set_program_inouts_visitor:**:visit(ir_dereference_variable
>> *ir)
>>      if (!is_shader_inout(ir->var))
>>         return visit_continue;
>>
>> -   mark(this->prog, ir->var, 0, ir->type->count_attribute_**slots(),
>> -        this->shader_type == GL_FRAGMENT_SHADER);
>> +   mark_whole_variable(ir->var);
>>
>>      return visit_continue;
>>   }
>>
>> +/**
>> + * Try to mark a portion of the given variable as used.  Caller must
>> ensure
>> + * that the variable represents a shader input or output which can be
>> indexed
>> + * into in array fashion (an array, matrix, or vector).
>>
>
> I think this comment is misleading.  All variable indexing of vectors
> should have been converted to the insert or extract IR by now.  Right?


Oh yeah, thanks.  I've fixed the comment.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130801/1d0d1dea/attachment.html>


More information about the mesa-dev mailing list