On MacOS 10.14, I tried to convert SPIR-V to MSL and found an issue that when converting the following GLSL fragment shader, the MSL compiler gives an error:
rogram_source:24:36: error: 'ResType' does not refer to a value
for (; reverse_bits(1) < 1024; ResType _37, _37._m0 = 10u - 1u, _37._m1 = select(uint(1), uint(0), 10u >= 1u), _26 = float(_37._m0))
^
program_source:6:8: note: declared here
struct ResType
^
program_source:24:44: error: expected ')'
for (; reverse_bits(1) < 1024; ResType _37, _37._m0 = 10u - 1u, _37._m1 = select(uint(1), uint(0), 10u >= 1u), _26 = float(_37._m0))
^
Likely need to use the recent emit_uninitized_temporary for all opcodes which need to emit temporaries, which was designed to support hoisting temporaries out of continue blocks like this.
On MacOS 10.14, I tried to convert SPIR-V to MSL and found an issue that when converting the following GLSL fragment shader, the MSL compiler gives an error:
The GLSL fragment shader:
MSL obtained by SPIRV-Cross:
Versions:
Steps to reproduce:
glslangValidator -V sample.frag -o sample.spv
spirv-opt sample.spv -o sample.opt.spv -O
spirv-val sample.opt.spv
spirv-cross --msl sample.opt.spv --output result.opt.msl
This Archive.zip contains the original fragment shader, the associated optimized SPIR-V, and MSL shader.
Issue found using GraphicsFuzz.