[Mesa-dev] [PATCH 10/22] anv/nir: Use nir_variable's type if interface_type is null

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


From: Eduardo Lima Mitev <elima at igalia.com>

Previous patch 'spirv: Get rid of vtn_variable_mode_image/sampler'
made possible that interface_type of image/sampler nir_variable may be
null. This patch accounts for it and make use of the type of the
variable instead of the interface_type.

This prevents a number of crash regressions in Vulkan tests.

Signed-off-by: Eduardo Lima <elima at igalia.com>
Signed-off-by: Neil Roberts <nroberts at igalia.com>
---
 src/intel/vulkan/anv_nir_apply_pipeline_layout.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
index d5a08f712f1..25e892a676d 100644
--- a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
+++ b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
@@ -427,10 +427,13 @@ anv_nir_apply_pipeline_layout(struct anv_pipeline *pipeline,
    }
 
    nir_foreach_variable(var, &shader->uniforms) {
-      if (!glsl_type_is_image(var->interface_type))
+      const struct glsl_type *glsl_type = (var->interface_type ?
+                                           var->interface_type :
+                                           glsl_without_array(var->type));
+      if (!glsl_type_is_image(glsl_type))
          continue;
 
-      enum glsl_sampler_dim dim = glsl_get_sampler_dim(var->interface_type);
+      enum glsl_sampler_dim dim = glsl_get_sampler_dim(glsl_type);
 
       const uint32_t set = var->data.descriptor_set;
       const uint32_t binding = var->data.binding;
-- 
2.14.1



More information about the mesa-dev mailing list