Re: [Mesa-dev] [PATCH] spirv: Builtin Layer is an input for fragment shaders

2016-12-02 Thread Jason Ekstrand
Reviewed-by: Jason Ekstrand 

On Fri, Dec 2, 2016 at 5:16 AM, Iago Toral Quiroga 
wrote:

> This change makes it so we emit a load_input intrinsic when Layer
> is read in a fragment shader.
> ---
>
> Even with this, layered rendering does not seem to work in the Vulkan
> driver, so there is something else that is broken. We are probably
> not mapping the Layer input correctly somewhere.
>

I'm not sure how fragment shader layers work in GL today.  I did recently
add a NIR intrinsic for layer_id and hook it up in the FS backend.  We can
probably just plumb that through.  It would be good to check GL first
though.

--Jason


>  src/compiler/spirv/vtn_variables.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_
> variables.c
> index 14366dc..c6d73a7 100644
> --- a/src/compiler/spirv/vtn_variables.c
> +++ b/src/compiler/spirv/vtn_variables.c
> @@ -819,7 +819,12 @@ vtn_get_builtin_location(struct vtn_builder *b,
>break;
> case SpvBuiltInLayer:
>*location = VARYING_SLOT_LAYER;
> -  *mode = nir_var_shader_out;
> +  if (b->shader->stage == MESA_SHADER_FRAGMENT)
> + *mode = nir_var_shader_in;
> +  else if (b->shader->stage == MESA_SHADER_GEOMETRY)
> + *mode = nir_var_shader_out;
> +  else
> + unreachable("invalid stage for SpvBuiltInLayer");
>break;
> case SpvBuiltInViewportIndex:
>*location = VARYING_SLOT_VIEWPORT;
> --
> 2.7.4
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] spirv: Builtin Layer is an input for fragment shaders

2016-12-02 Thread Iago Toral Quiroga
This change makes it so we emit a load_input intrinsic when Layer
is read in a fragment shader.
---

Even with this, layered rendering does not seem to work in the Vulkan
driver, so there is something else that is broken. We are probably
not mapping the Layer input correctly somewhere.

 src/compiler/spirv/vtn_variables.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/compiler/spirv/vtn_variables.c 
b/src/compiler/spirv/vtn_variables.c
index 14366dc..c6d73a7 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -819,7 +819,12 @@ vtn_get_builtin_location(struct vtn_builder *b,
   break;
case SpvBuiltInLayer:
   *location = VARYING_SLOT_LAYER;
-  *mode = nir_var_shader_out;
+  if (b->shader->stage == MESA_SHADER_FRAGMENT)
+ *mode = nir_var_shader_in;
+  else if (b->shader->stage == MESA_SHADER_GEOMETRY)
+ *mode = nir_var_shader_out;
+  else
+ unreachable("invalid stage for SpvBuiltInLayer");
   break;
case SpvBuiltInViewportIndex:
   *location = VARYING_SLOT_VIEWPORT;
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev