From a6abfa66760d21304c9acf23e4e81c71115e7b34 Mon Sep 17 00:00:00 2001 From: Robert Konrad Date: Sun, 21 Jul 2024 18:08:26 +0200 Subject: [PATCH] [SPIR-V] Decorate the fragment output --- Sources/backends/spirv.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sources/backends/spirv.c b/Sources/backends/spirv.c index 008e161..b28b3f0 100644 --- a/Sources/backends/spirv.c +++ b/Sources/backends/spirv.c @@ -527,6 +527,11 @@ static void write_vertex_input_decorations(instructions_buffer *instructions, ui } } +static void write_fragment_output_decorations(instructions_buffer *instructions, uint32_t output) { + uint32_t operands[] = {output, (uint32_t)DECORATION_LOCATION, 0}; + write_instruction(instructions, WORD_COUNT(operands), SPIRV_OPCODE_DECORATE, operands); +} + static uint32_t write_op_function_preallocated(instructions_buffer *instructions, uint32_t result_type, function_control control, uint32_t function_type, uint32_t result) { uint32_t operands[] = {result_type, result, (uint32_t)control, function_type}; @@ -1050,6 +1055,8 @@ static void spirv_export_fragment(char *directory, function *main) { write_op_entry_point(&decorations, EXECUTION_MODEL_FRAGMENT, entry_point, "main", interfaces, sizeof(interfaces) / 4); write_op_execution_mode(&decorations, entry_point, EXECUTION_MODE_ORIGIN_UPPER_LEFT); + write_fragment_output_decorations(&decorations, output_var); + /*uint32_t output_struct = allocate_index(); write_vertex_output_decorations(&decorations, output_struct);