[Mesa-dev] [PATCH] spirv: gl_PrimitiveID in the fragment shader is handled as an input

Jason Ekstrand jason at jlekstrand.net
Tue Jan 10 04:11:53 UTC 2017


On Mon, Jan 9, 2017 at 6:57 PM, Dave Airlie <airlied at gmail.com> wrote:

> On 10 January 2017 at 02:05, Jason Ekstrand <jason at jlekstrand.net> wrote:
> > Also, we should probably consider converting it over to a system value
> one
> > of these days.  That would make more sense from a theoretical model
> > perspective.  Not sure if it makes sense in any drivers though.
> >
> > On Mon, Jan 9, 2017 at 8:03 AM, Jason Ekstrand <jason at jlekstrand.net>
> wrote:
> >>
> >> On Mon, Jan 9, 2017 at 4:50 AM, Iago Toral Quiroga <itoral at igalia.com>
> >> wrote:
> >>>
> >>> Geometry and Tessellation stages do handle this as a system value
> >>> instead.
> >>>
> >>> Fixes:
> >>> dEQP-VK.geometry.basic.primitive_id
> >>> ---
> >>>  src/compiler/spirv/vtn_variables.c | 3 ++-
> >>>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/src/compiler/spirv/vtn_variables.c
> >>> b/src/compiler/spirv/vtn_variables.c
> >>> index 9b84c97..cf47e5d 100644
> >>> --- a/src/compiler/spirv/vtn_variables.c
> >>> +++ b/src/compiler/spirv/vtn_variables.c
> >>> @@ -908,7 +908,8 @@ vtn_get_builtin_location(struct vtn_builder *b,
> >>>        set_mode_system_value(mode);
> >>>        break;
> >>>     case SpvBuiltInPrimitiveId:
> >>> -      if (*mode == nir_var_shader_out) {
> >>> +      if (*mode == nir_var_shader_out ||
> >>> +          b->shader->stage == MESA_SHADER_FRAGMENT) {
> >>
> >>
> >> Can we do this instead:
>
> I've had this in my geom shader tree exactly the same patch, I thought I'd
> sent it,
>
> but I think Jason code is cleaner so maybe use that,
>
> Reviewed-by: Dave Airlie <ailried at redhat.com>
>
> However I don't think this makes any sense as a system value,
> at least on amd hw it comes as an input.
>

I think we have it as an input too. :-)   I was mostly saying that because
it seemed like a system-value sort of thing not because it would be more
convenient.  If it's an input for both of us, we might as well leave it
that way.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170109/02934a63/attachment.html>


More information about the mesa-dev mailing list