Mesa (master): zink: add struct type support for ntv

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Dec 17 19:21:51 UTC 2020


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu Dec 17 11:12:49 2020 -0500

zink: add struct type support for ntv

also interface types since they're the same

Erik Faye-Lund <erik.faye-lund at collabora.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8142>

---

 src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

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 bfa055268a4..100fca04696 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
@@ -246,6 +246,17 @@ get_glsl_type(struct ntv_context *ctx, const struct glsl_type *type)
          spirv_builder_emit_array_stride(&ctx->builder, ret, stride);
       return ret;
    }
+   if (glsl_type_is_struct_or_ifc(type)) {
+      SpvId types[glsl_get_length(type)];
+      for (unsigned i = 0; i < glsl_get_length(type); i++)
+         types[i] = get_glsl_type(ctx, glsl_get_struct_field(type, i));
+      SpvId ret = spirv_builder_type_struct(&ctx->builder,
+                                           types,
+                                           glsl_get_length(type));
+      for (unsigned i = 0; i < glsl_get_length(type); i++)
+         spirv_builder_emit_member_offset(&ctx->builder, ret, i, glsl_get_struct_field_offset(type, i));
+      return ret;
+   }
 
    if (glsl_type_is_matrix(type))
       return spirv_builder_type_matrix(&ctx->builder,



More information about the mesa-commit mailing list