| 1 |
#pragma clang diagnostic ignored "-Wunused-variable" |
| 2 |
|
| 3 |
#include <metal_stdlib> |
| 4 |
#include <simd/simd.h> |
| 5 |
#include <metal_atomic> |
| 6 |
|
| 7 |
using namespace metal; |
| 8 |
|
| 9 |
struct type_StructuredBuffer_v4float |
| 10 |
{ |
| 11 |
float4 _m0[1]; |
| 12 |
}; |
| 13 |
|
| 14 |
struct type_Globals |
| 15 |
{ |
| 16 |
uint2 ShadowTileListGroupSize; |
| 17 |
}; |
| 18 |
|
| 19 |
struct spvDescriptorSetBuffer0 |
| 20 |
{ |
| 21 |
const device type_StructuredBuffer_v4float* CulledObjectBoxBounds [[id(0)]]; |
| 22 |
constant type_Globals* _Globals [[id(1)]]; |
| 23 |
texture2d<uint> RWShadowTileNumCulledObjects [[id(2)]]; |
| 24 |
device atomic_uint* RWShadowTileNumCulledObjects_atomic [[id(3)]]; |
| 25 |
}; |
| 26 |
|
| 27 |
constant float3 _70 = {}; |
| 28 |
|
| 29 |
struct main0_out |
| 30 |
{ |
| 31 |
float4 out_var_SV_Target0 [[color(0)]]; |
| 32 |
}; |
| 33 |
|
| 34 |
struct main0_in |
| 35 |
{ |
| 36 |
uint in_var_TEXCOORD0 [[user(locn0)]]; |
| 37 |
}; |
| 38 |
|
| 39 |
fragment main0_out main0(main0_in in [[stage_in]], constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], float4 gl_FragCoord [[position]]) |
| 40 |
{ |
| 41 |
main0_out out = {}; |
| 42 |
uint2 _77 = uint2(gl_FragCoord.xy); |
| 43 |
uint _78 = _77.y; |
| 44 |
uint _83 = _77.x; |
| 45 |
float2 _91 = float2(float(_83), float(((*spvDescriptorSet0._Globals).ShadowTileListGroupSize.y - 1u) - _78)); |
| 46 |
float2 _93 = float2((*spvDescriptorSet0._Globals).ShadowTileListGroupSize); |
| 47 |
float2 _96 = ((_91 / _93) * float2(2.0)) - float2(1.0); |
| 48 |
float2 _100 = (((_91 + float2(1.0)) / _93) * float2(2.0)) - float2(1.0); |
| 49 |
float3 _102 = float3(_100.x, _100.y, _70.z); |
| 50 |
_102.z = 1.0; |
| 51 |
uint _103 = in.in_var_TEXCOORD0 * 5u; |
| 52 |
uint _107 = _103 + 1u; |
| 53 |
if (all((*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_107].xy > _96.xy) && all((*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103].xyz < _102)) |
| 54 |
{ |
| 55 |
float3 _121 = float3(0.5) * ((*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103].xyz + (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_107].xyz); |
| 56 |
float _122 = _96.x; |
| 57 |
float _123 = _96.y; |
| 58 |
float _126 = _100.x; |
| 59 |
float _129 = _100.y; |
| 60 |
float3 _166 = float3(_122, _123, -1000.0) - _121; |
| 61 |
float3 _170 = float3(dot(_166, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 2u].xyz), dot(_166, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 3u].xyz), dot(_166, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 4u].xyz)); |
| 62 |
float3 _189 = float3(_126, _123, -1000.0) - _121; |
| 63 |
float3 _193 = float3(dot(_189, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 2u].xyz), dot(_189, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 3u].xyz), dot(_189, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 4u].xyz)); |
| 64 |
float3 _205 = float3(_122, _129, -1000.0) - _121; |
| 65 |
float3 _209 = float3(dot(_205, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 2u].xyz), dot(_205, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 3u].xyz), dot(_205, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 4u].xyz)); |
| 66 |
float3 _221 = float3(_126, _129, -1000.0) - _121; |
| 67 |
float3 _225 = float3(dot(_221, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 2u].xyz), dot(_221, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 3u].xyz), dot(_221, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 4u].xyz)); |
| 68 |
float3 _237 = float3(_122, _123, 1.0) - _121; |
| 69 |
float3 _241 = float3(dot(_237, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 2u].xyz), dot(_237, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 3u].xyz), dot(_237, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 4u].xyz)); |
| 70 |
float3 _253 = float3(_126, _123, 1.0) - _121; |
| 71 |
float3 _257 = float3(dot(_253, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 2u].xyz), dot(_253, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 3u].xyz), dot(_253, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 4u].xyz)); |
| 72 |
float3 _269 = float3(_122, _129, 1.0) - _121; |
| 73 |
float3 _273 = float3(dot(_269, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 2u].xyz), dot(_269, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 3u].xyz), dot(_269, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 4u].xyz)); |
| 74 |
float3 _285 = float3(_126, _129, 1.0) - _121; |
| 75 |
float3 _289 = float3(dot(_285, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 2u].xyz), dot(_285, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 3u].xyz), dot(_285, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 4u].xyz)); |
| 76 |
if (all(fast::min(fast::min(fast::min(fast::min(fast::min(fast::min(fast::min(fast::min(float3(500000.0), _170), _193), _209), _225), _241), _257), _273), _289) < float3(1.0)) && all(fast::max(fast::max(fast::max(fast::max(fast::max(fast::max(fast::max(fast::max(float3(-500000.0), _170), _193), _209), _225), _241), _257), _273), _289) > float3(-1.0))) |
| 77 |
{ |
| 78 |
uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&spvDescriptorSet0.RWShadowTileNumCulledObjects_atomic[(_78 * (*spvDescriptorSet0._Globals).ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed); |
| 79 |
} |
| 80 |
} |
| 81 |
out.out_var_SV_Target0 = float4(0.0); |
| 82 |
return out; |
| 83 |
} |
| 84 |
|