| 1 |
#pragma clang diagnostic ignored "-Wmissing-prototypes" |
| 2 |
#pragma clang diagnostic ignored "-Wmissing-braces" |
| 3 |
|
| 4 |
#include <metal_stdlib> |
| 5 |
#include <simd/simd.h> |
| 6 |
|
| 7 |
using namespace metal; |
| 8 |
|
| 9 |
template<typename T, size_t Num> |
| 10 |
struct spvUnsafeArray |
| 11 |
{ |
| 12 |
T elements[Num ? Num : 1]; |
| 13 |
|
| 14 |
thread T& operator [] (size_t pos) thread |
| 15 |
{ |
| 16 |
return elements[pos]; |
| 17 |
} |
| 18 |
constexpr const thread T& operator [] (size_t pos) const thread |
| 19 |
{ |
| 20 |
return elements[pos]; |
| 21 |
} |
| 22 |
|
| 23 |
device T& operator [] (size_t pos) device |
| 24 |
{ |
| 25 |
return elements[pos]; |
| 26 |
} |
| 27 |
constexpr const device T& operator [] (size_t pos) const device |
| 28 |
{ |
| 29 |
return elements[pos]; |
| 30 |
} |
| 31 |
|
| 32 |
constexpr const constant T& operator [] (size_t pos) const constant |
| 33 |
{ |
| 34 |
return elements[pos]; |
| 35 |
} |
| 36 |
|
| 37 |
threadgroup T& operator [] (size_t pos) threadgroup |
| 38 |
{ |
| 39 |
return elements[pos]; |
| 40 |
} |
| 41 |
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup |
| 42 |
{ |
| 43 |
return elements[pos]; |
| 44 |
} |
| 45 |
}; |
| 46 |
|
| 47 |
struct type_ShadowDepthPass |
| 48 |
{ |
| 49 |
float PrePadding_ShadowDepthPass_LPV_0; |
| 50 |
float PrePadding_ShadowDepthPass_LPV_4; |
| 51 |
float PrePadding_ShadowDepthPass_LPV_8; |
| 52 |
float PrePadding_ShadowDepthPass_LPV_12; |
| 53 |
float PrePadding_ShadowDepthPass_LPV_16; |
| 54 |
float PrePadding_ShadowDepthPass_LPV_20; |
| 55 |
float PrePadding_ShadowDepthPass_LPV_24; |
| 56 |
float PrePadding_ShadowDepthPass_LPV_28; |
| 57 |
float PrePadding_ShadowDepthPass_LPV_32; |
| 58 |
float PrePadding_ShadowDepthPass_LPV_36; |
| 59 |
float PrePadding_ShadowDepthPass_LPV_40; |
| 60 |
float PrePadding_ShadowDepthPass_LPV_44; |
| 61 |
float PrePadding_ShadowDepthPass_LPV_48; |
| 62 |
float PrePadding_ShadowDepthPass_LPV_52; |
| 63 |
float PrePadding_ShadowDepthPass_LPV_56; |
| 64 |
float PrePadding_ShadowDepthPass_LPV_60; |
| 65 |
float PrePadding_ShadowDepthPass_LPV_64; |
| 66 |
float PrePadding_ShadowDepthPass_LPV_68; |
| 67 |
float PrePadding_ShadowDepthPass_LPV_72; |
| 68 |
float PrePadding_ShadowDepthPass_LPV_76; |
| 69 |
float PrePadding_ShadowDepthPass_LPV_80; |
| 70 |
float PrePadding_ShadowDepthPass_LPV_84; |
| 71 |
float PrePadding_ShadowDepthPass_LPV_88; |
| 72 |
float PrePadding_ShadowDepthPass_LPV_92; |
| 73 |
float PrePadding_ShadowDepthPass_LPV_96; |
| 74 |
float PrePadding_ShadowDepthPass_LPV_100; |
| 75 |
float PrePadding_ShadowDepthPass_LPV_104; |
| 76 |
float PrePadding_ShadowDepthPass_LPV_108; |
| 77 |
float PrePadding_ShadowDepthPass_LPV_112; |
| 78 |
float PrePadding_ShadowDepthPass_LPV_116; |
| 79 |
float PrePadding_ShadowDepthPass_LPV_120; |
| 80 |
float PrePadding_ShadowDepthPass_LPV_124; |
| 81 |
float PrePadding_ShadowDepthPass_LPV_128; |
| 82 |
float PrePadding_ShadowDepthPass_LPV_132; |
| 83 |
float PrePadding_ShadowDepthPass_LPV_136; |
| 84 |
float PrePadding_ShadowDepthPass_LPV_140; |
| 85 |
float PrePadding_ShadowDepthPass_LPV_144; |
| 86 |
float PrePadding_ShadowDepthPass_LPV_148; |
| 87 |
float PrePadding_ShadowDepthPass_LPV_152; |
| 88 |
float PrePadding_ShadowDepthPass_LPV_156; |
| 89 |
float PrePadding_ShadowDepthPass_LPV_160; |
| 90 |
float PrePadding_ShadowDepthPass_LPV_164; |
| 91 |
float PrePadding_ShadowDepthPass_LPV_168; |
| 92 |
float PrePadding_ShadowDepthPass_LPV_172; |
| 93 |
float PrePadding_ShadowDepthPass_LPV_176; |
| 94 |
float PrePadding_ShadowDepthPass_LPV_180; |
| 95 |
float PrePadding_ShadowDepthPass_LPV_184; |
| 96 |
float PrePadding_ShadowDepthPass_LPV_188; |
| 97 |
float PrePadding_ShadowDepthPass_LPV_192; |
| 98 |
float PrePadding_ShadowDepthPass_LPV_196; |
| 99 |
float PrePadding_ShadowDepthPass_LPV_200; |
| 100 |
float PrePadding_ShadowDepthPass_LPV_204; |
| 101 |
float PrePadding_ShadowDepthPass_LPV_208; |
| 102 |
float PrePadding_ShadowDepthPass_LPV_212; |
| 103 |
float PrePadding_ShadowDepthPass_LPV_216; |
| 104 |
float PrePadding_ShadowDepthPass_LPV_220; |
| 105 |
float PrePadding_ShadowDepthPass_LPV_224; |
| 106 |
float PrePadding_ShadowDepthPass_LPV_228; |
| 107 |
float PrePadding_ShadowDepthPass_LPV_232; |
| 108 |
float PrePadding_ShadowDepthPass_LPV_236; |
| 109 |
float PrePadding_ShadowDepthPass_LPV_240; |
| 110 |
float PrePadding_ShadowDepthPass_LPV_244; |
| 111 |
float PrePadding_ShadowDepthPass_LPV_248; |
| 112 |
float PrePadding_ShadowDepthPass_LPV_252; |
| 113 |
float PrePadding_ShadowDepthPass_LPV_256; |
| 114 |
float PrePadding_ShadowDepthPass_LPV_260; |
| 115 |
float PrePadding_ShadowDepthPass_LPV_264; |
| 116 |
float PrePadding_ShadowDepthPass_LPV_268; |
| 117 |
float4x4 ShadowDepthPass_LPV_mRsmToWorld; |
| 118 |
float4 ShadowDepthPass_LPV_mLightColour; |
| 119 |
float4 ShadowDepthPass_LPV_GeometryVolumeCaptureLightDirection; |
| 120 |
float4 ShadowDepthPass_LPV_mEyePos; |
| 121 |
packed_int3 ShadowDepthPass_LPV_mOldGridOffset; |
| 122 |
int PrePadding_ShadowDepthPass_LPV_396; |
| 123 |
packed_int3 ShadowDepthPass_LPV_mLpvGridOffset; |
| 124 |
float ShadowDepthPass_LPV_ClearMultiplier; |
| 125 |
float ShadowDepthPass_LPV_LpvScale; |
| 126 |
float ShadowDepthPass_LPV_OneOverLpvScale; |
| 127 |
float ShadowDepthPass_LPV_DirectionalOcclusionIntensity; |
| 128 |
float ShadowDepthPass_LPV_DirectionalOcclusionRadius; |
| 129 |
float ShadowDepthPass_LPV_RsmAreaIntensityMultiplier; |
| 130 |
float ShadowDepthPass_LPV_RsmPixelToTexcoordMultiplier; |
| 131 |
float ShadowDepthPass_LPV_SecondaryOcclusionStrength; |
| 132 |
float ShadowDepthPass_LPV_SecondaryBounceStrength; |
| 133 |
float ShadowDepthPass_LPV_VplInjectionBias; |
| 134 |
float ShadowDepthPass_LPV_GeometryVolumeInjectionBias; |
| 135 |
float ShadowDepthPass_LPV_EmissiveInjectionMultiplier; |
| 136 |
int ShadowDepthPass_LPV_PropagationIndex; |
| 137 |
float4x4 ShadowDepthPass_ProjectionMatrix; |
| 138 |
float4x4 ShadowDepthPass_ViewMatrix; |
| 139 |
float4 ShadowDepthPass_ShadowParams; |
| 140 |
float ShadowDepthPass_bClampToNearPlane; |
| 141 |
float PrePadding_ShadowDepthPass_612; |
| 142 |
float PrePadding_ShadowDepthPass_616; |
| 143 |
float PrePadding_ShadowDepthPass_620; |
| 144 |
float4x4 ShadowDepthPass_ShadowViewProjectionMatrices[6]; |
| 145 |
float4x4 ShadowDepthPass_ShadowViewMatrices[6]; |
| 146 |
}; |
| 147 |
|
| 148 |
constant float4 _90 = {}; |
| 149 |
|
| 150 |
struct main0_out |
| 151 |
{ |
| 152 |
float4 out_var_TEXCOORD10_centroid [[user(locn0)]]; |
| 153 |
float4 out_var_TEXCOORD11_centroid [[user(locn1)]]; |
| 154 |
float out_var_TEXCOORD6 [[user(locn2)]]; |
| 155 |
float3 out_var_TEXCOORD7 [[user(locn3)]]; |
| 156 |
float4 gl_Position [[position]]; |
| 157 |
}; |
| 158 |
|
| 159 |
struct main0_in |
| 160 |
{ |
| 161 |
float4 in_var_PN_POSITION_0 [[attribute(10)]]; |
| 162 |
float4 in_var_PN_POSITION_1 [[attribute(11)]]; |
| 163 |
float4 in_var_PN_POSITION_2 [[attribute(12)]]; |
| 164 |
float4 in_var_TEXCOORD10_centroid [[attribute(16)]]; |
| 165 |
float4 in_var_TEXCOORD11_centroid [[attribute(17)]]; |
| 166 |
}; |
| 167 |
|
| 168 |
struct main0_patchIn |
| 169 |
{ |
| 170 |
float4 in_var_PN_POSITION9 [[attribute(13)]]; |
| 171 |
patch_control_point<main0_in> gl_in; |
| 172 |
}; |
| 173 |
|
| 174 |
[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant type_ShadowDepthPass& ShadowDepthPass [[buffer(0)]], float3 gl_TessCoord [[position_in_patch]]) |
| 175 |
{ |
| 176 |
main0_out out = {}; |
| 177 |
spvUnsafeArray<float4, 3> _93 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD10_centroid, patchIn.gl_in[1].in_var_TEXCOORD10_centroid, patchIn.gl_in[2].in_var_TEXCOORD10_centroid }); |
| 178 |
spvUnsafeArray<float4, 3> _94 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD11_centroid, patchIn.gl_in[1].in_var_TEXCOORD11_centroid, patchIn.gl_in[2].in_var_TEXCOORD11_centroid }); |
| 179 |
spvUnsafeArray<spvUnsafeArray<float4, 3>, 3> _101 = spvUnsafeArray<spvUnsafeArray<float4, 3>, 3>({ spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_PN_POSITION_0, patchIn.gl_in[0].in_var_PN_POSITION_1, patchIn.gl_in[0].in_var_PN_POSITION_2 }), spvUnsafeArray<float4, 3>({ patchIn.gl_in[1].in_var_PN_POSITION_0, patchIn.gl_in[1].in_var_PN_POSITION_1, patchIn.gl_in[1].in_var_PN_POSITION_2 }), spvUnsafeArray<float4, 3>({ patchIn.gl_in[2].in_var_PN_POSITION_0, patchIn.gl_in[2].in_var_PN_POSITION_1, patchIn.gl_in[2].in_var_PN_POSITION_2 }) }); |
| 180 |
float _119 = gl_TessCoord.x * gl_TessCoord.x; |
| 181 |
float _120 = gl_TessCoord.y * gl_TessCoord.y; |
| 182 |
float _121 = gl_TessCoord.z * gl_TessCoord.z; |
| 183 |
float4 _127 = float4(gl_TessCoord.x); |
| 184 |
float4 _131 = float4(gl_TessCoord.y); |
| 185 |
float4 _136 = float4(gl_TessCoord.z); |
| 186 |
float4 _139 = float4(_119 * 3.0); |
| 187 |
float4 _143 = float4(_120 * 3.0); |
| 188 |
float4 _150 = float4(_121 * 3.0); |
| 189 |
float4 _164 = ((((((((((_101[0][0] * float4(_119)) * _127) + ((_101[1][0] * float4(_120)) * _131)) + ((_101[2][0] * float4(_121)) * _136)) + ((_101[0][1] * _139) * _131)) + ((_101[0][2] * _143) * _127)) + ((_101[1][1] * _143) * _136)) + ((_101[1][2] * _150) * _131)) + ((_101[2][1] * _150) * _127)) + ((_101[2][2] * _139) * _136)) + ((((patchIn.in_var_PN_POSITION9 * float4(6.0)) * _136) * _127) * _131); |
| 190 |
float3 _179 = ((_93[0].xyz * float3(gl_TessCoord.x)) + (_93[1].xyz * float3(gl_TessCoord.y))).xyz + (_93[2].xyz * float3(gl_TessCoord.z)); |
| 191 |
float4 _182 = ((_94[0] * _127) + (_94[1] * _131)) + (_94[2] * _136); |
| 192 |
float4 _189 = ShadowDepthPass.ShadowDepthPass_ProjectionMatrix * float4(_164.x, _164.y, _164.z, _164.w); |
| 193 |
float4 _200; |
| 194 |
if ((ShadowDepthPass.ShadowDepthPass_bClampToNearPlane > 0.0) && (_189.z < 0.0)) |
| 195 |
{ |
| 196 |
float4 _198 = _189; |
| 197 |
_198.z = 9.9999999747524270787835121154785e-07; |
| 198 |
float4 _199 = _198; |
| 199 |
_199.w = 1.0; |
| 200 |
_200 = _199; |
| 201 |
} |
| 202 |
else |
| 203 |
{ |
| 204 |
_200 = _189; |
| 205 |
} |
| 206 |
float _209 = abs(dot(float3(ShadowDepthPass.ShadowDepthPass_ViewMatrix[0].z, ShadowDepthPass.ShadowDepthPass_ViewMatrix[1].z, ShadowDepthPass.ShadowDepthPass_ViewMatrix[2].z), _182.xyz)); |
| 207 |
float4 _234 = _200; |
| 208 |
_234.z = ((_200.z * ShadowDepthPass.ShadowDepthPass_ShadowParams.w) + ((ShadowDepthPass.ShadowDepthPass_ShadowParams.y * fast::clamp((abs(_209) > 0.0) ? (sqrt(fast::clamp(1.0 - (_209 * _209), 0.0, 1.0)) / _209) : ShadowDepthPass.ShadowDepthPass_ShadowParams.z, 0.0, ShadowDepthPass.ShadowDepthPass_ShadowParams.z)) + ShadowDepthPass.ShadowDepthPass_ShadowParams.x)) * _200.w; |
| 209 |
out.out_var_TEXCOORD10_centroid = float4(_179.x, _179.y, _179.z, _90.w); |
| 210 |
out.out_var_TEXCOORD11_centroid = _182; |
| 211 |
out.out_var_TEXCOORD6 = 0.0; |
| 212 |
out.out_var_TEXCOORD7 = _164.xyz; |
| 213 |
out.gl_Position = _234; |
| 214 |
return out; |
| 215 |
} |
| 216 |
|