Skip to content

Commit

Permalink
[SPIR-V] Fix the fragment shader output type
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Jul 9, 2024
1 parent 33a8736 commit b5ea5f2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Sources/backends/spirv.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ static uint32_t spirv_uint_type;
static uint32_t spirv_float2_type;
static uint32_t spirv_float3_type;
static uint32_t spirv_float4_type;
static uint32_t spirv_float4_pointer_output_type;

typedef struct complex_type {
type_id type;
Expand Down Expand Up @@ -400,6 +401,8 @@ static void write_base_types(instructions_buffer *constants, type_id vertex_inpu
spirv_float4_type = convert_type_to_spirv_index(float4_id);
write_type_vector_preallocated(constants, spirv_float_type, 4, spirv_float4_type);

spirv_float4_pointer_output_type = write_type_pointer(constants, STORAGE_CLASS_OUTPUT, spirv_float4_type);

spirv_uint_type = write_type_int(constants, 32, false);
spirv_int_type = write_type_int(constants, 32, true);

Expand Down Expand Up @@ -984,7 +987,7 @@ static void spirv_export_fragment(char *directory, function *main) {

write_base_types(&constants, NO_TYPE);

write_op_variable_with_result(&instructions, spirv_float4_type, output_var, STORAGE_CLASS_OUTPUT);
write_op_variable_with_result(&instructions, spirv_float4_pointer_output_type, output_var, STORAGE_CLASS_OUTPUT);

write_functions(&instructions, main, entry_point, SHADER_STAGE_FRAGMENT, pixel_input, input_var, NO_TYPE, output_var);

Expand Down

0 comments on commit b5ea5f2

Please sign in to comment.