zink: add spirv builder util functions for emitting xfb decorations
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 1 Jun 2020 18:55:38 +0000 (14:55 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 17 Jun 2020 20:42:01 +0000 (20:42 +0000)
based on patches originally written by Dave Airlie <airlied@redhat.com>

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

src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c
src/gallium/drivers/zink/nir_to_spirv/spirv_builder.h

index bc5d08091b1733b72cc17d4e606887f07c2ef4e6..4f4b790cddc0f90ee5147730aa30619c7af87703 100644 (file)
@@ -224,6 +224,30 @@ spirv_builder_emit_array_stride(struct spirv_builder *b, SpvId target,
    emit_decoration(b, target, SpvDecorationArrayStride, args, ARRAY_SIZE(args));
 }
 
+void
+spirv_builder_emit_offset(struct spirv_builder *b, SpvId target,
+                          uint32_t offset)
+{
+   uint32_t args[] = { offset };
+   emit_decoration(b, target, SpvDecorationOffset, args, ARRAY_SIZE(args));
+}
+
+void
+spirv_builder_emit_xfb_buffer(struct spirv_builder *b, SpvId target,
+                              uint32_t buffer)
+{
+   uint32_t args[] = { buffer };
+   emit_decoration(b, target, SpvDecorationXfbBuffer, args, ARRAY_SIZE(args));
+}
+
+void
+spirv_builder_emit_xfb_stride(struct spirv_builder *b, SpvId target,
+                              uint32_t stride)
+{
+   uint32_t args[] = { stride };
+   emit_decoration(b, target, SpvDecorationXfbStride, args, ARRAY_SIZE(args));
+}
+
 void
 spirv_builder_emit_index(struct spirv_builder *b, SpvId target, int index)
 {
index 9d29699127c345c58b83a4c9c414db130060d67a..d13426a637ac7b3c70f0256960afcb8d786c4ca4 100644 (file)
@@ -108,6 +108,18 @@ void
 spirv_builder_emit_array_stride(struct spirv_builder *b, SpvId target,
                                 uint32_t stride);
 
+void
+spirv_builder_emit_offset(struct spirv_builder *b, SpvId target,
+                          uint32_t offset);
+
+void
+spirv_builder_emit_xfb_buffer(struct spirv_builder *b, SpvId target,
+                              uint32_t buffer);
+
+void
+spirv_builder_emit_xfb_stride(struct spirv_builder *b, SpvId target,
+                              uint32_t stride);
+
 void
 spirv_builder_emit_member_offset(struct spirv_builder *b, SpvId target,
                                  uint32_t member, uint32_t offset);