From: Timothy Arceri Date: Fri, 26 Jun 2020 05:28:51 +0000 (+1000) Subject: st/glsl_to_nir: disable st_nir_lower_builtin() when packing supported X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=64a2500a6975f7ea42c93f5c20dc295e99f3b612;p=mesa.git st/glsl_to_nir: disable st_nir_lower_builtin() when packing supported There is no need to lower builtins when uniform packing is supported by the driver. Lowering is only required by other drivers because we prepack builtin uniforms. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3140 CC: Reviewed-by: Marek Olšák Reviewed-by: Eric Anholt Part-of: --- diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index fc3236861e2..78753f781af 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -455,10 +455,7 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog, for (unsigned int i = 0; i < var->num_state_slots; i++) { unsigned comps; if (glsl_type_is_struct_or_ifc(type)) { - /* Builtin struct require specical handling for now we just - * make all members vec4. See st_nir_lower_builtin. - */ - comps = 4; + comps = _mesa_program_state_value_size(slots[i].tokens); } else { comps = glsl_get_vector_elements(type); } @@ -490,9 +487,11 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog, st_set_prog_affected_state_flags(prog); /* None of the builtins being lowered here can be produced by SPIR-V. See - * _mesa_builtin_uniform_desc. + * _mesa_builtin_uniform_desc. Also drivers that support packed uniform + * storage don't need to lower builtins. */ - if (!shader_program->data->spirv) + if (!shader_program->data->spirv && + !st->ctx->Const.PackedDriverUniformStorage) NIR_PASS_V(nir, st_nir_lower_builtin); NIR_PASS_V(nir, gl_nir_lower_atomics, shader_program, true);