Skip to content

Commit

Permalink
MSL: Treat pointer to vector as scalar type when bitcasting
Browse files Browse the repository at this point in the history
Otherwise, they will be misregarded as vectors and can be used in
as_type, which does not support pointer type as destination.
  • Loading branch information
dboyan committed Mar 3, 2025
1 parent 2c32b6b commit 03163c6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spirv_msl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10008,7 +10008,7 @@ void CompilerMSL::emit_instruction(const Instruction &instruction)
{
string op;

if (type.vecsize == 1 && input_type.vecsize == 1)
if ((type.vecsize == 1 || type.pointer) && (input_type.vecsize == 1 || input_type.pointer))
op = join("reinterpret_cast<", type_to_glsl(type), ">(", to_unpacked_expression(ops[2]), ")");
else if (input_type.vecsize == 2)
op = join("reinterpret_cast<", type_to_glsl(type), ">(as_type<ulong>(", to_unpacked_expression(ops[2]), "))");
Expand Down

0 comments on commit 03163c6

Please sign in to comment.