| 1 |
#pragma clang diagnostic ignored "-Wmissing-prototypes" |
| 2 |
|
| 3 |
#include <metal_stdlib> |
| 4 |
#include <simd/simd.h> |
| 5 |
|
| 6 |
using namespace metal; |
| 7 |
|
| 8 |
struct SSBO |
| 9 |
{ |
| 10 |
float4 ssbo; |
| 11 |
}; |
| 12 |
|
| 13 |
struct SSBOs |
| 14 |
{ |
| 15 |
float4 ssbo; |
| 16 |
}; |
| 17 |
|
| 18 |
struct Push |
| 19 |
{ |
| 20 |
float4 push; |
| 21 |
}; |
| 22 |
|
| 23 |
struct UBO |
| 24 |
{ |
| 25 |
float4 ubo; |
| 26 |
}; |
| 27 |
|
| 28 |
struct UBOs |
| 29 |
{ |
| 30 |
float4 ubo; |
| 31 |
}; |
| 32 |
|
| 33 |
struct spvDescriptorSetBuffer0 |
| 34 |
{ |
| 35 |
texture2d<float> uTexture [[id(0)]]; |
| 36 |
sampler uTextureSmplr [[id(1)]]; |
| 37 |
array<texture2d<float>, 2> uTextures [[id(2)]]; |
| 38 |
array<sampler, 2> uTexturesSmplr [[id(4)]]; |
| 39 |
constant UBO* v_90 [[id(6)]]; |
| 40 |
}; |
| 41 |
|
| 42 |
struct spvDescriptorSetBuffer1 |
| 43 |
{ |
| 44 |
array<texture2d<float>, 4> uTexture2 [[id(0)]]; |
| 45 |
array<sampler, 2> uSampler [[id(4)]]; |
| 46 |
device SSBO* v_60 [[id(6)]]; |
| 47 |
const device SSBOs* ssbos [[id(7)]][2]; |
| 48 |
}; |
| 49 |
|
| 50 |
struct spvDescriptorSetBuffer2 |
| 51 |
{ |
| 52 |
constant UBOs* ubos [[id(0)]][4]; |
| 53 |
}; |
| 54 |
|
| 55 |
struct main0_out |
| 56 |
{ |
| 57 |
float4 FragColor [[color(0)]]; |
| 58 |
}; |
| 59 |
|
| 60 |
struct main0_in |
| 61 |
{ |
| 62 |
float2 vUV [[user(locn0)]]; |
| 63 |
}; |
| 64 |
|
| 65 |
static inline __attribute__((always_inline)) |
| 66 |
float4 sample_in_function2(thread texture2d<float> uTexture, thread const sampler uTextureSmplr, thread float2& vUV, thread const array<texture2d<float>, 4> uTexture2, thread const array<sampler, 2> uSampler, thread const array<texture2d<float>, 2> uTextures, thread const array<sampler, 2> uTexturesSmplr, device SSBO& v_60, const device SSBOs* constant (&ssbos)[2], constant Push& registers) |
| 67 |
{ |
| 68 |
float4 ret = uTexture.sample(uTextureSmplr, vUV); |
| 69 |
ret += uTexture2[2].sample(uSampler[1], vUV); |
| 70 |
ret += uTextures[1].sample(uTexturesSmplr[1], vUV); |
| 71 |
ret += v_60.ssbo; |
| 72 |
ret += ssbos[0]->ssbo; |
| 73 |
ret += registers.push; |
| 74 |
return ret; |
| 75 |
} |
| 76 |
|
| 77 |
static inline __attribute__((always_inline)) |
| 78 |
float4 sample_in_function(thread texture2d<float> uTexture, thread const sampler uTextureSmplr, thread float2& vUV, thread const array<texture2d<float>, 4> uTexture2, thread const array<sampler, 2> uSampler, thread const array<texture2d<float>, 2> uTextures, thread const array<sampler, 2> uTexturesSmplr, device SSBO& v_60, const device SSBOs* constant (&ssbos)[2], constant Push& registers, constant UBO& v_90, constant UBOs* constant (&ubos)[4]) |
| 79 |
{ |
| 80 |
float4 ret = sample_in_function2(uTexture, uTextureSmplr, vUV, uTexture2, uSampler, uTextures, uTexturesSmplr, v_60, ssbos, registers); |
| 81 |
ret += v_90.ubo; |
| 82 |
ret += ubos[0]->ubo; |
| 83 |
return ret; |
| 84 |
} |
| 85 |
|
| 86 |
fragment main0_out main0(main0_in in [[stage_in]], constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], constant spvDescriptorSetBuffer2& spvDescriptorSet2 [[buffer(2)]], constant Push& registers [[buffer(3)]]) |
| 87 |
{ |
| 88 |
main0_out out = {}; |
| 89 |
out.FragColor = sample_in_function(spvDescriptorSet0.uTexture, spvDescriptorSet0.uTextureSmplr, in.vUV, spvDescriptorSet1.uTexture2, spvDescriptorSet1.uSampler, spvDescriptorSet0.uTextures, spvDescriptorSet0.uTexturesSmplr, (*spvDescriptorSet1.v_60), spvDescriptorSet1.ssbos, registers, (*spvDescriptorSet0.v_90), spvDescriptorSet2.ubos); |
| 90 |
out.FragColor += (*spvDescriptorSet0.v_90).ubo; |
| 91 |
out.FragColor += (*spvDescriptorSet1.v_60).ssbo; |
| 92 |
out.FragColor += spvDescriptorSet2.ubos[1]->ubo; |
| 93 |
out.FragColor += registers.push; |
| 94 |
return out; |
| 95 |
} |
| 96 |
|