SPIRV-Cross/reference/opt/shaders-msl/asm/comp/undefined-spec-constant-composite.asm.comp
Chip Davis 5547b25afe Interleave undef values with constants and types.
Undef values may be of struct type and may be used in constants.
Therefore, they must be interleaved with constants and types.

Fixes the rest of the Vulkan CTS test
`dEQP-VK.spirv_assembly.instruction.compute.opundef.undefined_spec_constant_composite`.

(Please excuse the churn in the reference output; it's an inevitable
result of this change.)
2022-11-20 02:08:37 -08:00

32 lines
600 B
Plaintext

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct _21
{
int _m0;
int _m1;
};
struct _5
{
int _m0[10];
};
struct _7
{
int _m0[10];
};
constant int _29 = {};
constant int _9_tmp [[function_constant(0)]];
constant int _9 = is_function_constant_defined(_9_tmp) ? _9_tmp : 0;
constant _21 _30 = _21{ _9, _29 };
kernel void main0(device _5& _6 [[buffer(0)]], device _7& _8 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
{
_6._m0[gl_GlobalInvocationID.x] = (_8._m0[gl_GlobalInvocationID.x] + _30._m0) + (_21{ _29, 200 })._m1;
}