| 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_View |
| 48 |
{ |
| 49 |
float4x4 View_TranslatedWorldToClip; |
| 50 |
float4x4 View_WorldToClip; |
| 51 |
float4x4 View_ClipToWorld; |
| 52 |
float4x4 View_TranslatedWorldToView; |
| 53 |
float4x4 View_ViewToTranslatedWorld; |
| 54 |
float4x4 View_TranslatedWorldToCameraView; |
| 55 |
float4x4 View_CameraViewToTranslatedWorld; |
| 56 |
float4x4 View_ViewToClip; |
| 57 |
float4x4 View_ViewToClipNoAA; |
| 58 |
float4x4 View_ClipToView; |
| 59 |
float4x4 View_ClipToTranslatedWorld; |
| 60 |
float4x4 View_SVPositionToTranslatedWorld; |
| 61 |
float4x4 View_ScreenToWorld; |
| 62 |
float4x4 View_ScreenToTranslatedWorld; |
| 63 |
packed_float3 View_ViewForward; |
| 64 |
float PrePadding_View_908; |
| 65 |
packed_float3 View_ViewUp; |
| 66 |
float PrePadding_View_924; |
| 67 |
packed_float3 View_ViewRight; |
| 68 |
float PrePadding_View_940; |
| 69 |
packed_float3 View_HMDViewNoRollUp; |
| 70 |
float PrePadding_View_956; |
| 71 |
packed_float3 View_HMDViewNoRollRight; |
| 72 |
float PrePadding_View_972; |
| 73 |
float4 View_InvDeviceZToWorldZTransform; |
| 74 |
float4 View_ScreenPositionScaleBias; |
| 75 |
packed_float3 View_WorldCameraOrigin; |
| 76 |
float PrePadding_View_1020; |
| 77 |
packed_float3 View_TranslatedWorldCameraOrigin; |
| 78 |
float PrePadding_View_1036; |
| 79 |
packed_float3 View_WorldViewOrigin; |
| 80 |
float PrePadding_View_1052; |
| 81 |
packed_float3 View_PreViewTranslation; |
| 82 |
float PrePadding_View_1068; |
| 83 |
float4x4 View_PrevProjection; |
| 84 |
float4x4 View_PrevViewProj; |
| 85 |
float4x4 View_PrevViewRotationProj; |
| 86 |
float4x4 View_PrevViewToClip; |
| 87 |
float4x4 View_PrevClipToView; |
| 88 |
float4x4 View_PrevTranslatedWorldToClip; |
| 89 |
float4x4 View_PrevTranslatedWorldToView; |
| 90 |
float4x4 View_PrevViewToTranslatedWorld; |
| 91 |
float4x4 View_PrevTranslatedWorldToCameraView; |
| 92 |
float4x4 View_PrevCameraViewToTranslatedWorld; |
| 93 |
packed_float3 View_PrevWorldCameraOrigin; |
| 94 |
float PrePadding_View_1724; |
| 95 |
packed_float3 View_PrevWorldViewOrigin; |
| 96 |
float PrePadding_View_1740; |
| 97 |
packed_float3 View_PrevPreViewTranslation; |
| 98 |
float PrePadding_View_1756; |
| 99 |
float4x4 View_PrevInvViewProj; |
| 100 |
float4x4 View_PrevScreenToTranslatedWorld; |
| 101 |
float4x4 View_ClipToPrevClip; |
| 102 |
float4 View_TemporalAAJitter; |
| 103 |
float4 View_GlobalClippingPlane; |
| 104 |
float2 View_FieldOfViewWideAngles; |
| 105 |
float2 View_PrevFieldOfViewWideAngles; |
| 106 |
float4 View_ViewRectMin; |
| 107 |
float4 View_ViewSizeAndInvSize; |
| 108 |
float4 View_BufferSizeAndInvSize; |
| 109 |
float4 View_BufferBilinearUVMinMax; |
| 110 |
int View_NumSceneColorMSAASamples; |
| 111 |
float View_PreExposure; |
| 112 |
float View_OneOverPreExposure; |
| 113 |
float PrePadding_View_2076; |
| 114 |
float4 View_DiffuseOverrideParameter; |
| 115 |
float4 View_SpecularOverrideParameter; |
| 116 |
float4 View_NormalOverrideParameter; |
| 117 |
float2 View_RoughnessOverrideParameter; |
| 118 |
float View_PrevFrameGameTime; |
| 119 |
float View_PrevFrameRealTime; |
| 120 |
float View_OutOfBoundsMask; |
| 121 |
float PrePadding_View_2148; |
| 122 |
float PrePadding_View_2152; |
| 123 |
float PrePadding_View_2156; |
| 124 |
packed_float3 View_WorldCameraMovementSinceLastFrame; |
| 125 |
float View_CullingSign; |
| 126 |
float View_NearPlane; |
| 127 |
float View_AdaptiveTessellationFactor; |
| 128 |
float View_GameTime; |
| 129 |
float View_RealTime; |
| 130 |
float View_DeltaTime; |
| 131 |
float View_MaterialTextureMipBias; |
| 132 |
float View_MaterialTextureDerivativeMultiply; |
| 133 |
uint View_Random; |
| 134 |
uint View_FrameNumber; |
| 135 |
uint View_StateFrameIndexMod8; |
| 136 |
uint View_StateFrameIndex; |
| 137 |
float View_CameraCut; |
| 138 |
float View_UnlitViewmodeMask; |
| 139 |
float PrePadding_View_2228; |
| 140 |
float PrePadding_View_2232; |
| 141 |
float PrePadding_View_2236; |
| 142 |
float4 View_DirectionalLightColor; |
| 143 |
packed_float3 View_DirectionalLightDirection; |
| 144 |
float PrePadding_View_2268; |
| 145 |
float4 View_TranslucencyLightingVolumeMin[2]; |
| 146 |
float4 View_TranslucencyLightingVolumeInvSize[2]; |
| 147 |
float4 View_TemporalAAParams; |
| 148 |
float4 View_CircleDOFParams; |
| 149 |
float View_DepthOfFieldSensorWidth; |
| 150 |
float View_DepthOfFieldFocalDistance; |
| 151 |
float View_DepthOfFieldScale; |
| 152 |
float View_DepthOfFieldFocalLength; |
| 153 |
float View_DepthOfFieldFocalRegion; |
| 154 |
float View_DepthOfFieldNearTransitionRegion; |
| 155 |
float View_DepthOfFieldFarTransitionRegion; |
| 156 |
float View_MotionBlurNormalizedToPixel; |
| 157 |
float View_bSubsurfacePostprocessEnabled; |
| 158 |
float View_GeneralPurposeTweak; |
| 159 |
float View_DemosaicVposOffset; |
| 160 |
float PrePadding_View_2412; |
| 161 |
packed_float3 View_IndirectLightingColorScale; |
| 162 |
float View_HDR32bppEncodingMode; |
| 163 |
packed_float3 View_AtmosphericFogSunDirection; |
| 164 |
float View_AtmosphericFogSunPower; |
| 165 |
float View_AtmosphericFogPower; |
| 166 |
float View_AtmosphericFogDensityScale; |
| 167 |
float View_AtmosphericFogDensityOffset; |
| 168 |
float View_AtmosphericFogGroundOffset; |
| 169 |
float View_AtmosphericFogDistanceScale; |
| 170 |
float View_AtmosphericFogAltitudeScale; |
| 171 |
float View_AtmosphericFogHeightScaleRayleigh; |
| 172 |
float View_AtmosphericFogStartDistance; |
| 173 |
float View_AtmosphericFogDistanceOffset; |
| 174 |
float View_AtmosphericFogSunDiscScale; |
| 175 |
float View_AtmosphericFogSunDiscHalfApexAngleRadian; |
| 176 |
float PrePadding_View_2492; |
| 177 |
float4 View_AtmosphericFogSunDiscLuminance; |
| 178 |
uint View_AtmosphericFogRenderMask; |
| 179 |
uint View_AtmosphericFogInscatterAltitudeSampleNum; |
| 180 |
uint PrePadding_View_2520; |
| 181 |
uint PrePadding_View_2524; |
| 182 |
float4 View_AtmosphericFogSunColor; |
| 183 |
packed_float3 View_NormalCurvatureToRoughnessScaleBias; |
| 184 |
float View_RenderingReflectionCaptureMask; |
| 185 |
float4 View_AmbientCubemapTint; |
| 186 |
float View_AmbientCubemapIntensity; |
| 187 |
float View_SkyLightParameters; |
| 188 |
float PrePadding_View_2584; |
| 189 |
float PrePadding_View_2588; |
| 190 |
float4 View_SkyLightColor; |
| 191 |
float4 View_SkyIrradianceEnvironmentMap[7]; |
| 192 |
float View_MobilePreviewMode; |
| 193 |
float View_HMDEyePaddingOffset; |
| 194 |
float View_ReflectionCubemapMaxMip; |
| 195 |
float View_ShowDecalsMask; |
| 196 |
uint View_DistanceFieldAOSpecularOcclusionMode; |
| 197 |
float View_IndirectCapsuleSelfShadowingIntensity; |
| 198 |
float PrePadding_View_2744; |
| 199 |
float PrePadding_View_2748; |
| 200 |
packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; |
| 201 |
int View_StereoPassIndex; |
| 202 |
float4 View_GlobalVolumeCenterAndExtent[4]; |
| 203 |
float4 View_GlobalVolumeWorldToUVAddAndMul[4]; |
| 204 |
float View_GlobalVolumeDimension; |
| 205 |
float View_GlobalVolumeTexelSize; |
| 206 |
float View_MaxGlobalDistance; |
| 207 |
float PrePadding_View_2908; |
| 208 |
int2 View_CursorPosition; |
| 209 |
float View_bCheckerboardSubsurfaceProfileRendering; |
| 210 |
float PrePadding_View_2924; |
| 211 |
packed_float3 View_VolumetricFogInvGridSize; |
| 212 |
float PrePadding_View_2940; |
| 213 |
packed_float3 View_VolumetricFogGridZParams; |
| 214 |
float PrePadding_View_2956; |
| 215 |
float2 View_VolumetricFogSVPosToVolumeUV; |
| 216 |
float View_VolumetricFogMaxDistance; |
| 217 |
float PrePadding_View_2972; |
| 218 |
packed_float3 View_VolumetricLightmapWorldToUVScale; |
| 219 |
float PrePadding_View_2988; |
| 220 |
packed_float3 View_VolumetricLightmapWorldToUVAdd; |
| 221 |
float PrePadding_View_3004; |
| 222 |
packed_float3 View_VolumetricLightmapIndirectionTextureSize; |
| 223 |
float View_VolumetricLightmapBrickSize; |
| 224 |
packed_float3 View_VolumetricLightmapBrickTexelSize; |
| 225 |
float View_StereoIPD; |
| 226 |
float View_IndirectLightingCacheShowFlag; |
| 227 |
float View_EyeToPixelSpreadAngle; |
| 228 |
float PrePadding_View_3048; |
| 229 |
float PrePadding_View_3052; |
| 230 |
float4x4 View_WorldToVirtualTexture; |
| 231 |
float4 View_VirtualTextureParams; |
| 232 |
float4 View_XRPassthroughCameraUVs[2]; |
| 233 |
}; |
| 234 |
|
| 235 |
constant float4 _68 = {}; |
| 236 |
|
| 237 |
struct main0_out |
| 238 |
{ |
| 239 |
float4 out_var_TEXCOORD10_centroid [[user(locn0)]]; |
| 240 |
float4 out_var_TEXCOORD11_centroid [[user(locn1)]]; |
| 241 |
float4 out_var_TEXCOORD0_0 [[user(locn2)]]; |
| 242 |
float4 out_var_COLOR1 [[user(locn3)]]; |
| 243 |
float4 out_var_COLOR2 [[user(locn4)]]; |
| 244 |
float4 out_var_TEXCOORD6 [[user(locn5)]]; |
| 245 |
float3 out_var_TEXCOORD7 [[user(locn6)]]; |
| 246 |
float4 gl_Position [[position]]; |
| 247 |
}; |
| 248 |
|
| 249 |
struct main0_in |
| 250 |
{ |
| 251 |
float4 in_var_COLOR1 [[attribute(0)]]; |
| 252 |
float4 in_var_COLOR2 [[attribute(1)]]; |
| 253 |
float4 in_var_TEXCOORD0_0 [[attribute(5)]]; |
| 254 |
float4 in_var_TEXCOORD10_centroid [[attribute(6)]]; |
| 255 |
float4 in_var_TEXCOORD11_centroid [[attribute(7)]]; |
| 256 |
float3 in_var_TEXCOORD7 [[attribute(8)]]; |
| 257 |
float4 in_var_VS_To_DS_Position [[attribute(9)]]; |
| 258 |
}; |
| 259 |
|
| 260 |
struct main0_patchIn |
| 261 |
{ |
| 262 |
patch_control_point<main0_in> gl_in; |
| 263 |
}; |
| 264 |
|
| 265 |
[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant type_View& View [[buffer(0)]], float3 gl_TessCoord [[position_in_patch]]) |
| 266 |
{ |
| 267 |
main0_out out = {}; |
| 268 |
spvUnsafeArray<float4, 1> out_var_TEXCOORD0 = {}; |
| 269 |
spvUnsafeArray<float4, 3> _77 = 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 }); |
| 270 |
spvUnsafeArray<float4, 3> _78 = 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 }); |
| 271 |
spvUnsafeArray<spvUnsafeArray<float4, 1>, 3> _79 = spvUnsafeArray<spvUnsafeArray<float4, 1>, 3>({ spvUnsafeArray<float4, 1>({ patchIn.gl_in[0].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ patchIn.gl_in[1].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ patchIn.gl_in[2].in_var_TEXCOORD0_0 }) }); |
| 272 |
spvUnsafeArray<float4, 3> _80 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_COLOR1, patchIn.gl_in[1].in_var_COLOR1, patchIn.gl_in[2].in_var_COLOR1 }); |
| 273 |
spvUnsafeArray<float4, 3> _81 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_COLOR2, patchIn.gl_in[1].in_var_COLOR2, patchIn.gl_in[2].in_var_COLOR2 }); |
| 274 |
spvUnsafeArray<float4, 3> _97 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_VS_To_DS_Position, patchIn.gl_in[1].in_var_VS_To_DS_Position, patchIn.gl_in[2].in_var_VS_To_DS_Position }); |
| 275 |
spvUnsafeArray<float3, 3> _98 = spvUnsafeArray<float3, 3>({ patchIn.gl_in[0].in_var_TEXCOORD7, patchIn.gl_in[1].in_var_TEXCOORD7, patchIn.gl_in[2].in_var_TEXCOORD7 }); |
| 276 |
float4 _111 = float4(gl_TessCoord.x); |
| 277 |
float4 _113 = float4(gl_TessCoord.y); |
| 278 |
float4 _116 = float4(gl_TessCoord.z); |
| 279 |
float4 _118 = ((_97[0] * _111) + (_97[1] * _113)) + (_97[2] * _116); |
| 280 |
spvUnsafeArray<float4, 1> _72; |
| 281 |
_72 = _79[0]; |
| 282 |
spvUnsafeArray<float4, 1> _71; |
| 283 |
_71 = _79[1]; |
| 284 |
float3 _120 = float3(gl_TessCoord.x); |
| 285 |
float3 _123 = float3(gl_TessCoord.y); |
| 286 |
spvUnsafeArray<float4, 1> _73; |
| 287 |
for (int _133 = 0; _133 < 1; ) |
| 288 |
{ |
| 289 |
_73[_133] = (_72[_133] * _111) + (_71[_133] * _113); |
| 290 |
_133++; |
| 291 |
continue; |
| 292 |
} |
| 293 |
spvUnsafeArray<float4, 1> _75; |
| 294 |
_75 = _73; |
| 295 |
spvUnsafeArray<float4, 1> _74; |
| 296 |
_74 = _79[2]; |
| 297 |
float3 _155 = float3(gl_TessCoord.z); |
| 298 |
float3 _157 = ((_77[0].xyz * _120) + (_77[1].xyz * _123)).xyz + (_77[2].xyz * _155); |
| 299 |
spvUnsafeArray<float4, 1> _76; |
| 300 |
for (int _164 = 0; _164 < 1; ) |
| 301 |
{ |
| 302 |
_76[_164] = _75[_164] + (_74[_164] * _116); |
| 303 |
_164++; |
| 304 |
continue; |
| 305 |
} |
| 306 |
float4 _181 = float4(_118.x, _118.y, _118.z, _118.w); |
| 307 |
out.out_var_TEXCOORD10_centroid = float4(_157.x, _157.y, _157.z, _68.w); |
| 308 |
out.out_var_TEXCOORD11_centroid = ((_78[0] * _111) + (_78[1] * _113)) + (_78[2] * _116); |
| 309 |
out_var_TEXCOORD0 = _76; |
| 310 |
out.out_var_COLOR1 = ((_80[0] * _111) + (_80[1] * _113)) + (_80[2] * _116); |
| 311 |
out.out_var_COLOR2 = ((_81[0] * _111) + (_81[1] * _113)) + (_81[2] * _116); |
| 312 |
out.out_var_TEXCOORD6 = _181; |
| 313 |
out.out_var_TEXCOORD7 = ((_98[0] * _120) + (_98[1] * _123)) + (_98[2] * _155); |
| 314 |
out.gl_Position = View.View_TranslatedWorldToClip * _181; |
| 315 |
out.out_var_TEXCOORD0_0 = out_var_TEXCOORD0[0]; |
| 316 |
return out; |
| 317 |
} |
| 318 |
|