From 4e689f873b29406c8e7315770d040a1f600944ab Mon Sep 17 00:00:00 2001 From: Robert Konrad Date: Thu, 4 Apr 2024 22:24:21 +0200 Subject: [PATCH] [SPIR-V] Fix vertex shader return types --- Sources/backends/spirv.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/Sources/backends/spirv.c b/Sources/backends/spirv.c index 24d3e27..100fcb9 100644 --- a/Sources/backends/spirv.c +++ b/Sources/backends/spirv.c @@ -736,37 +736,34 @@ static void write_function(instructions_buffer *instructions, function *f, shade if (m.type.type == float2_id) { int indices = (int)i; - uint32_t load_pointer = - write_op_access_chain(instructions, convert_pointer_type_to_spirv_index(spirv_float2_type, STORAGE_CLASS_FUNCTION), - convert_kong_index_to_spirv_index(o->op_return.var.index), &indices, 1); + uint32_t load_pointer = write_op_access_chain(instructions, convert_pointer_type_to_spirv_index(float2_id, STORAGE_CLASS_FUNCTION), + convert_kong_index_to_spirv_index(o->op_return.var.index), &indices, 1); uint32_t value = write_op_load(instructions, spirv_float2_type, load_pointer); - uint32_t store_pointer = write_op_access_chain( - instructions, convert_pointer_type_to_spirv_index(spirv_float2_type, STORAGE_CLASS_OUTPUT), output_var, &indices, 1); + uint32_t store_pointer = + write_op_access_chain(instructions, convert_pointer_type_to_spirv_index(float2_id, STORAGE_CLASS_OUTPUT), output_var, &indices, 1); write_op_store(instructions, store_pointer, value); } else if (m.type.type == float3_id) { int indices = (int)i; - uint32_t load_pointer = - write_op_access_chain(instructions, convert_pointer_type_to_spirv_index(spirv_float3_type, STORAGE_CLASS_FUNCTION), - convert_kong_index_to_spirv_index(o->op_return.var.index), &indices, 1); + uint32_t load_pointer = write_op_access_chain(instructions, convert_pointer_type_to_spirv_index(float3_id, STORAGE_CLASS_FUNCTION), + convert_kong_index_to_spirv_index(o->op_return.var.index), &indices, 1); uint32_t value = write_op_load(instructions, spirv_float3_type, load_pointer); - uint32_t store_pointer = write_op_access_chain( - instructions, convert_pointer_type_to_spirv_index(spirv_float3_type, STORAGE_CLASS_OUTPUT), output_var, &indices, 1); + uint32_t store_pointer = + write_op_access_chain(instructions, convert_pointer_type_to_spirv_index(float3_id, STORAGE_CLASS_OUTPUT), output_var, &indices, 1); write_op_store(instructions, store_pointer, value); } else if (m.type.type == float4_id) { int indices = (int)i; - uint32_t load_pointer = - write_op_access_chain(instructions, convert_pointer_type_to_spirv_index(spirv_float4_type, STORAGE_CLASS_FUNCTION), - convert_kong_index_to_spirv_index(o->op_return.var.index), &indices, 1); + uint32_t load_pointer = write_op_access_chain(instructions, convert_pointer_type_to_spirv_index(float4_id, STORAGE_CLASS_FUNCTION), + convert_kong_index_to_spirv_index(o->op_return.var.index), &indices, 1); uint32_t value = write_op_load(instructions, spirv_float4_type, load_pointer); - uint32_t store_pointer = write_op_access_chain( - instructions, convert_pointer_type_to_spirv_index(spirv_float4_type, STORAGE_CLASS_OUTPUT), output_var, &indices, 1); + uint32_t store_pointer = + write_op_access_chain(instructions, convert_pointer_type_to_spirv_index(float4_id, STORAGE_CLASS_OUTPUT), output_var, &indices, 1); write_op_store(instructions, store_pointer, value); } else {