Mesa (master): zink: process ubos with location values set as long as they're actually ubos

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 19 14:23:36 UTC 2021


Module: Mesa
Branch: master
Commit: 5ebfb9cd606fbf249ef7a734be04bde342d0d1de
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5ebfb9cd606fbf249ef7a734be04bde342d0d1de

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Aug 14 17:37:41 2020 -0400

zink: process ubos with location values set as long as they're actually ubos

Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8514>

---

 src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 2 +-
 src/gallium/drivers/zink/zink_compiler.c             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
index 0ec73976847..0d97a6c614e 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
+++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
@@ -669,7 +669,7 @@ emit_ubo(struct ntv_context *ctx, struct nir_variable *var)
    /* variables accessed inside a uniform block will get merged into a big
     * memory blob and accessed by offset
     */
-   if (var->data.location && !is_ubo_array)
+   if (var->data.location && !is_ubo_array && var->type != var->interface_type)
       return;
 
    uint32_t size = glsl_count_attribute_slots(var->interface_type, false);
diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c
index 58d9bdd8d9d..cc2e178de92 100644
--- a/src/gallium/drivers/zink/zink_compiler.c
+++ b/src/gallium/drivers/zink/zink_compiler.c
@@ -466,7 +466,7 @@ zink_shader_create(struct zink_screen *screen, struct nir_shader *nir,
          if (var->data.mode == nir_var_mem_ubo) {
             /* ignore variables being accessed if they aren't the base of the UBO */
             bool ubo_array = glsl_type_is_array(var->type) && glsl_type_is_interface(glsl_without_array(var->type));
-            if (var->data.location && !ubo_array)
+            if (var->data.location && !ubo_array && var->type != var->interface_type)
                continue;
             var->data.binding = cur_ubo;
             /* if this is a ubo array, create a binding point for each array member:



More information about the mesa-commit mailing list