X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fglspirv.c;h=87075a547cd7f0fdde8c86ee10f8a306a3cdb11e;hb=bbe2d50b589e0d7b7b63d63814a5271b680164ce;hp=71dc9154ef2f158b0e7dde01ac6c5904a6134b24;hpb=abb6d0797c8a0c32f45d38d7a41e96b2db47a47d;p=mesa.git diff --git a/src/mesa/main/glspirv.c b/src/mesa/main/glspirv.c index 71dc9154ef2..87075a547cd 100644 --- a/src/mesa/main/glspirv.c +++ b/src/mesa/main/glspirv.c @@ -24,6 +24,7 @@ #include "glspirv.h" #include "errors.h" #include "shaderobj.h" +#include "mtypes.h" #include "compiler/nir/nir.h" #include "compiler/spirv/nir_spirv.h" @@ -172,6 +173,13 @@ _mesa_spirv_link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) prog->_LinkedShaders[shader_type] = linked; prog->data->linked_stages |= 1 << shader_type; } + + int last_vert_stage = + util_last_bit(prog->data->linked_stages & + ((1 << (MESA_SHADER_GEOMETRY + 1)) - 1)); + + if (last_vert_stage) + prog->last_vert_prog = prog->_LinkedShaders[last_vert_stage - 1]->Program; } nir_shader * @@ -205,6 +213,7 @@ _mesa_spirv_to_nir(struct gl_context *ctx, } const struct spirv_to_nir_options spirv_options = { + .lower_workgroup_access_to_offsets = true, .caps = ctx->Const.SpirVCapabilities }; @@ -229,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; }