be4cb17a14
Add to suite of MSL tests and references any existing GLSL tests that successfully convert GLSL->SPIRV->MSL and compile as MSL. test_shaders_helper() ignores hidden files that start with '.', to avoid accidentally finding hidden OSX files such as .DS_Store. Use xcrun to compile MSL shaders instead of hard-coded path to Metal compiler. Wrap calls to xcrun in exception handling to ignore if Xcode not installed. For MSL tests, move call to validate_shader_msl() to after call to regression_check() to allow a converted MSL shader to be saved for manual review even if it doesn't successfully compile as MSL.
24 lines
460 B
Plaintext
24 lines
460 B
Plaintext
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
|
|
|
struct SSBO
|
|
{
|
|
float4 data;
|
|
int index;
|
|
};
|
|
|
|
kernel void main0(device SSBO& _13 [[buffer(0)]])
|
|
{
|
|
float4 d = _13.data;
|
|
_13.data = float4(d.x, d.yz + float2(10.0), d.w);
|
|
_13.data = (d + d) + d;
|
|
_13.data = (d.yz + float2(10.0)).xxyy;
|
|
float t = (d.yz + float2(10.0)).y;
|
|
_13.data = float4(t);
|
|
t = (d.zw + float2(10.0))[_13.index];
|
|
_13.data = float4(t);
|
|
}
|
|
|