[Mesa-dev] [PATCH 11/15] arb_gl_spirv: add calls to several nir lowerings

Timothy Arceri tarceri at itsqueeze.com
Sat Jul 21 03:08:43 UTC 2018


Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

On 21/07/18 01:08, Alejandro PiƱeiro wrote:
> For now we are just adding nir lowerings that are needed/mandatory to
> get things working. After everything is settled, we would start to add
> good-to-have lowerings.
> 
> This patch adds the following calls:
> 
>    * nir_split_var_copits and nir_split_per_member_structs: as vulkan
>      drivers are doing now. See commit
>      b0c643d8f579a3e1e45a08f6d9de099f2c45898b ("spirv: Use NIR
>      per-member splitting") for more info.
> 
>      Without this commit, piglit tests like this crashes:
>      spec/arb_gl_spirv/execution/varying/block
> 
>      And in general most of the shaders that includes any kind of
>      struct.
> 
>     * nir_copy_prop: after nir_deref_instr introduction, function calls
>      need this. See commit "nir,spirv: Rework function calls"
>      (c11833ab24dcba26de1b0a5805e35a5d6761514e) for more info.
> ---
> 
> 
> Technically this patch is not needed for XFB/Geometry Streams
> support. But most of the tests for XFB we use include structs, and in
> general is so basic that it makes sense to include in any
> subseries. Additionally this is a really safe commit, as it is just
> about calling existing nir lowerings.
> 
>   src/mesa/main/glspirv.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/src/mesa/main/glspirv.c b/src/mesa/main/glspirv.c
> index ba4a8253671..269bbf4c9e2 100644
> --- a/src/mesa/main/glspirv.c
> +++ b/src/mesa/main/glspirv.c
> @@ -238,6 +238,14 @@ _mesa_spirv_to_nir(struct gl_context *ctx,
>                         prog->Name);
>      nir_validate_shader(nir);
>   
> +   NIR_PASS_V(nir, nir_copy_prop);
> +
> +   /* Split member structs.  We do this before lower_io_to_temporaries so that
> +    * it doesn't lower system values to temporaries by accident.
> +    */
> +   NIR_PASS_V(nir, nir_split_var_copies);
> +   NIR_PASS_V(nir, nir_split_per_member_structs);
> +
>      return nir;
>   }
>   
> 


More information about the mesa-dev mailing list