| 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 UBO |
| 9 |
{ |
| 10 |
float4 v; |
| 11 |
}; |
| 12 |
|
| 13 |
struct spvDescriptorSetBuffer0 |
| 14 |
{ |
| 15 |
array<texture2d<float>, 10000> uSamplers [[id(0)]]; |
| 16 |
array<sampler, 10000> uSamplersSmplr [[id(10000)]]; |
| 17 |
}; |
| 18 |
|
| 19 |
struct spvDescriptorSetBuffer1 |
| 20 |
{ |
| 21 |
constant UBO* vs [[id(0)]][10000]; |
| 22 |
}; |
| 23 |
|
| 24 |
struct spvDescriptorSetBuffer2 |
| 25 |
{ |
| 26 |
texture2d<float> uSampler [[id(0)]]; |
| 27 |
sampler uSamplerSmplr [[id(1)]]; |
| 28 |
}; |
| 29 |
|
| 30 |
struct main0_out |
| 31 |
{ |
| 32 |
float4 FragColor [[color(0)]]; |
| 33 |
}; |
| 34 |
|
| 35 |
struct main0_in |
| 36 |
{ |
| 37 |
float2 vUV [[user(locn0)]]; |
| 38 |
}; |
| 39 |
|
| 40 |
static inline __attribute__((always_inline)) |
| 41 |
float4 samp_array(thread const array<texture2d<float>, 10000> uSamplers, thread const array<sampler, 10000> uSamplersSmplr, thread float2& vUV, constant UBO* const device (&vs)[10000]) |
| 42 |
{ |
| 43 |
return uSamplers[9999].sample(uSamplersSmplr[9999], vUV) + vs[5000]->v; |
| 44 |
} |
| 45 |
|
| 46 |
static inline __attribute__((always_inline)) |
| 47 |
float4 samp_single(thread float2& vUV, thread texture2d<float> uSampler, thread const sampler uSamplerSmplr) |
| 48 |
{ |
| 49 |
return uSampler.sample(uSamplerSmplr, vUV); |
| 50 |
} |
| 51 |
|
| 52 |
fragment main0_out main0(main0_in in [[stage_in]], const device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], const device spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], constant spvDescriptorSetBuffer2& spvDescriptorSet2 [[buffer(2)]]) |
| 53 |
{ |
| 54 |
main0_out out = {}; |
| 55 |
out.FragColor = samp_array(spvDescriptorSet0.uSamplers, spvDescriptorSet0.uSamplersSmplr, in.vUV, spvDescriptorSet1.vs) + samp_single(in.vUV, spvDescriptorSet2.uSampler, spvDescriptorSet2.uSamplerSmplr); |
| 56 |
return out; |
| 57 |
} |
| 58 |
|