<div dir="ltr">On 30 July 2013 11:13, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 07/28/2013 11:03 PM, Paul Berry wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
From: Bryan Cain <<a href="mailto:bryancain3@gmail.com" target="_blank">bryancain3@gmail.com</a>><br>
<br>
v2 (Paul Berry <<a href="mailto:stereotype441@gmail.com" target="_blank">stereotype441@gmail.com</a>>): Account for rework of<br>
builtin_variables.cpp. Use INTERP_QUALIFIER_FLAT for gl_PrimitiveID<br>
so that it will obey provoking vertex conventions. Convert to GLSL<br>
1.50 style geometry shaders.<br>
---<br>
src/glsl/builtin_variables.cpp | 11 +++++++++--<br>
src/glsl/builtins/ir/<u></u>EmitVertex.ir | 5 +++++<br>
src/glsl/builtins/ir/<u></u>EndPrimitive.ir | 5 +++++<br>
src/glsl/builtins/profiles/<u></u>150.geom | 3 +++<br>
src/glsl/builtins/tools/<u></u>generate_builtins.py | 6 ++++--<br>
5 files changed, 26 insertions(+), 4 deletions(-)<br>
create mode 100644 src/glsl/builtins/ir/<u></u>EmitVertex.ir<br>
create mode 100644 src/glsl/builtins/ir/<u></u>EndPrimitive.ir<br>
create mode 100644 src/glsl/builtins/profiles/<u></u>150.geom<br>
<br>
diff --git a/src/glsl/builtin_variables.<u></u>cpp b/src/glsl/builtin_variables.<u></u>cpp<br>
index 1e88b6a..9d927a4 100644<br>
--- a/src/glsl/builtin_variables.<u></u>cpp<br>
+++ b/src/glsl/builtin_variables.<u></u>cpp<br>
@@ -686,8 +686,10 @@ builtin_variable_generator::<u></u>generate_gs_special_vars()<br>
* the specific case of gl_PrimitiveIDIn. So we don't need to treat<br>
* gl_PrimitiveIDIn as an {ARB,EXT}_geometry_shader4-<u></u>only variable.<br>
*/<br>
- add_input(VARYING_SLOT_<u></u>PRIMITIVE_ID, int_t, "gl_PrimitiveIDIn");<br>
- add_output(VARYING_SLOT_<u></u>PRIMITIVE_ID, int_t, "gl_PrimitiveID");<br>
+ add_input(VARYING_SLOT_<u></u>PRIMITIVE_ID, int_t, "gl_PrimitiveIDIn")<br>
+ ->interpolation = INTERP_QUALIFIER_FLAT;<br>
+ add_output(VARYING_SLOT_<u></u>PRIMITIVE_ID, int_t, "gl_PrimitiveID")<br>
+ ->interpolation = INTERP_QUALIFIER_FLAT;<br>
}<br>
</blockquote>
<br></div></div>
This took a moment to understand :)<br>
<br>
Could we instead use a temporary? Something like:<br>
<br>
ir_variable *var;<br>
var = add_input(VARYING_SLOT_<u></u>PRIMITIVE_ID, int_t, "gl_PrimitiveIDIn");<br>
var->interpolation = INTERP_QUALIFIER_FLAT;<br>
var = add_input(VARYING_SLOT_<u></u>PRIMITIVE_ID, int_t, "gl_PrimitiveID");<br>
var->interpolation = INTERP_QUALIFIER_FLAT;<br>
<br>
etc.</blockquote><div><br></div><div>Sure, no problem.<br></div></div></div></div>