<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Nov 11, 2016 at 1:39 PM, Ilia Mirkin <span dir="ltr"><<a href="mailto:imirkin@alum.mit.edu" target="_blank">imirkin@alum.mit.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Nov 11, 2016 at 10:23 AM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
> On Nov 11, 2016 6:16 AM, "Ilia Mirkin" <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>> wrote:<br>
>><br>
>> I haven't checked spirv for the specific naming, but note that prim ID can<br>
>> be an output in gs.<br>
><br>
> You're right. I'm not 100% site how we handle that today. We probably just<br>
> pass it through as a varying. It looks like the code here needs to be a bit<br>
> more complex.<br>
<br>
</span>Based on some quick spec and vtn reading, you can just do<br>
<br>
if (*mode == nir_var_shader_out) {<br>
*location = VARYING_SLOT_PRIMITIVE_ID;<br>
} else {<br>
set_mode_system_value(mode);<br>
*location = SYSTEM_VALUE_PRIMITIVE_ID;<br>
}<br></blockquote><div><br></div><div>That's exactly the code I was intending to write!<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Note that this will cause gl_PrimitiveID input to become a sysval in<br>
*every* stage (i.e. TES, TCS, GS gl_PrimitiveIDIn, FS).<br></blockquote><div><br></div><div>Yup.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Cheers,<br>
<br>
-ilia<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
>><br>
>> On Nov 11, 2016 1:34 AM, "Jason Ekstrand" <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
>>><br>
>>> Before, we were treating it as an output which is just completely bogus.<br>
>>> We could go for an input but a system value makes more sense.<br>
>>><br>
>>> Cc: "13.0" <<a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.<wbr>freedesktop.org</a>><br>
>>> ---<br>
>>> src/compiler/spirv/vtn_<wbr>variables.c | 4 ++--<br>
>>> 1 file changed, 2 insertions(+), 2 deletions(-)<br>
>>><br>
>>> diff --git a/src/compiler/spirv/vtn_<wbr>variables.c<br>
>>> b/src/compiler/spirv/vtn_<wbr>variables.c<br>
>>> index bbcca14..a4d5367 100644<br>
>>> --- a/src/compiler/spirv/vtn_<wbr>variables.c<br>
>>> +++ b/src/compiler/spirv/vtn_<wbr>variables.c<br>
>>> @@ -806,8 +806,8 @@ vtn_get_builtin_location(<wbr>struct vtn_builder *b,<br>
>>> set_mode_system_value(mode);<br>
>>> break;<br>
>>> case SpvBuiltInPrimitiveId:<br>
>>> - *location = VARYING_SLOT_PRIMITIVE_ID;<br>
>>> - *mode = nir_var_shader_out;<br>
>>> + *location = SYSTEM_VALUE_PRIMITIVE_ID;<br>
>>> + set_mode_system_value(mode);<br>
>>> break;<br>
>>> case SpvBuiltInInvocationId:<br>
>>> *location = SYSTEM_VALUE_INVOCATION_ID;<br>
>>> --<br>
>>> 2.5.0.400.gff86faf<br>
>>><br>
>>> ______________________________<wbr>_________________<br>
>>> mesa-dev mailing list<br>
>>> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
>>> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br></div></div>