On 12/05/18 19:40, Alejandro Piñeiro wrote:
From: Eduardo Lima Mitev <el...@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 <el...@igalia.com>
Signed-off-by: Neil Roberts <nrobe...@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));

glsl_get_sampler_dim() contains the following:

   assert(glsl_type_is_sampler(type) || glsl_type_is_image(type));

Which leads me to believe the code above should just be:

const struct glsl_type *glsl_type = glsl_without_array(var->type);

If you agree please squash this patch into the previous patch where you can keep my r-b.

+      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;

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to