C:/Users/nresnikoff/A.metal:53:28: error: use of undeclared identifier '_42'; did you mean '_47'?
_66 = texTable[_42].sample(mySampler, float2(0.0), level(0.0)).x;
^~~
_47
C:/Users/nresnikoff/A.metal:26:10: note: '_47' declared here
bool _47;
^
1 error generated.
This is pretty hairy, yes ... The OpImage is loaded once inside the first loop construct, and reused later. We have to propagate the implied usage of the _42 index somehow.
Using latest release of dxc & spirv-cross, I'm seeing an out-of-scope variable reference in the metal source.
hlsl:
Command lines:
output of metal.exe:
spirv source: A.txt
generated metal source: A.metal.txt