From e365f83740f1faa0e4d022da7b9aea9ae6dacbda Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Tue, 4 Feb 2020 11:12:25 +0100 Subject: [PATCH] zink: emit blend-target index Part-of: --- src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 1 + src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c | 7 +++++++ src/gallium/drivers/zink/nir_to_spirv/spirv_builder.h | 3 +++ 3 files 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 455bb562a47..fa2c7b0bf94 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 @@ -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: diff --git a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c index bdb8b8a1179..9fb447611f3 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c +++ b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c @@ -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[], diff --git a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.h b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.h index bd19e74822c..d0843b8ff79 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.h +++ b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.h @@ -93,6 +93,9 @@ void 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); -- 2.30.2