[Mesa-dev] [PATCH 19/22] i965: Update TexturesUsed after linking the shaders

Alejandro Piñeiro apinheiro at igalia.com
Tue Apr 17 14:36:56 UTC 2018


From: Neil Roberts <nroberts at igalia.com>

Otherwise if the shader is SPIR-V then SamplerUsed won’t have been
initialised yet so it will end up thinking no textures are used. This
was causing a crash later on if nothing causes it to regenerate
TexturesUsed before the next render.
---
 src/mesa/drivers/dri/i965/brw_link.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index 48c06ce629f..7d89ccd7d14 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -245,7 +245,6 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
       _mesa_copy_linked_program_data(shProg, shader);
 
       prog->ShadowSamplers = shader->shadow_samplers;
-      _mesa_update_shader_textures_used(shProg, prog);
 
       bool debug_enabled =
          (INTEL_DEBUG & intel_debug_flag_for_shader_stage(shader->Stage));
@@ -299,6 +298,9 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
          continue;
 
       struct gl_program *prog = shader->Program;
+
+      _mesa_update_shader_textures_used(shProg, prog);
+
       brw_shader_gather_info(prog->nir, prog);
 
       NIR_PASS_V(prog->nir, nir_lower_samplers, shProg);
-- 
2.14.1



More information about the mesa-dev mailing list