[Mesa-dev] [PATCH 10/34] glsl: add builtins for geometry shaders.

Paul Berry stereotype441 at gmail.com
Tue Jul 30 20:21:05 PDT 2013


On 30 July 2013 11:13, Kenneth Graunke <kenneth at whitecape.org> wrote:

> On 07/28/2013 11:03 PM, Paul Berry wrote:
>
>> From: Bryan Cain <bryancain3 at gmail.com>
>>
>> v2 (Paul Berry <stereotype441 at gmail.com>): Account for rework of
>> builtin_variables.cpp.  Use INTERP_QUALIFIER_FLAT for gl_PrimitiveID
>> so that it will obey provoking vertex conventions.  Convert to GLSL
>> 1.50 style geometry shaders.
>> ---
>>   src/glsl/builtin_variables.cpp               | 11 +++++++++--
>>   src/glsl/builtins/ir/**EmitVertex.ir           |  5 +++++
>>   src/glsl/builtins/ir/**EndPrimitive.ir         |  5 +++++
>>   src/glsl/builtins/profiles/**150.geom          |  3 +++
>>   src/glsl/builtins/tools/**generate_builtins.py |  6 ++++--
>>   5 files changed, 26 insertions(+), 4 deletions(-)
>>   create mode 100644 src/glsl/builtins/ir/**EmitVertex.ir
>>   create mode 100644 src/glsl/builtins/ir/**EndPrimitive.ir
>>   create mode 100644 src/glsl/builtins/profiles/**150.geom
>>
>> diff --git a/src/glsl/builtin_variables.**cpp
>> b/src/glsl/builtin_variables.**cpp
>> index 1e88b6a..9d927a4 100644
>> --- a/src/glsl/builtin_variables.**cpp
>> +++ b/src/glsl/builtin_variables.**cpp
>> @@ -686,8 +686,10 @@ builtin_variable_generator::**
>> generate_gs_special_vars()
>>       * the specific case of gl_PrimitiveIDIn.  So we don't need to treat
>>       * gl_PrimitiveIDIn as an {ARB,EXT}_geometry_shader4-**only
>> variable.
>>       */
>> -   add_input(VARYING_SLOT_**PRIMITIVE_ID, int_t, "gl_PrimitiveIDIn");
>> -   add_output(VARYING_SLOT_**PRIMITIVE_ID, int_t, "gl_PrimitiveID");
>> +   add_input(VARYING_SLOT_**PRIMITIVE_ID, int_t, "gl_PrimitiveIDIn")
>> +      ->interpolation = INTERP_QUALIFIER_FLAT;
>> +   add_output(VARYING_SLOT_**PRIMITIVE_ID, int_t, "gl_PrimitiveID")
>> +      ->interpolation = INTERP_QUALIFIER_FLAT;
>>   }
>>
>
> This took a moment to understand :)
>
> Could we instead use a temporary?  Something like:
>
>    ir_variable *var;
>    var = add_input(VARYING_SLOT_**PRIMITIVE_ID, int_t,
> "gl_PrimitiveIDIn");
>    var->interpolation = INTERP_QUALIFIER_FLAT;
>    var = add_input(VARYING_SLOT_**PRIMITIVE_ID, int_t, "gl_PrimitiveID");
>    var->interpolation = INTERP_QUALIFIER_FLAT;
>
> etc.


Sure, no problem.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130730/71451030/attachment.html>


More information about the mesa-dev mailing list