Closed bejado closed 1 week ago
This patch fixes it, but is probably incomplete.
diff --git a/spirv_msl.cpp b/spirv_msl.cpp
index e38959d6..4b1d7fdb 100644
--- a/spirv_msl.cpp
+++ b/spirv_msl.cpp
@@ -11898,7 +11898,7 @@ string CompilerMSL::to_function_args(const TextureFunctionArguments &args, bool
}
else
{
- farg_str += ", level(" + to_expression(lod) + ")";
+ farg_str += ", level(" + to_unpacked_expression(lod) + ")";
}
}
else if (args.base.is_fetch && !lod && (imgtype.image.dim != Dim1D || msl_options.texture_1D_as_2D) &&
You will need to open this in https://github.com/KhronosGroup/SPIRV-Cross. Even though it is a tool that works with SPIR-V, spirv-cross is not part of spirv-tools.
Whoops, my mistake thank you!
For reference: https://github.com/KhronosGroup/SPIRV-Cross/issues/2416
When cross-compiling to MSL via spirv-cross, the
float myLod[6]
member in theMaterialParameters
struct is converted from afloat[6]
to afloat4[6]
, but accessed without adding a required.x
suffix. As a result, the Metal compiler fails due to mismatched types.Normally the
.x
suffix is added, but there appears to be a bug when using it as an argument totextureLod
.See the attached input.frag.txt.
Repro steps:
The intermediate SPIR-V looks correct:
spirv-cross version: