zink: emit blend-target index
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Tue, 4 Feb 2020 10:12:25 +0000 (11:12 +0100)
committerMarge Bot <eric+marge@anholt.net>
Mon, 10 Feb 2020 11:01:47 +0000 (11:01 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3689>

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

index 455bb56..fa2c7b0 100644 (file)
@@ -331,6 +331,7 @@ emit_output(struct ntv_context *ctx, struct nir_variable *var)
          switch (var->data.location) {
          case FRAG_RESULT_COLOR:
             spirv_builder_emit_location(&ctx->builder, var_id, 0);
+            spirv_builder_emit_index(&ctx->builder, var_id, var->data.index);
             break;
 
          case FRAG_RESULT_DEPTH:
index bdb8b8a..9fb4476 100644 (file)
@@ -222,6 +222,13 @@ spirv_builder_emit_array_stride(struct spirv_builder *b, SpvId target,
    emit_decoration(b, target, SpvDecorationArrayStride, args, ARRAY_SIZE(args));
 }
 
+void
+spirv_builder_emit_index(struct spirv_builder *b, SpvId target, int index)
+{
+   uint32_t args[] = { index };
+   emit_decoration(b, target, SpvDecorationIndex, args, ARRAY_SIZE(args));
+}
+
 static void
 emit_member_decoration(struct spirv_builder *b, SpvId target, uint32_t member,
                        SpvDecoration decoration, const uint32_t extra_operands[],
index bd19e74..d0843b8 100644 (file)
@@ -94,6 +94,9 @@ spirv_builder_emit_builtin(struct spirv_builder *b, SpvId target,
                            SpvBuiltIn builtin);
 
 void
+spirv_builder_emit_index(struct spirv_builder *b, SpvId target, int index);
+
+void
 spirv_builder_emit_descriptor_set(struct spirv_builder *b, SpvId target,
                                   uint32_t descriptor_set);