[Mesa-stable] [Mesa-dev] [PATCH 4/4] nir/spirv: Make gl_PrimitiveId a system value

Jason Ekstrand jason at jlekstrand.net
Fri Nov 11 22:11:01 UTC 2016


On Fri, Nov 11, 2016 at 1:39 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:

> On Fri, Nov 11, 2016 at 10:23 AM, Jason Ekstrand <jason at jlekstrand.net>
> wrote:
> > On Nov 11, 2016 6:16 AM, "Ilia Mirkin" <imirkin at alum.mit.edu> wrote:
> >>
> >> I haven't checked spirv for the specific naming, but note that prim ID
> can
> >> be an output in gs.
> >
> > You're right.  I'm not 100% site how we handle that today.  We probably
> just
> > pass it through as a varying.  It looks like the code here needs to be a
> bit
> > more complex.
>
> Based on some quick spec and vtn reading, you can just do
>
> if (*mode == nir_var_shader_out) {
>   *location = VARYING_SLOT_PRIMITIVE_ID;
> } else {
>   set_mode_system_value(mode);
>   *location = SYSTEM_VALUE_PRIMITIVE_ID;
> }
>

That's exactly the code I was intending to write!


> Note that this will cause gl_PrimitiveID input to become a sysval in
> *every* stage (i.e. TES, TCS, GS gl_PrimitiveIDIn, FS).
>

Yup.


> Cheers,
>
>   -ilia
>
> >
> >>
> >> On Nov 11, 2016 1:34 AM, "Jason Ekstrand" <jason at jlekstrand.net> wrote:
> >>>
> >>> Before, we were treating it as an output which is just completely
> bogus.
> >>> We could go for an input but a system value makes more sense.
> >>>
> >>> Cc: "13.0" <mesa-stable at lists.freedesktop.org>
> >>> ---
> >>>  src/compiler/spirv/vtn_variables.c | 4 ++--
> >>>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/src/compiler/spirv/vtn_variables.c
> >>> b/src/compiler/spirv/vtn_variables.c
> >>> index bbcca14..a4d5367 100644
> >>> --- a/src/compiler/spirv/vtn_variables.c
> >>> +++ b/src/compiler/spirv/vtn_variables.c
> >>> @@ -806,8 +806,8 @@ vtn_get_builtin_location(struct vtn_builder *b,
> >>>        set_mode_system_value(mode);
> >>>        break;
> >>>     case SpvBuiltInPrimitiveId:
> >>> -      *location = VARYING_SLOT_PRIMITIVE_ID;
> >>> -      *mode = nir_var_shader_out;
> >>> +      *location = SYSTEM_VALUE_PRIMITIVE_ID;
> >>> +      set_mode_system_value(mode);
> >>>        break;
> >>>     case SpvBuiltInInvocationId:
> >>>        *location = SYSTEM_VALUE_INVOCATION_ID;
> >>> --
> >>> 2.5.0.400.gff86faf
> >>>
> >>> _______________________________________________
> >>> mesa-dev mailing list
> >>> mesa-dev at lists.freedesktop.org
> >>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-stable/attachments/20161111/64782205/attachment.html>


More information about the mesa-stable mailing list