• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#include <metal_stdlib>
2#include <simd/simd.h>
3
4using namespace metal;
5
6struct type_View
7{
8    float4x4 View_TranslatedWorldToClip;
9    float4x4 View_WorldToClip;
10    float4x4 View_TranslatedWorldToView;
11    float4x4 View_ViewToTranslatedWorld;
12    float4x4 View_TranslatedWorldToCameraView;
13    float4x4 View_CameraViewToTranslatedWorld;
14    float4x4 View_ViewToClip;
15    float4x4 View_ViewToClipNoAA;
16    float4x4 View_ClipToView;
17    float4x4 View_ClipToTranslatedWorld;
18    float4x4 View_SVPositionToTranslatedWorld;
19    float4x4 View_ScreenToWorld;
20    float4x4 View_ScreenToTranslatedWorld;
21    packed_float3 View_ViewForward;
22    float PrePadding_View_844;
23    packed_float3 View_ViewUp;
24    float PrePadding_View_860;
25    packed_float3 View_ViewRight;
26    float PrePadding_View_876;
27    packed_float3 View_HMDViewNoRollUp;
28    float PrePadding_View_892;
29    packed_float3 View_HMDViewNoRollRight;
30    float PrePadding_View_908;
31    float4 View_InvDeviceZToWorldZTransform;
32    float4 View_ScreenPositionScaleBias;
33    packed_float3 View_WorldCameraOrigin;
34    float PrePadding_View_956;
35    packed_float3 View_TranslatedWorldCameraOrigin;
36    float PrePadding_View_972;
37    packed_float3 View_WorldViewOrigin;
38    float PrePadding_View_988;
39    packed_float3 View_PreViewTranslation;
40    float PrePadding_View_1004;
41    float4x4 View_PrevProjection;
42    float4x4 View_PrevViewProj;
43    float4x4 View_PrevViewRotationProj;
44    float4x4 View_PrevViewToClip;
45    float4x4 View_PrevClipToView;
46    float4x4 View_PrevTranslatedWorldToClip;
47    float4x4 View_PrevTranslatedWorldToView;
48    float4x4 View_PrevViewToTranslatedWorld;
49    float4x4 View_PrevTranslatedWorldToCameraView;
50    float4x4 View_PrevCameraViewToTranslatedWorld;
51    packed_float3 View_PrevWorldCameraOrigin;
52    float PrePadding_View_1660;
53    packed_float3 View_PrevWorldViewOrigin;
54    float PrePadding_View_1676;
55    packed_float3 View_PrevPreViewTranslation;
56    float PrePadding_View_1692;
57    float4x4 View_PrevInvViewProj;
58    float4x4 View_PrevScreenToTranslatedWorld;
59    float4x4 View_ClipToPrevClip;
60    float4 View_TemporalAAJitter;
61    float4 View_GlobalClippingPlane;
62    float2 View_FieldOfViewWideAngles;
63    float2 View_PrevFieldOfViewWideAngles;
64    float4 View_ViewRectMin;
65    float4 View_ViewSizeAndInvSize;
66    float4 View_BufferSizeAndInvSize;
67    float4 View_BufferBilinearUVMinMax;
68    int View_NumSceneColorMSAASamples;
69    float View_PreExposure;
70    float View_OneOverPreExposure;
71    float PrePadding_View_2012;
72    float4 View_DiffuseOverrideParameter;
73    float4 View_SpecularOverrideParameter;
74    float4 View_NormalOverrideParameter;
75    float2 View_RoughnessOverrideParameter;
76    float View_PrevFrameGameTime;
77    float View_PrevFrameRealTime;
78    float View_OutOfBoundsMask;
79    float PrePadding_View_2084;
80    float PrePadding_View_2088;
81    float PrePadding_View_2092;
82    packed_float3 View_WorldCameraMovementSinceLastFrame;
83    float View_CullingSign;
84    float View_NearPlane;
85    float View_AdaptiveTessellationFactor;
86    float View_GameTime;
87    float View_RealTime;
88    float View_DeltaTime;
89    float View_MaterialTextureMipBias;
90    float View_MaterialTextureDerivativeMultiply;
91    uint View_Random;
92    uint View_FrameNumber;
93    uint View_StateFrameIndexMod8;
94    uint View_StateFrameIndex;
95    float View_CameraCut;
96    float View_UnlitViewmodeMask;
97    float PrePadding_View_2164;
98    float PrePadding_View_2168;
99    float PrePadding_View_2172;
100    float4 View_DirectionalLightColor;
101    packed_float3 View_DirectionalLightDirection;
102    float PrePadding_View_2204;
103    float4 View_TranslucencyLightingVolumeMin[2];
104    float4 View_TranslucencyLightingVolumeInvSize[2];
105    float4 View_TemporalAAParams;
106    float4 View_CircleDOFParams;
107    float View_DepthOfFieldSensorWidth;
108    float View_DepthOfFieldFocalDistance;
109    float View_DepthOfFieldScale;
110    float View_DepthOfFieldFocalLength;
111    float View_DepthOfFieldFocalRegion;
112    float View_DepthOfFieldNearTransitionRegion;
113    float View_DepthOfFieldFarTransitionRegion;
114    float View_MotionBlurNormalizedToPixel;
115    float View_bSubsurfacePostprocessEnabled;
116    float View_GeneralPurposeTweak;
117    float View_DemosaicVposOffset;
118    float PrePadding_View_2348;
119    packed_float3 View_IndirectLightingColorScale;
120    float View_HDR32bppEncodingMode;
121    packed_float3 View_AtmosphericFogSunDirection;
122    float View_AtmosphericFogSunPower;
123    float View_AtmosphericFogPower;
124    float View_AtmosphericFogDensityScale;
125    float View_AtmosphericFogDensityOffset;
126    float View_AtmosphericFogGroundOffset;
127    float View_AtmosphericFogDistanceScale;
128    float View_AtmosphericFogAltitudeScale;
129    float View_AtmosphericFogHeightScaleRayleigh;
130    float View_AtmosphericFogStartDistance;
131    float View_AtmosphericFogDistanceOffset;
132    float View_AtmosphericFogSunDiscScale;
133    uint View_AtmosphericFogRenderMask;
134    uint View_AtmosphericFogInscatterAltitudeSampleNum;
135    float4 View_AtmosphericFogSunColor;
136    packed_float3 View_NormalCurvatureToRoughnessScaleBias;
137    float View_RenderingReflectionCaptureMask;
138    float4 View_AmbientCubemapTint;
139    float View_AmbientCubemapIntensity;
140    float View_SkyLightParameters;
141    float PrePadding_View_2488;
142    float PrePadding_View_2492;
143    float4 View_SkyLightColor;
144    float4 View_SkyIrradianceEnvironmentMap[7];
145    float View_MobilePreviewMode;
146    float View_HMDEyePaddingOffset;
147    float View_ReflectionCubemapMaxMip;
148    float View_ShowDecalsMask;
149    uint View_DistanceFieldAOSpecularOcclusionMode;
150    float View_IndirectCapsuleSelfShadowingIntensity;
151    float PrePadding_View_2648;
152    float PrePadding_View_2652;
153    packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
154    int View_StereoPassIndex;
155    float4 View_GlobalVolumeCenterAndExtent[4];
156    float4 View_GlobalVolumeWorldToUVAddAndMul[4];
157    float View_GlobalVolumeDimension;
158    float View_GlobalVolumeTexelSize;
159    float View_MaxGlobalDistance;
160    float View_bCheckerboardSubsurfaceProfileRendering;
161    packed_float3 View_VolumetricFogInvGridSize;
162    float PrePadding_View_2828;
163    packed_float3 View_VolumetricFogGridZParams;
164    float PrePadding_View_2844;
165    float2 View_VolumetricFogSVPosToVolumeUV;
166    float View_VolumetricFogMaxDistance;
167    float PrePadding_View_2860;
168    packed_float3 View_VolumetricLightmapWorldToUVScale;
169    float PrePadding_View_2876;
170    packed_float3 View_VolumetricLightmapWorldToUVAdd;
171    float PrePadding_View_2892;
172    packed_float3 View_VolumetricLightmapIndirectionTextureSize;
173    float View_VolumetricLightmapBrickSize;
174    packed_float3 View_VolumetricLightmapBrickTexelSize;
175    float View_StereoIPD;
176    float View_IndirectLightingCacheShowFlag;
177    float View_EyeToPixelSpreadAngle;
178};
179
180struct type_Globals
181{
182    float3 SoftTransitionScale;
183    float4 ShadowBufferSize;
184    float ShadowFadeFraction;
185    float ShadowSharpen;
186    float4 LightPositionAndInvRadius;
187    float4x4 ScreenToShadowMatrix;
188    float2 ProjectionDepthBiasParameters;
189    float4 ModulatedShadowColor;
190    float4 ShadowTileOffsetAndSize;
191};
192
193constant float4 _58 = {};
194
195struct main0_out
196{
197    float4 out_var_SV_Target0 [[color(0)]];
198};
199
200fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], float4 _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData [[color(0)]], texture2d<float> ShadowDepthTexture [[texture(0)]], sampler ShadowDepthTextureSampler [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleID [[sample_id]])
201{
202    main0_out out = {};
203    gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5;
204    float4 _67 = _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData;
205    float _68 = _67.w;
206    float4 _82 = _Globals.ScreenToShadowMatrix * float4((((gl_FragCoord.xy * View.View_BufferSizeAndInvSize.zw) - View.View_ScreenPositionScaleBias.wz) / View.View_ScreenPositionScaleBias.xy) * float2(_68), _68, 1.0);
207    float _118 = fast::clamp(((fast::clamp((ShadowDepthTexture.sample(ShadowDepthTextureSampler, (((_82.xyz / float3(_82.w)).xy * _Globals.ShadowTileOffsetAndSize.zw).xy + _Globals.ShadowTileOffsetAndSize.xy).xy, level(0.0)).xxx * float3(_Globals.SoftTransitionScale.z)) - float3((fast::min(_82.z, 0.999989986419677734375) * _Globals.SoftTransitionScale.z) - 1.0), float3(0.0), float3(1.0)).x - 0.5) * _Globals.ShadowSharpen) + 0.5, 0.0, 1.0);
208    float3 _127 = mix(_Globals.ModulatedShadowColor.xyz, float3(1.0), float3(mix(1.0, _118 * _118, _Globals.ShadowFadeFraction)));
209    float4 _129 = float4(_127.x, _127.y, _127.z, _58.w);
210    _129.w = 0.0;
211    out.out_var_SV_Target0 = _129;
212    return out;
213}
214
215