Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Satterthwaite <mark.satterthwaite@epicgames.com>2019-08-14 01:16:37 +0300
committerLukas Hermanns <lukas.hermanns@epicgames.com>2019-09-04 20:02:34 +0300
commitb5ad5d4e2f44a8b0af11798e4c5681ba31dd1b22 (patch)
treef499f42092a88cb08547b19b6db9a50070178f69 /reference/opt/shaders-msl/asm
parentb46a0b960939f801b63108180720f228afd5e9fa (diff)
UE4 shader reference for those shaders that will compile without the changes.
Diffstat (limited to 'reference/opt/shaders-msl/asm')
-rw-r--r--reference/opt/shaders-msl/asm/ue4/accesschain_invalidexpression/MobileBasePassPixelShader.dxc.asm.frag379
-rw-r--r--reference/opt/shaders-msl/asm/ue4/array_template_examples/array_missing_copies/MobileBasePassVertexShader.dxc.asm.vert464
-rw-r--r--reference/opt/shaders-msl/asm/ue4/depth_compare/ShadowProjectionPixelShader.dxc.asm.frag317
-rw-r--r--reference/opt/shaders-msl/asm/ue4/global_constant_arrays/PostProcessCombineLUTs.dxc.asm.frag1347
-rw-r--r--reference/opt/shaders-msl/asm/ue4/loop_accesschain_writethrough/DOFHybridScatterVertexShader.dxc.asm.vert91
-rw-r--r--reference/opt/shaders-msl/asm/ue4/padded_float_array_member_defef/PostProcessCombineLUTs.dxc.asm.frag1397
-rw-r--r--reference/opt/shaders-msl/asm/ue4/texture_buffer/ShadowDepthVertexShader.dxc.asm.vert390
7 files changed, 4385 insertions, 0 deletions
diff --git a/reference/opt/shaders-msl/asm/ue4/accesschain_invalidexpression/MobileBasePassPixelShader.dxc.asm.frag b/reference/opt/shaders-msl/asm/ue4/accesschain_invalidexpression/MobileBasePassPixelShader.dxc.asm.frag
new file mode 100644
index 00000000..a4958ec3
--- /dev/null
+++ b/reference/opt/shaders-msl/asm/ue4/accesschain_invalidexpression/MobileBasePassPixelShader.dxc.asm.frag
@@ -0,0 +1,379 @@
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct type_View
+{
+ float4x4 View_TranslatedWorldToClip;
+ float4x4 View_WorldToClip;
+ float4x4 View_TranslatedWorldToView;
+ float4x4 View_ViewToTranslatedWorld;
+ float4x4 View_TranslatedWorldToCameraView;
+ float4x4 View_CameraViewToTranslatedWorld;
+ float4x4 View_ViewToClip;
+ float4x4 View_ViewToClipNoAA;
+ float4x4 View_ClipToView;
+ float4x4 View_ClipToTranslatedWorld;
+ float4x4 View_SVPositionToTranslatedWorld;
+ float4x4 View_ScreenToWorld;
+ float4x4 View_ScreenToTranslatedWorld;
+ packed_float3 View_ViewForward;
+ float PrePadding_View_844;
+ packed_float3 View_ViewUp;
+ float PrePadding_View_860;
+ packed_float3 View_ViewRight;
+ float PrePadding_View_876;
+ packed_float3 View_HMDViewNoRollUp;
+ float PrePadding_View_892;
+ packed_float3 View_HMDViewNoRollRight;
+ float PrePadding_View_908;
+ float4 View_InvDeviceZToWorldZTransform;
+ float4 View_ScreenPositionScaleBias;
+ packed_float3 View_WorldCameraOrigin;
+ float PrePadding_View_956;
+ packed_float3 View_TranslatedWorldCameraOrigin;
+ float PrePadding_View_972;
+ packed_float3 View_WorldViewOrigin;
+ float PrePadding_View_988;
+ packed_float3 View_PreViewTranslation;
+ float PrePadding_View_1004;
+ float4x4 View_PrevProjection;
+ float4x4 View_PrevViewProj;
+ float4x4 View_PrevViewRotationProj;
+ float4x4 View_PrevViewToClip;
+ float4x4 View_PrevClipToView;
+ float4x4 View_PrevTranslatedWorldToClip;
+ float4x4 View_PrevTranslatedWorldToView;
+ float4x4 View_PrevViewToTranslatedWorld;
+ float4x4 View_PrevTranslatedWorldToCameraView;
+ float4x4 View_PrevCameraViewToTranslatedWorld;
+ packed_float3 View_PrevWorldCameraOrigin;
+ float PrePadding_View_1660;
+ packed_float3 View_PrevWorldViewOrigin;
+ float PrePadding_View_1676;
+ packed_float3 View_PrevPreViewTranslation;
+ float PrePadding_View_1692;
+ float4x4 View_PrevInvViewProj;
+ float4x4 View_PrevScreenToTranslatedWorld;
+ float4x4 View_ClipToPrevClip;
+ float4 View_TemporalAAJitter;
+ float4 View_GlobalClippingPlane;
+ float2 View_FieldOfViewWideAngles;
+ float2 View_PrevFieldOfViewWideAngles;
+ float4 View_ViewRectMin;
+ float4 View_ViewSizeAndInvSize;
+ float4 View_BufferSizeAndInvSize;
+ float4 View_BufferBilinearUVMinMax;
+ int View_NumSceneColorMSAASamples;
+ float View_PreExposure;
+ float View_OneOverPreExposure;
+ float PrePadding_View_2012;
+ float4 View_DiffuseOverrideParameter;
+ float4 View_SpecularOverrideParameter;
+ float4 View_NormalOverrideParameter;
+ float2 View_RoughnessOverrideParameter;
+ float View_PrevFrameGameTime;
+ float View_PrevFrameRealTime;
+ float View_OutOfBoundsMask;
+ float PrePadding_View_2084;
+ float PrePadding_View_2088;
+ float PrePadding_View_2092;
+ packed_float3 View_WorldCameraMovementSinceLastFrame;
+ float View_CullingSign;
+ float View_NearPlane;
+ float View_AdaptiveTessellationFactor;
+ float View_GameTime;
+ float View_RealTime;
+ float View_DeltaTime;
+ float View_MaterialTextureMipBias;
+ float View_MaterialTextureDerivativeMultiply;
+ uint View_Random;
+ uint View_FrameNumber;
+ uint View_StateFrameIndexMod8;
+ uint View_StateFrameIndex;
+ float View_CameraCut;
+ float View_UnlitViewmodeMask;
+ float PrePadding_View_2164;
+ float PrePadding_View_2168;
+ float PrePadding_View_2172;
+ float4 View_DirectionalLightColor;
+ packed_float3 View_DirectionalLightDirection;
+ float PrePadding_View_2204;
+ float4 View_TranslucencyLightingVolumeMin[2];
+ float4 View_TranslucencyLightingVolumeInvSize[2];
+ float4 View_TemporalAAParams;
+ float4 View_CircleDOFParams;
+ float View_DepthOfFieldSensorWidth;
+ float View_DepthOfFieldFocalDistance;
+ float View_DepthOfFieldScale;
+ float View_DepthOfFieldFocalLength;
+ float View_DepthOfFieldFocalRegion;
+ float View_DepthOfFieldNearTransitionRegion;
+ float View_DepthOfFieldFarTransitionRegion;
+ float View_MotionBlurNormalizedToPixel;
+ float View_bSubsurfacePostprocessEnabled;
+ float View_GeneralPurposeTweak;
+ float View_DemosaicVposOffset;
+ float PrePadding_View_2348;
+ packed_float3 View_IndirectLightingColorScale;
+ float View_HDR32bppEncodingMode;
+ packed_float3 View_AtmosphericFogSunDirection;
+ float View_AtmosphericFogSunPower;
+ float View_AtmosphericFogPower;
+ float View_AtmosphericFogDensityScale;
+ float View_AtmosphericFogDensityOffset;
+ float View_AtmosphericFogGroundOffset;
+ float View_AtmosphericFogDistanceScale;
+ float View_AtmosphericFogAltitudeScale;
+ float View_AtmosphericFogHeightScaleRayleigh;
+ float View_AtmosphericFogStartDistance;
+ float View_AtmosphericFogDistanceOffset;
+ float View_AtmosphericFogSunDiscScale;
+ uint View_AtmosphericFogRenderMask;
+ uint View_AtmosphericFogInscatterAltitudeSampleNum;
+ float4 View_AtmosphericFogSunColor;
+ packed_float3 View_NormalCurvatureToRoughnessScaleBias;
+ float View_RenderingReflectionCaptureMask;
+ float4 View_AmbientCubemapTint;
+ float View_AmbientCubemapIntensity;
+ float View_SkyLightParameters;
+ float PrePadding_View_2488;
+ float PrePadding_View_2492;
+ float4 View_SkyLightColor;
+ float4 View_SkyIrradianceEnvironmentMap[7];
+ float View_MobilePreviewMode;
+ float View_HMDEyePaddingOffset;
+ float View_ReflectionCubemapMaxMip;
+ float View_ShowDecalsMask;
+ uint View_DistanceFieldAOSpecularOcclusionMode;
+ float View_IndirectCapsuleSelfShadowingIntensity;
+ float PrePadding_View_2648;
+ float PrePadding_View_2652;
+ packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
+ int View_StereoPassIndex;
+ float4 View_GlobalVolumeCenterAndExtent[4];
+ float4 View_GlobalVolumeWorldToUVAddAndMul[4];
+ float View_GlobalVolumeDimension;
+ float View_GlobalVolumeTexelSize;
+ float View_MaxGlobalDistance;
+ float View_bCheckerboardSubsurfaceProfileRendering;
+ packed_float3 View_VolumetricFogInvGridSize;
+ float PrePadding_View_2828;
+ packed_float3 View_VolumetricFogGridZParams;
+ float PrePadding_View_2844;
+ float2 View_VolumetricFogSVPosToVolumeUV;
+ float View_VolumetricFogMaxDistance;
+ float PrePadding_View_2860;
+ packed_float3 View_VolumetricLightmapWorldToUVScale;
+ float PrePadding_View_2876;
+ packed_float3 View_VolumetricLightmapWorldToUVAdd;
+ float PrePadding_View_2892;
+ packed_float3 View_VolumetricLightmapIndirectionTextureSize;
+ float View_VolumetricLightmapBrickSize;
+ packed_float3 View_VolumetricLightmapBrickTexelSize;
+ float View_StereoIPD;
+ float View_IndirectLightingCacheShowFlag;
+ float View_EyeToPixelSpreadAngle;
+};
+
+struct type_MobileDirectionalLight
+{
+ float4 MobileDirectionalLight_DirectionalLightColor;
+ float4 MobileDirectionalLight_DirectionalLightDirectionAndShadowTransition;
+ float4 MobileDirectionalLight_DirectionalLightShadowSize;
+ float4 MobileDirectionalLight_DirectionalLightDistanceFadeMAD;
+ float4 MobileDirectionalLight_DirectionalLightShadowDistances;
+ float4x4 MobileDirectionalLight_DirectionalLightScreenToShadow[4];
+};
+
+struct type_Globals
+{
+ int NumDynamicPointLights;
+ float4 LightPositionAndInvRadius[4];
+ float4 LightColorAndFalloffExponent[4];
+ float4 MobileReflectionParams;
+};
+
+constant float3 _136 = {};
+constant float4 _137 = {};
+constant float _138 = {};
+constant float3 _573 = {};
+
+struct main0_out
+{
+ float4 out_var_SV_Target0 [[color(0)]];
+};
+
+struct main0_in
+{
+ float2 in_var_TEXCOORD0 [[user(locn0)]];
+ float4 in_var_TEXCOORD7 [[user(locn1)]];
+ float4 in_var_TEXCOORD8 [[user(locn2)]];
+};
+
+fragment main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_MobileDirectionalLight& MobileDirectionalLight [[buffer(1)]], constant type_Globals& _Globals [[buffer(2)]], texture2d<float> MobileDirectionalLight_DirectionalLightShadowTexture [[texture(0)]], texture2d<float> Material_Texture2D_0 [[texture(1)]], texture2d<float> Material_Texture2D_1 [[texture(2)]], texturecube<float> ReflectionCubemap [[texture(3)]], sampler MobileDirectionalLight_DirectionalLightShadowSampler [[sampler(0)]], sampler Material_Texture2D_0Sampler [[sampler(1)]], sampler Material_Texture2D_1Sampler [[sampler(2)]], sampler ReflectionCubemapSampler [[sampler(3)]], float4 gl_FragCoord [[position]], bool gl_FrontFacing [[front_facing]])
+{
+ main0_out out = {};
+ float4 _177 = float4((((gl_FragCoord.xy - View.View_ViewRectMin.xy) * View.View_ViewSizeAndInvSize.zw) - float2(0.5)) * float2(2.0, -2.0), _138, 1.0) * float4(gl_FragCoord.w);
+ float3 _181 = normalize(-in.in_var_TEXCOORD8.xyz);
+ float2 _190 = (Material_Texture2D_0.sample(Material_Texture2D_0Sampler, (in.in_var_TEXCOORD0 * float2(10.0))).xy * float2(2.0)) - float2(1.0);
+ float3 _206 = normalize(float3x3(float3(1.0, 0.0, 0.0), float3(0.0, 1.0, 0.0), float3(0.0, 0.0, 1.0)) * (((float4(_190, sqrt(fast::clamp(1.0 - dot(_190, _190), 0.0, 1.0)), 1.0).xyz * float3(0.300000011920928955078125, 0.300000011920928955078125, 1.0)) * float3(View.View_NormalOverrideParameter.w)) + View.View_NormalOverrideParameter.xyz));
+ float _208 = dot(_206, _181);
+ float _219 = mix(0.4000000059604644775390625, 1.0, Material_Texture2D_1.sample(Material_Texture2D_1Sampler, (in.in_var_TEXCOORD0 * float2(20.0))).x);
+ float4 _223 = Material_Texture2D_1.sample(Material_Texture2D_1Sampler, (in.in_var_TEXCOORD0 * float2(5.0)));
+ float _224 = _177.w;
+ float _228 = fast::min(fast::max((_224 - 24.0) * 0.000666666659526526927947998046875, 0.0), 1.0);
+ float _229 = _223.y;
+ float4 _233 = Material_Texture2D_1.sample(Material_Texture2D_1Sampler, (in.in_var_TEXCOORD0 * float2(0.5)));
+ float _235 = _233.y;
+ float _253 = fast::clamp((fast::min(fast::max(mix(0.0, 0.5, _235) + mix(mix(0.699999988079071044921875, 1.0, _229), 1.0, _228), 0.0), 1.0) * View.View_RoughnessOverrideParameter.y) + View.View_RoughnessOverrideParameter.x, 0.119999997317790985107421875, 1.0);
+ float2 _257 = (float2(_253) * float2(-1.0, -0.0274999998509883880615234375)) + float2(1.0, 0.0425000004470348358154296875);
+ float _258 = _257.x;
+ float3 _270 = (fast::clamp(float3(mix(_219, 1.0 - _219, mix(_229, 1.0, _228)) * (mix(0.2949999868869781494140625, 0.660000026226043701171875, mix(_235 + mix(_229, 0.0, _228), 0.5, 0.5)) * 0.5)), float3(0.0), float3(1.0)) * float3(View.View_DiffuseOverrideParameter.w)) + View.View_DiffuseOverrideParameter.xyz;
+ float3 _275 = float3(((fast::min(_258 * _258, exp2((-9.27999973297119140625) * fast::max(_208, 0.0))) * _258) + _257.y) * View.View_SpecularOverrideParameter.w) + View.View_SpecularOverrideParameter.xyz;
+ float _276 = _275.x;
+ float4 _303;
+ int _286 = 0;
+ for (;;)
+ {
+ if (_286 < 2)
+ {
+ if (_224 < MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowDistances[uint(_286)])
+ {
+ _303 = MobileDirectionalLight.MobileDirectionalLight_DirectionalLightScreenToShadow[_286] * float4(_177.xy, _224, 1.0);
+ break;
+ }
+ else
+ {
+ _286++;
+ continue;
+ }
+ _286++;
+ continue;
+ }
+ else
+ {
+ _303 = float4(0.0);
+ break;
+ }
+ }
+ float _423;
+ if (_303.z > 0.0)
+ {
+ float2 _311 = _303.xy * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.xy;
+ float2 _312 = fract(_311);
+ float2 _313 = floor(_311);
+ float3 _320 = _573;
+ _320.x = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(-0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x;
+ float3 _326 = _320;
+ _326.y = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(0.5, -0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x;
+ float3 _332 = _326;
+ _332.z = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(1.5, -0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x;
+ float3 _335 = float3(MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDirectionAndShadowTransition.w);
+ float3 _337 = float3((fast::min(_303.z, 0.999989986419677734375) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDirectionAndShadowTransition.w) - 1.0);
+ float3 _339 = fast::clamp((_332 * _335) - _337, float3(0.0), float3(1.0));
+ float3 _345 = _573;
+ _345.x = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(-0.5, 0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x;
+ float3 _351 = _345;
+ _351.y = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x;
+ float3 _357 = _351;
+ _357.z = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(1.5, 0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x;
+ float3 _360 = fast::clamp((_357 * _335) - _337, float3(0.0), float3(1.0));
+ float3 _366 = _573;
+ _366.x = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(-0.5, 1.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x;
+ float3 _372 = _366;
+ _372.y = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(0.5, 1.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x;
+ float3 _378 = _372;
+ _378.z = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(1.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x;
+ float3 _381 = fast::clamp((_378 * _335) - _337, float3(0.0), float3(1.0));
+ float _383 = _312.x;
+ float _384 = 1.0 - _383;
+ float3 _399 = _136;
+ _399.x = ((_339.x * _384) + _339.y) + (_339.z * _383);
+ float3 _403 = _399;
+ _403.y = ((_360.x * _384) + _360.y) + (_360.z * _383);
+ float3 _407 = _403;
+ _407.z = ((_381.x * _384) + _381.y) + (_381.z * _383);
+ float _408 = _312.y;
+ float _420 = fast::clamp((_224 * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDistanceFadeMAD.x) + MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDistanceFadeMAD.y, 0.0, 1.0);
+ _423 = mix(fast::clamp(0.25 * dot(_407, float3(1.0 - _408, 1.0, _408)), 0.0, 1.0), 1.0, _420 * _420);
+ }
+ else
+ {
+ _423 = 1.0;
+ }
+ float3 _429 = normalize(_181 + MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDirectionAndShadowTransition.xyz);
+ float _432 = _423 * fast::max(0.0, dot(_206, MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDirectionAndShadowTransition.xyz));
+ float _439 = (_253 * 0.25) + 0.25;
+ float3 _440 = cross(_206, _429);
+ float _442 = _253 * _253;
+ float _443 = fast::max(0.0, dot(_206, _429)) * _442;
+ float _446 = _442 / (dot(_440, _440) + (_443 * _443));
+ bool _458 = float(_Globals.MobileReflectionParams.w > 0.0) != 0.0;
+ float4 _468 = ReflectionCubemap.sample(ReflectionCubemapSampler, ((-_181) + ((_206 * float3(_208)) * float3(2.0))), level(((_458 ? _Globals.MobileReflectionParams.w : View.View_ReflectionCubemapMaxMip) - 1.0) - (1.0 - (1.2000000476837158203125 * log2(_253)))));
+ float3 _481;
+ if (_458)
+ {
+ _481 = _468.xyz * View.View_SkyLightColor.xyz;
+ }
+ else
+ {
+ float3 _476 = _468.xyz * float3(_468.w * 16.0);
+ _481 = _476 * _476;
+ }
+ float3 _484 = float3(_276);
+ float3 _488;
+ _488 = ((float3(_432) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightColor.xyz) * (_270 + float3(_276 * (_439 * fast::min(_446 * _446, 65504.0))))) + ((_481 * float3(fast::clamp(1.0, 0.0, 1.0))) * _484);
+ float _537;
+ int _491 = 0;
+ for (;;)
+ {
+ if (_491 < _Globals.NumDynamicPointLights)
+ {
+ float3 _501 = _Globals.LightPositionAndInvRadius[_491].xyz - (in.in_var_TEXCOORD8.xyz - float3(View.View_PreViewTranslation));
+ float _502 = dot(_501, _501);
+ float3 _505 = _501 * float3(rsqrt(_502));
+ float3 _507 = normalize(_181 + _505);
+ if (_Globals.LightColorAndFalloffExponent[_491].w == 0.0)
+ {
+ float _531 = _502 * (_Globals.LightPositionAndInvRadius[_491].w * _Globals.LightPositionAndInvRadius[_491].w);
+ float _534 = fast::clamp(1.0 - (_531 * _531), 0.0, 1.0);
+ _537 = (1.0 / (_502 + 1.0)) * (_534 * _534);
+ float3 _544 = cross(_206, _507);
+ float _546 = fast::max(0.0, dot(_206, _507)) * _442;
+ float _549 = _442 / (dot(_544, _544) + (_546 * _546));
+ _488 += fast::min(float3(65000.0), ((float3(_537 * fast::max(0.0, dot(_206, _505))) * _Globals.LightColorAndFalloffExponent[_491].xyz) * float3(0.3183098733425140380859375)) * (_270 + float3(_276 * (_439 * fast::min(_549 * _549, 65504.0)))));
+ _491++;
+ continue;
+ }
+ else
+ {
+ float3 _521 = _501 * float3(_Globals.LightPositionAndInvRadius[_491].w);
+ _537 = pow(1.0 - fast::clamp(dot(_521, _521), 0.0, 1.0), _Globals.LightColorAndFalloffExponent[_491].w);
+ float3 _544 = cross(_206, _507);
+ float _546 = fast::max(0.0, dot(_206, _507)) * _442;
+ float _549 = _442 / (dot(_544, _544) + (_546 * _546));
+ _488 += fast::min(float3(65000.0), ((float3(_537 * fast::max(0.0, dot(_206, _505))) * _Globals.LightColorAndFalloffExponent[_491].xyz) * float3(0.3183098733425140380859375)) * (_270 + float3(_276 * (_439 * fast::min(_549 * _549, 65504.0)))));
+ _491++;
+ continue;
+ }
+ float3 _544 = cross(_206, _507);
+ float _546 = fast::max(0.0, dot(_206, _507)) * _442;
+ float _549 = _442 / (dot(_544, _544) + (_546 * _546));
+ _488 += fast::min(float3(65000.0), ((float3(_537 * fast::max(0.0, dot(_206, _505))) * _Globals.LightColorAndFalloffExponent[_491].xyz) * float3(0.3183098733425140380859375)) * (_270 + float3(_276 * (_439 * fast::min(_549 * _549, 65504.0)))));
+ _491++;
+ continue;
+ }
+ else
+ {
+ break;
+ }
+ }
+ float3 _567 = (mix(_488 + fast::max(float3(0.0), float3(0.0)), _270 + _484, float3(View.View_UnlitViewmodeMask)) * float3(in.in_var_TEXCOORD7.w)) + in.in_var_TEXCOORD7.xyz;
+ float4 _571 = float4(_567.x, _567.y, _567.z, _137.w);
+ _571.w = fast::min(in.in_var_TEXCOORD8.w, 65500.0);
+ out.out_var_SV_Target0 = _571;
+ return out;
+}
+
diff --git a/reference/opt/shaders-msl/asm/ue4/array_template_examples/array_missing_copies/MobileBasePassVertexShader.dxc.asm.vert b/reference/opt/shaders-msl/asm/ue4/array_template_examples/array_missing_copies/MobileBasePassVertexShader.dxc.asm.vert
new file mode 100644
index 00000000..b1e6c20b
--- /dev/null
+++ b/reference/opt/shaders-msl/asm/ue4/array_template_examples/array_missing_copies/MobileBasePassVertexShader.dxc.asm.vert
@@ -0,0 +1,464 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct type_View
+{
+ float4x4 View_TranslatedWorldToClip;
+ float4x4 View_WorldToClip;
+ float4x4 View_TranslatedWorldToView;
+ float4x4 View_ViewToTranslatedWorld;
+ float4x4 View_TranslatedWorldToCameraView;
+ float4x4 View_CameraViewToTranslatedWorld;
+ float4x4 View_ViewToClip;
+ float4x4 View_ViewToClipNoAA;
+ float4x4 View_ClipToView;
+ float4x4 View_ClipToTranslatedWorld;
+ float4x4 View_SVPositionToTranslatedWorld;
+ float4x4 View_ScreenToWorld;
+ float4x4 View_ScreenToTranslatedWorld;
+ packed_float3 View_ViewForward;
+ float PrePadding_View_844;
+ packed_float3 View_ViewUp;
+ float PrePadding_View_860;
+ packed_float3 View_ViewRight;
+ float PrePadding_View_876;
+ packed_float3 View_HMDViewNoRollUp;
+ float PrePadding_View_892;
+ packed_float3 View_HMDViewNoRollRight;
+ float PrePadding_View_908;
+ float4 View_InvDeviceZToWorldZTransform;
+ float4 View_ScreenPositionScaleBias;
+ packed_float3 View_WorldCameraOrigin;
+ float PrePadding_View_956;
+ packed_float3 View_TranslatedWorldCameraOrigin;
+ float PrePadding_View_972;
+ packed_float3 View_WorldViewOrigin;
+ float PrePadding_View_988;
+ packed_float3 View_PreViewTranslation;
+ float PrePadding_View_1004;
+ float4x4 View_PrevProjection;
+ float4x4 View_PrevViewProj;
+ float4x4 View_PrevViewRotationProj;
+ float4x4 View_PrevViewToClip;
+ float4x4 View_PrevClipToView;
+ float4x4 View_PrevTranslatedWorldToClip;
+ float4x4 View_PrevTranslatedWorldToView;
+ float4x4 View_PrevViewToTranslatedWorld;
+ float4x4 View_PrevTranslatedWorldToCameraView;
+ float4x4 View_PrevCameraViewToTranslatedWorld;
+ packed_float3 View_PrevWorldCameraOrigin;
+ float PrePadding_View_1660;
+ packed_float3 View_PrevWorldViewOrigin;
+ float PrePadding_View_1676;
+ packed_float3 View_PrevPreViewTranslation;
+ float PrePadding_View_1692;
+ float4x4 View_PrevInvViewProj;
+ float4x4 View_PrevScreenToTranslatedWorld;
+ float4x4 View_ClipToPrevClip;
+ float4 View_TemporalAAJitter;
+ float4 View_GlobalClippingPlane;
+ float2 View_FieldOfViewWideAngles;
+ float2 View_PrevFieldOfViewWideAngles;
+ float4 View_ViewRectMin;
+ float4 View_ViewSizeAndInvSize;
+ float4 View_BufferSizeAndInvSize;
+ float4 View_BufferBilinearUVMinMax;
+ int View_NumSceneColorMSAASamples;
+ float View_PreExposure;
+ float View_OneOverPreExposure;
+ float PrePadding_View_2012;
+ float4 View_DiffuseOverrideParameter;
+ float4 View_SpecularOverrideParameter;
+ float4 View_NormalOverrideParameter;
+ float2 View_RoughnessOverrideParameter;
+ float View_PrevFrameGameTime;
+ float View_PrevFrameRealTime;
+ float View_OutOfBoundsMask;
+ float PrePadding_View_2084;
+ float PrePadding_View_2088;
+ float PrePadding_View_2092;
+ packed_float3 View_WorldCameraMovementSinceLastFrame;
+ float View_CullingSign;
+ float View_NearPlane;
+ float View_AdaptiveTessellationFactor;
+ float View_GameTime;
+ float View_RealTime;
+ float View_DeltaTime;
+ float View_MaterialTextureMipBias;
+ float View_MaterialTextureDerivativeMultiply;
+ uint View_Random;
+ uint View_FrameNumber;
+ uint View_StateFrameIndexMod8;
+ uint View_StateFrameIndex;
+ float View_CameraCut;
+ float View_UnlitViewmodeMask;
+ float PrePadding_View_2164;
+ float PrePadding_View_2168;
+ float PrePadding_View_2172;
+ float4 View_DirectionalLightColor;
+ packed_float3 View_DirectionalLightDirection;
+ float PrePadding_View_2204;
+ float4 View_TranslucencyLightingVolumeMin[2];
+ float4 View_TranslucencyLightingVolumeInvSize[2];
+ float4 View_TemporalAAParams;
+ float4 View_CircleDOFParams;
+ float View_DepthOfFieldSensorWidth;
+ float View_DepthOfFieldFocalDistance;
+ float View_DepthOfFieldScale;
+ float View_DepthOfFieldFocalLength;
+ float View_DepthOfFieldFocalRegion;
+ float View_DepthOfFieldNearTransitionRegion;
+ float View_DepthOfFieldFarTransitionRegion;
+ float View_MotionBlurNormalizedToPixel;
+ float View_bSubsurfacePostprocessEnabled;
+ float View_GeneralPurposeTweak;
+ float View_DemosaicVposOffset;
+ float PrePadding_View_2348;
+ packed_float3 View_IndirectLightingColorScale;
+ float View_HDR32bppEncodingMode;
+ packed_float3 View_AtmosphericFogSunDirection;
+ float View_AtmosphericFogSunPower;
+ float View_AtmosphericFogPower;
+ float View_AtmosphericFogDensityScale;
+ float View_AtmosphericFogDensityOffset;
+ float View_AtmosphericFogGroundOffset;
+ float View_AtmosphericFogDistanceScale;
+ float View_AtmosphericFogAltitudeScale;
+ float View_AtmosphericFogHeightScaleRayleigh;
+ float View_AtmosphericFogStartDistance;
+ float View_AtmosphericFogDistanceOffset;
+ float View_AtmosphericFogSunDiscScale;
+ uint View_AtmosphericFogRenderMask;
+ uint View_AtmosphericFogInscatterAltitudeSampleNum;
+ float4 View_AtmosphericFogSunColor;
+ packed_float3 View_NormalCurvatureToRoughnessScaleBias;
+ float View_RenderingReflectionCaptureMask;
+ float4 View_AmbientCubemapTint;
+ float View_AmbientCubemapIntensity;
+ float View_SkyLightParameters;
+ float PrePadding_View_2488;
+ float PrePadding_View_2492;
+ float4 View_SkyLightColor;
+ float4 View_SkyIrradianceEnvironmentMap[7];
+ float View_MobilePreviewMode;
+ float View_HMDEyePaddingOffset;
+ float View_ReflectionCubemapMaxMip;
+ float View_ShowDecalsMask;
+ uint View_DistanceFieldAOSpecularOcclusionMode;
+ float View_IndirectCapsuleSelfShadowingIntensity;
+ float PrePadding_View_2648;
+ float PrePadding_View_2652;
+ packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
+ int View_StereoPassIndex;
+ float4 View_GlobalVolumeCenterAndExtent[4];
+ float4 View_GlobalVolumeWorldToUVAddAndMul[4];
+ float View_GlobalVolumeDimension;
+ float View_GlobalVolumeTexelSize;
+ float View_MaxGlobalDistance;
+ float View_bCheckerboardSubsurfaceProfileRendering;
+ packed_float3 View_VolumetricFogInvGridSize;
+ float PrePadding_View_2828;
+ packed_float3 View_VolumetricFogGridZParams;
+ float PrePadding_View_2844;
+ float2 View_VolumetricFogSVPosToVolumeUV;
+ float View_VolumetricFogMaxDistance;
+ float PrePadding_View_2860;
+ packed_float3 View_VolumetricLightmapWorldToUVScale;
+ float PrePadding_View_2876;
+ packed_float3 View_VolumetricLightmapWorldToUVAdd;
+ float PrePadding_View_2892;
+ packed_float3 View_VolumetricLightmapIndirectionTextureSize;
+ float View_VolumetricLightmapBrickSize;
+ packed_float3 View_VolumetricLightmapBrickTexelSize;
+ float View_StereoIPD;
+ float View_IndirectLightingCacheShowFlag;
+ float View_EyeToPixelSpreadAngle;
+};
+
+struct type_MobileBasePass
+{
+ float4 MobileBasePass_Fog_ExponentialFogParameters;
+ float4 MobileBasePass_Fog_ExponentialFogParameters2;
+ float4 MobileBasePass_Fog_ExponentialFogColorParameter;
+ float4 MobileBasePass_Fog_ExponentialFogParameters3;
+ float4 MobileBasePass_Fog_InscatteringLightDirection;
+ float4 MobileBasePass_Fog_DirectionalInscatteringColor;
+ float2 MobileBasePass_Fog_SinCosInscatteringColorCubemapRotation;
+ float PrePadding_MobileBasePass_Fog_104;
+ float PrePadding_MobileBasePass_Fog_108;
+ packed_float3 MobileBasePass_Fog_FogInscatteringTextureParameters;
+ float MobileBasePass_Fog_ApplyVolumetricFog;
+ float PrePadding_MobileBasePass_PlanarReflection_128;
+ float PrePadding_MobileBasePass_PlanarReflection_132;
+ float PrePadding_MobileBasePass_PlanarReflection_136;
+ float PrePadding_MobileBasePass_PlanarReflection_140;
+ float PrePadding_MobileBasePass_PlanarReflection_144;
+ float PrePadding_MobileBasePass_PlanarReflection_148;
+ float PrePadding_MobileBasePass_PlanarReflection_152;
+ float PrePadding_MobileBasePass_PlanarReflection_156;
+ float4 MobileBasePass_PlanarReflection_ReflectionPlane;
+ float4 MobileBasePass_PlanarReflection_PlanarReflectionOrigin;
+ float4 MobileBasePass_PlanarReflection_PlanarReflectionXAxis;
+ float4 MobileBasePass_PlanarReflection_PlanarReflectionYAxis;
+ float3x4 MobileBasePass_PlanarReflection_InverseTransposeMirrorMatrix;
+ packed_float3 MobileBasePass_PlanarReflection_PlanarReflectionParameters;
+ float PrePadding_MobileBasePass_PlanarReflection_284;
+ float2 MobileBasePass_PlanarReflection_PlanarReflectionParameters2;
+ float PrePadding_MobileBasePass_PlanarReflection_296;
+ float PrePadding_MobileBasePass_PlanarReflection_300;
+ float4x4 MobileBasePass_PlanarReflection_ProjectionWithExtraFOV[2];
+ float4 MobileBasePass_PlanarReflection_PlanarReflectionScreenScaleBias[2];
+ float2 MobileBasePass_PlanarReflection_PlanarReflectionScreenBound;
+ uint MobileBasePass_PlanarReflection_bIsStereo;
+};
+
+struct type_Primitive
+{
+ float4x4 Primitive_LocalToWorld;
+ float4 Primitive_InvNonUniformScaleAndDeterminantSign;
+ float4 Primitive_ObjectWorldPositionAndRadius;
+ float4x4 Primitive_WorldToLocal;
+ float4x4 Primitive_PreviousLocalToWorld;
+ float4x4 Primitive_PreviousWorldToLocal;
+ packed_float3 Primitive_ActorWorldPosition;
+ float Primitive_UseSingleSampleShadowFromStationaryLights;
+ packed_float3 Primitive_ObjectBounds;
+ float Primitive_LpvBiasMultiplier;
+ float Primitive_DecalReceiverMask;
+ float Primitive_PerObjectGBufferData;
+ float Primitive_UseVolumetricLightmapShadowFromStationaryLights;
+ float Primitive_UseEditorDepthTest;
+ float4 Primitive_ObjectOrientation;
+ float4 Primitive_NonUniformScale;
+ packed_float3 Primitive_LocalObjectBoundsMin;
+ float PrePadding_Primitive_380;
+ packed_float3 Primitive_LocalObjectBoundsMax;
+ uint Primitive_LightingChannelMask;
+ uint Primitive_LightmapDataIndex;
+ int Primitive_SingleCaptureIndex;
+};
+
+struct type_LandscapeParameters
+{
+ float4 LandscapeParameters_HeightmapUVScaleBias;
+ float4 LandscapeParameters_WeightmapUVScaleBias;
+ float4 LandscapeParameters_LandscapeLightmapScaleBias;
+ float4 LandscapeParameters_SubsectionSizeVertsLayerUVPan;
+ float4 LandscapeParameters_SubsectionOffsetParams;
+ float4 LandscapeParameters_LightmapSubsectionOffsetParams;
+ float4x4 LandscapeParameters_LocalToWorldNoScaling;
+};
+
+struct type_Globals
+{
+ float4 LodBias;
+ float4 LodValues;
+ float4 SectionLods;
+ float4 NeighborSectionLod[4];
+};
+
+struct main0_out
+{
+ float2 out_var_TEXCOORD0 [[user(locn0)]];
+ float2 out_var_TEXCOORD1 [[user(locn1)]];
+ float4 out_var_TEXCOORD2 [[user(locn2)]];
+ float4 out_var_TEXCOORD3 [[user(locn3)]];
+ float4 out_var_TEXCOORD8 [[user(locn4)]];
+ float4 gl_Position [[position]];
+};
+
+struct main0_in
+{
+ float4 in_var_ATTRIBUTE0 [[attribute(0)]];
+ float4 in_var_ATTRIBUTE1_0 [[attribute(1)]];
+ float4 in_var_ATTRIBUTE1_1 [[attribute(2)]];
+};
+
+// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment.
+template<typename T, uint N>
+void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N])
+{
+ for (uint i = 0; i < N; dst[i] = src[i], i++);
+}
+
+template<typename T, uint N>
+void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N])
+{
+ for (uint i = 0; i < N; dst[i] = src[i], i++);
+}
+
+vertex main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_MobileBasePass& MobileBasePass [[buffer(1)]], constant type_Primitive& Primitive [[buffer(2)]], constant type_LandscapeParameters& LandscapeParameters [[buffer(3)]], constant type_Globals& _Globals [[buffer(4)]])
+{
+ main0_out out = {};
+ float4 in_var_ATTRIBUTE1[2] = {};
+ in_var_ATTRIBUTE1[0] = in.in_var_ATTRIBUTE1_0;
+ in_var_ATTRIBUTE1[1] = in.in_var_ATTRIBUTE1_1;
+ float4 _99[2];
+ spvArrayCopyFromStack1(_99, in_var_ATTRIBUTE1);
+ float4 _97[1];
+ for (int _107 = 0; _107 < 1; )
+ {
+ _97[_107] = float4(0.0);
+ _107++;
+ continue;
+ }
+ float4 _115 = in.in_var_ATTRIBUTE0 * float4(255.0);
+ float2 _116 = _115.zw;
+ float2 _119 = fract(_116 * float2(0.5)) * float2(2.0);
+ float2 _121 = (_116 - _119) * float2(0.0039215688593685626983642578125);
+ float2 _122 = _115.xy;
+ float2 _126 = _122 * float2(_Globals.LodValues.w);
+ float _127 = _126.y;
+ float _128 = _126.x;
+ float4 _132 = float4(_127, _128, 1.0 - _128, 1.0 - _127) * float4(2.0);
+ float4 _186;
+ if (_119.y > 0.5)
+ {
+ float4 _161;
+ if (_119.x > 0.5)
+ {
+ _161 = (_132 * float4(_Globals.SectionLods.w)) + ((float4(1.0) - _132) * _Globals.NeighborSectionLod[3]);
+ }
+ else
+ {
+ _161 = (_132 * float4(_Globals.SectionLods.z)) + ((float4(1.0) - _132) * _Globals.NeighborSectionLod[2]);
+ }
+ _186 = _161;
+ }
+ else
+ {
+ float4 _185;
+ if (_119.x > 0.5)
+ {
+ _185 = (_132 * float4(_Globals.SectionLods.y)) + ((float4(1.0) - _132) * _Globals.NeighborSectionLod[1]);
+ }
+ else
+ {
+ _185 = (_132 * float4(_Globals.SectionLods.x)) + ((float4(1.0) - _132) * _Globals.NeighborSectionLod[0]);
+ }
+ _186 = _185;
+ }
+ float _206;
+ if ((_128 + _127) > 1.0)
+ {
+ float _198;
+ if (_128 < _127)
+ {
+ _198 = _186.w;
+ }
+ else
+ {
+ _198 = _186.z;
+ }
+ _206 = _198;
+ }
+ else
+ {
+ float _205;
+ if (_128 < _127)
+ {
+ _205 = _186.y;
+ }
+ else
+ {
+ _205 = _186.x;
+ }
+ _206 = _205;
+ }
+ float _207 = floor(_206);
+ float _208 = _206 - _207;
+ float3 _212 = float3(1.0, _99[1].xy);
+ float3 _215 = float3(0.5, _99[1].yz);
+ float3 _218 = float3(0.25, _99[1].zw);
+ float _220 = _121.x;
+ float3 _221 = float3(0.125, _99[1].w, _220);
+ float3 _224 = float3(0.0625, _220, _121.y);
+ float3 _225 = float3(0.03125, _121.yy);
+ bool3 _226 = bool3(_207 < 5.0);
+ float3 _227 = float3(_226.x ? _224.x : _225.x, _226.y ? _224.y : _225.y, _226.z ? _224.z : _225.z);
+ bool3 _228 = bool3(_207 < 4.0);
+ float3 _229 = float3(_228.x ? _221.x : _227.x, _228.y ? _221.y : _227.y, _228.z ? _221.z : _227.z);
+ bool3 _230 = bool3(_207 < 3.0);
+ float3 _231 = float3(_230.x ? _218.x : _229.x, _230.y ? _218.y : _229.y, _230.z ? _218.z : _229.z);
+ bool3 _232 = bool3(_207 < 2.0);
+ float3 _233 = float3(_232.x ? _215.x : _231.x, _232.y ? _215.y : _231.y, _232.z ? _215.z : _231.z);
+ bool3 _234 = bool3(_207 < 1.0);
+ float3 _235 = float3(_234.x ? _212.x : _233.x, _234.y ? _212.y : _233.y, _234.z ? _212.z : _233.z);
+ float _236 = _235.x;
+ float _245 = (((_99[0].x * 65280.0) + (_99[0].y * 255.0)) - 32768.0) * 0.0078125;
+ float _252 = (((_99[0].z * 65280.0) + (_99[0].w * 255.0)) - 32768.0) * 0.0078125;
+ float2 _257 = floor(_122 * float2(_236));
+ float2 _271 = float2((LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.x * _236) - 1.0, fast::max((LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.x * 0.5) * _236, 2.0) - 1.0) * float2(LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.y);
+ float3 _287 = mix(float3(_257 / float2(_271.x), mix(_245, _252, _235.y)), float3(floor(_257 * float2(0.5)) / float2(_271.y), mix(_245, _252, _235.z)), float3(_208));
+ float2 _288 = _119.xy;
+ float2 _292 = _288 * LandscapeParameters.LandscapeParameters_SubsectionOffsetParams.ww;
+ float3 _296 = _287 + float3(_292, 0.0);
+ float4 _322 = float4((((Primitive.Primitive_LocalToWorld[0u].xyz * _296.xxx) + (Primitive.Primitive_LocalToWorld[1u].xyz * _296.yyy)) + (Primitive.Primitive_LocalToWorld[2u].xyz * _296.zzz)) + (Primitive.Primitive_LocalToWorld[3u].xyz + float3(View.View_PreViewTranslation)), 1.0);
+ float2 _323 = _287.xy;
+ float4 _338 = float4(_322.x, _322.y, _322.z, _322.w);
+ float4 _339 = View.View_TranslatedWorldToClip * _338;
+ float3 _341 = _322.xyz - float3(View.View_TranslatedWorldCameraOrigin);
+ float _345 = dot(_341, _341);
+ float _346 = rsqrt(_345);
+ float _347 = _345 * _346;
+ float _354 = _341.z;
+ float _357 = fast::max(0.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.w);
+ float _393;
+ float _394;
+ float _395;
+ float _396;
+ if (_357 > 0.0)
+ {
+ float _361 = _357 * _346;
+ float _362 = _361 * _354;
+ float _365 = View.View_WorldCameraOrigin[2] + _362;
+ _393 = (1.0 - _361) * _347;
+ _394 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.z * exp2(-fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.y * (_365 - MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.w)));
+ _395 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.x * exp2(-fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.y * (_365 - MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.y)));
+ _396 = _354 - _362;
+ }
+ else
+ {
+ _393 = _347;
+ _394 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.x;
+ _395 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.x;
+ _396 = _354;
+ }
+ float _399 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.y * _396;
+ float _400 = fast::max(-127.0, _399);
+ float _405 = log(2.0);
+ float _407 = 0.5 * (_405 * _405);
+ float _413 = _395 * ((abs(_400) > 0.00999999977648258209228515625) ? ((1.0 - exp2(-_400)) / _400) : (_405 - (_407 * _400)));
+ float _416 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.y * _396;
+ float _417 = fast::max(-127.0, _416);
+ float _427 = _394 * ((abs(_417) > 0.00999999977648258209228515625) ? ((1.0 - exp2(-_417)) / _417) : (_405 - (_407 * _417)));
+ float _428 = _413 + _427;
+ float _429 = _428 * _393;
+ float3 _459;
+ if (MobileBasePass.MobileBasePass_Fog_InscatteringLightDirection.w >= 0.0)
+ {
+ _459 = (MobileBasePass.MobileBasePass_Fog_DirectionalInscatteringColor.xyz * float3(pow(fast::clamp(dot(_341 * float3(_346), MobileBasePass.MobileBasePass_Fog_InscatteringLightDirection.xyz), 0.0, 1.0), MobileBasePass.MobileBasePass_Fog_DirectionalInscatteringColor.w))) * float3(1.0 - fast::clamp(exp2(-(_428 * fast::max(_393 - MobileBasePass.MobileBasePass_Fog_InscatteringLightDirection.w, 0.0))), 0.0, 1.0));
+ }
+ else
+ {
+ _459 = float3(0.0);
+ }
+ bool _468 = (MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.w > 0.0) && (_347 > MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.w);
+ bool3 _469 = bool3(_468);
+ float _471 = _468 ? 1.0 : fast::max(fast::clamp(exp2(-_429), 0.0, 1.0), MobileBasePass.MobileBasePass_Fog_ExponentialFogColorParameter.w);
+ _97[0] = float4((MobileBasePass.MobileBasePass_Fog_ExponentialFogColorParameter.xyz * float3(1.0 - _471)) + float3(_469.x ? float3(0.0).x : _459.x, _469.y ? float3(0.0).y : _459.y, _469.z ? float3(0.0).z : _459.z), _471);
+ float4 _482 = _338;
+ _482.w = _339.w;
+ out.out_var_TEXCOORD0 = ((_323 + LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.zw) + _292).xy;
+ out.out_var_TEXCOORD1 = ((_323 * LandscapeParameters.LandscapeParameters_WeightmapUVScaleBias.xy) + LandscapeParameters.LandscapeParameters_WeightmapUVScaleBias.zw) + (_288 * LandscapeParameters.LandscapeParameters_SubsectionOffsetParams.zz);
+ out.out_var_TEXCOORD2 = float4(float4(0.0).x, float4(0.0).y, _97[0].x, _97[0].y);
+ out.out_var_TEXCOORD3 = float4(float4(0.0).x, float4(0.0).y, _97[0].z, _97[0].w);
+ out.out_var_TEXCOORD8 = _482;
+ out.gl_Position = _339;
+ return out;
+}
+
diff --git a/reference/opt/shaders-msl/asm/ue4/depth_compare/ShadowProjectionPixelShader.dxc.asm.frag b/reference/opt/shaders-msl/asm/ue4/depth_compare/ShadowProjectionPixelShader.dxc.asm.frag
new file mode 100644
index 00000000..eea3912f
--- /dev/null
+++ b/reference/opt/shaders-msl/asm/ue4/depth_compare/ShadowProjectionPixelShader.dxc.asm.frag
@@ -0,0 +1,317 @@
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct type_View
+{
+ float4x4 View_TranslatedWorldToClip;
+ float4x4 View_WorldToClip;
+ float4x4 View_TranslatedWorldToView;
+ float4x4 View_ViewToTranslatedWorld;
+ float4x4 View_TranslatedWorldToCameraView;
+ float4x4 View_CameraViewToTranslatedWorld;
+ float4x4 View_ViewToClip;
+ float4x4 View_ViewToClipNoAA;
+ float4x4 View_ClipToView;
+ float4x4 View_ClipToTranslatedWorld;
+ float4x4 View_SVPositionToTranslatedWorld;
+ float4x4 View_ScreenToWorld;
+ float4x4 View_ScreenToTranslatedWorld;
+ packed_float3 View_ViewForward;
+ float PrePadding_View_844;
+ packed_float3 View_ViewUp;
+ float PrePadding_View_860;
+ packed_float3 View_ViewRight;
+ float PrePadding_View_876;
+ packed_float3 View_HMDViewNoRollUp;
+ float PrePadding_View_892;
+ packed_float3 View_HMDViewNoRollRight;
+ float PrePadding_View_908;
+ float4 View_InvDeviceZToWorldZTransform;
+ float4 View_ScreenPositionScaleBias;
+ packed_float3 View_WorldCameraOrigin;
+ float PrePadding_View_956;
+ packed_float3 View_TranslatedWorldCameraOrigin;
+ float PrePadding_View_972;
+ packed_float3 View_WorldViewOrigin;
+ float PrePadding_View_988;
+ packed_float3 View_PreViewTranslation;
+ float PrePadding_View_1004;
+ float4x4 View_PrevProjection;
+ float4x4 View_PrevViewProj;
+ float4x4 View_PrevViewRotationProj;
+ float4x4 View_PrevViewToClip;
+ float4x4 View_PrevClipToView;
+ float4x4 View_PrevTranslatedWorldToClip;
+ float4x4 View_PrevTranslatedWorldToView;
+ float4x4 View_PrevViewToTranslatedWorld;
+ float4x4 View_PrevTranslatedWorldToCameraView;
+ float4x4 View_PrevCameraViewToTranslatedWorld;
+ packed_float3 View_PrevWorldCameraOrigin;
+ float PrePadding_View_1660;
+ packed_float3 View_PrevWorldViewOrigin;
+ float PrePadding_View_1676;
+ packed_float3 View_PrevPreViewTranslation;
+ float PrePadding_View_1692;
+ float4x4 View_PrevInvViewProj;
+ float4x4 View_PrevScreenToTranslatedWorld;
+ float4x4 View_ClipToPrevClip;
+ float4 View_TemporalAAJitter;
+ float4 View_GlobalClippingPlane;
+ float2 View_FieldOfViewWideAngles;
+ float2 View_PrevFieldOfViewWideAngles;
+ float4 View_ViewRectMin;
+ float4 View_ViewSizeAndInvSize;
+ float4 View_BufferSizeAndInvSize;
+ float4 View_BufferBilinearUVMinMax;
+ int View_NumSceneColorMSAASamples;
+ float View_PreExposure;
+ float View_OneOverPreExposure;
+ float PrePadding_View_2012;
+ float4 View_DiffuseOverrideParameter;
+ float4 View_SpecularOverrideParameter;
+ float4 View_NormalOverrideParameter;
+ float2 View_RoughnessOverrideParameter;
+ float View_PrevFrameGameTime;
+ float View_PrevFrameRealTime;
+ float View_OutOfBoundsMask;
+ float PrePadding_View_2084;
+ float PrePadding_View_2088;
+ float PrePadding_View_2092;
+ packed_float3 View_WorldCameraMovementSinceLastFrame;
+ float View_CullingSign;
+ float View_NearPlane;
+ float View_AdaptiveTessellationFactor;
+ float View_GameTime;
+ float View_RealTime;
+ float View_DeltaTime;
+ float View_MaterialTextureMipBias;
+ float View_MaterialTextureDerivativeMultiply;
+ uint View_Random;
+ uint View_FrameNumber;
+ uint View_StateFrameIndexMod8;
+ uint View_StateFrameIndex;
+ float View_CameraCut;
+ float View_UnlitViewmodeMask;
+ float PrePadding_View_2164;
+ float PrePadding_View_2168;
+ float PrePadding_View_2172;
+ float4 View_DirectionalLightColor;
+ packed_float3 View_DirectionalLightDirection;
+ float PrePadding_View_2204;
+ float4 View_TranslucencyLightingVolumeMin[2];
+ float4 View_TranslucencyLightingVolumeInvSize[2];
+ float4 View_TemporalAAParams;
+ float4 View_CircleDOFParams;
+ float View_DepthOfFieldSensorWidth;
+ float View_DepthOfFieldFocalDistance;
+ float View_DepthOfFieldScale;
+ float View_DepthOfFieldFocalLength;
+ float View_DepthOfFieldFocalRegion;
+ float View_DepthOfFieldNearTransitionRegion;
+ float View_DepthOfFieldFarTransitionRegion;
+ float View_MotionBlurNormalizedToPixel;
+ float View_bSubsurfacePostprocessEnabled;
+ float View_GeneralPurposeTweak;
+ float View_DemosaicVposOffset;
+ float PrePadding_View_2348;
+ packed_float3 View_IndirectLightingColorScale;
+ float View_HDR32bppEncodingMode;
+ packed_float3 View_AtmosphericFogSunDirection;
+ float View_AtmosphericFogSunPower;
+ float View_AtmosphericFogPower;
+ float View_AtmosphericFogDensityScale;
+ float View_AtmosphericFogDensityOffset;
+ float View_AtmosphericFogGroundOffset;
+ float View_AtmosphericFogDistanceScale;
+ float View_AtmosphericFogAltitudeScale;
+ float View_AtmosphericFogHeightScaleRayleigh;
+ float View_AtmosphericFogStartDistance;
+ float View_AtmosphericFogDistanceOffset;
+ float View_AtmosphericFogSunDiscScale;
+ uint View_AtmosphericFogRenderMask;
+ uint View_AtmosphericFogInscatterAltitudeSampleNum;
+ float4 View_AtmosphericFogSunColor;
+ packed_float3 View_NormalCurvatureToRoughnessScaleBias;
+ float View_RenderingReflectionCaptureMask;
+ float4 View_AmbientCubemapTint;
+ float View_AmbientCubemapIntensity;
+ float View_SkyLightParameters;
+ float PrePadding_View_2488;
+ float PrePadding_View_2492;
+ float4 View_SkyLightColor;
+ float4 View_SkyIrradianceEnvironmentMap[7];
+ float View_MobilePreviewMode;
+ float View_HMDEyePaddingOffset;
+ float View_ReflectionCubemapMaxMip;
+ float View_ShowDecalsMask;
+ uint View_DistanceFieldAOSpecularOcclusionMode;
+ float View_IndirectCapsuleSelfShadowingIntensity;
+ float PrePadding_View_2648;
+ float PrePadding_View_2652;
+ packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
+ int View_StereoPassIndex;
+ float4 View_GlobalVolumeCenterAndExtent[4];
+ float4 View_GlobalVolumeWorldToUVAddAndMul[4];
+ float View_GlobalVolumeDimension;
+ float View_GlobalVolumeTexelSize;
+ float View_MaxGlobalDistance;
+ float View_bCheckerboardSubsurfaceProfileRendering;
+ packed_float3 View_VolumetricFogInvGridSize;
+ float PrePadding_View_2828;
+ packed_float3 View_VolumetricFogGridZParams;
+ float PrePadding_View_2844;
+ float2 View_VolumetricFogSVPosToVolumeUV;
+ float View_VolumetricFogMaxDistance;
+ float PrePadding_View_2860;
+ packed_float3 View_VolumetricLightmapWorldToUVScale;
+ float PrePadding_View_2876;
+ packed_float3 View_VolumetricLightmapWorldToUVAdd;
+ float PrePadding_View_2892;
+ packed_float3 View_VolumetricLightmapIndirectionTextureSize;
+ float View_VolumetricLightmapBrickSize;
+ packed_float3 View_VolumetricLightmapBrickTexelSize;
+ float View_StereoIPD;
+ float View_IndirectLightingCacheShowFlag;
+ float View_EyeToPixelSpreadAngle;
+};
+
+struct type_Globals
+{
+ float3 SoftTransitionScale;
+ float4x4 ShadowViewProjectionMatrices[6];
+ float InvShadowmapResolution;
+ float ShadowFadeFraction;
+ float ShadowSharpen;
+ float4 LightPositionAndInvRadius;
+ float2 ProjectionDepthBiasParameters;
+ float4 PointLightDepthBiasAndProjParameters;
+};
+
+constant float4 _453 = {};
+
+struct main0_out
+{
+ float4 out_var_SV_Target0 [[color(0)]];
+};
+
+fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d<float> SceneTexturesStruct_SceneDepthTexture [[texture(0)]], texture2d<float> SceneTexturesStruct_GBufferATexture [[texture(1)]], texture2d<float> SceneTexturesStruct_GBufferBTexture [[texture(2)]], texture2d<float> SceneTexturesStruct_GBufferDTexture [[texture(3)]], depthcube<float> ShadowDepthCubeTexture [[texture(4)]], texture2d<float> SSProfilesTexture [[texture(5)]], sampler SceneTexturesStruct_SceneDepthTextureSampler [[sampler(0)]], sampler SceneTexturesStruct_GBufferATextureSampler [[sampler(1)]], sampler SceneTexturesStruct_GBufferBTextureSampler [[sampler(2)]], sampler SceneTexturesStruct_GBufferDTextureSampler [[sampler(3)]], sampler ShadowDepthTextureSampler [[sampler(4)]], sampler ShadowDepthCubeTextureSampler [[sampler(5)]], float4 gl_FragCoord [[position]])
+{
+ main0_out out = {};
+ float2 _114 = gl_FragCoord.xy * View.View_BufferSizeAndInvSize.zw;
+ float4 _118 = SceneTexturesStruct_SceneDepthTexture.sample(SceneTexturesStruct_SceneDepthTextureSampler, _114, level(0.0));
+ float _119 = _118.x;
+ float _133 = ((_119 * View.View_InvDeviceZToWorldZTransform.x) + View.View_InvDeviceZToWorldZTransform.y) + (1.0 / ((_119 * View.View_InvDeviceZToWorldZTransform.z) - View.View_InvDeviceZToWorldZTransform.w));
+ float4 _147 = View.View_ScreenToWorld * float4(((_114 - View.View_ScreenPositionScaleBias.wz) / View.View_ScreenPositionScaleBias.xy) * float2(_133), _133, 1.0);
+ float3 _148 = _147.xyz;
+ float3 _152 = _Globals.LightPositionAndInvRadius.xyz - _148;
+ float _158 = length(_152);
+ bool _160 = (_158 * _Globals.LightPositionAndInvRadius.w) < 1.0;
+ float _207;
+ if (_160)
+ {
+ float3 _165 = abs(_152);
+ float _166 = _165.x;
+ float _167 = _165.y;
+ float _168 = _165.z;
+ float _170 = fast::max(_166, fast::max(_167, _168));
+ int _189;
+ if (_170 == _166)
+ {
+ _189 = (_166 == _152.x) ? 0 : 1;
+ }
+ else
+ {
+ int _185;
+ if (_170 == _167)
+ {
+ _185 = (_167 == _152.y) ? 2 : 3;
+ }
+ else
+ {
+ _185 = (_168 == _152.z) ? 4 : 5;
+ }
+ _189 = _185;
+ }
+ float4 _196 = _Globals.ShadowViewProjectionMatrices[_189] * float4(_147.xyz, 1.0);
+ float _198 = _196.w;
+ _207 = ShadowDepthCubeTexture.sample_compare(ShadowDepthCubeTextureSampler, (_152 / float3(_158)), (_196.z / _198) + ((-_Globals.PointLightDepthBiasAndProjParameters.x) / _198), level(0.0));
+ }
+ else
+ {
+ _207 = 1.0;
+ }
+ float _208 = _207 - 0.5;
+ float _213 = fast::clamp((_208 * _Globals.ShadowSharpen) + 0.5, 0.0, 1.0);
+ float _218 = sqrt(mix(1.0, _213 * _213, _Globals.ShadowFadeFraction));
+ float4 _219 = _453;
+ _219.z = _218;
+ float4 _232 = SceneTexturesStruct_GBufferDTexture.sample(SceneTexturesStruct_GBufferDTextureSampler, _114, level(0.0));
+ float3 _236 = normalize((SceneTexturesStruct_GBufferATexture.sample(SceneTexturesStruct_GBufferATextureSampler, _114, level(0.0)).xyz * float3(2.0)) - float3(1.0));
+ uint _240 = uint(round(SceneTexturesStruct_GBufferBTexture.sample(SceneTexturesStruct_GBufferBTextureSampler, _114, level(0.0)).w * 255.0));
+ bool4 _246 = bool4(!(((_240 & 4294967280u) & 16u) != 0u));
+ bool _248 = (_240 & 15u) == 5u;
+ float _448;
+ if (_248)
+ {
+ float4 _260 = SSProfilesTexture.read(uint2(int3(1, int(uint((float4(_246.x ? _232.x : float4(0.0).x, _246.y ? _232.y : float4(0.0).y, _246.z ? _232.z : float4(0.0).z, _246.w ? _232.w : float4(0.0).w).x * 255.0) + 0.5)), 0).xy), 0);
+ float _263 = _260.y * 0.5;
+ float _274 = pow(fast::clamp(dot(-(_152 * float3(rsqrt(dot(_152, _152)))), _236), 0.0, 1.0), 1.0);
+ float _445;
+ if (_160)
+ {
+ float3 _278 = _152 / float3(_158);
+ float3 _280 = normalize(cross(_278, float3(0.0, 0.0, 1.0)));
+ float3 _284 = float3(_Globals.InvShadowmapResolution);
+ float3 _285 = _280 * _284;
+ float3 _286 = cross(_280, _278) * _284;
+ float3 _287 = abs(_278);
+ float _288 = _287.x;
+ float _289 = _287.y;
+ float _290 = _287.z;
+ float _292 = fast::max(_288, fast::max(_289, _290));
+ int _311;
+ if (_292 == _288)
+ {
+ _311 = (_288 == _278.x) ? 0 : 1;
+ }
+ else
+ {
+ int _307;
+ if (_292 == _289)
+ {
+ _307 = (_289 == _278.y) ? 2 : 3;
+ }
+ else
+ {
+ _307 = (_290 == _278.z) ? 4 : 5;
+ }
+ _311 = _307;
+ }
+ float4 _318 = _Globals.ShadowViewProjectionMatrices[_311] * float4(_148 - (_236 * float3(_263)), 1.0);
+ float _323 = _260.x * (10.0 / _Globals.LightPositionAndInvRadius.w);
+ float _329 = (1.0 / (((_318.z / _318.w) * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w;
+ float _342 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, (_278 + (_286 * float3(2.5))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323;
+ float _364 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, ((_278 + (_285 * float3(2.3776409626007080078125))) + (_286 * float3(0.77254199981689453125))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323;
+ float _387 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, ((_278 + (_285 * float3(1.46946299076080322265625))) + (_286 * float3(-2.0225429534912109375))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323;
+ float _410 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, ((_278 + (_285 * float3(-1.46946299076080322265625))) + (_286 * float3(-2.02254199981689453125))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323;
+ float _433 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, ((_278 + (_285 * float3(-2.3776409626007080078125))) + (_286 * float3(0.772543013095855712890625))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323;
+ _445 = (((((fast::clamp(abs((_342 > 0.0) ? (_342 + _263) : fast::max(0.0, (_342 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25) + (fast::clamp(abs((_364 > 0.0) ? (_364 + _263) : fast::max(0.0, (_364 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25)) + (fast::clamp(abs((_387 > 0.0) ? (_387 + _263) : fast::max(0.0, (_387 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25)) + (fast::clamp(abs((_410 > 0.0) ? (_410 + _263) : fast::max(0.0, (_410 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25)) + (fast::clamp(abs((_433 > 0.0) ? (_433 + _263) : fast::max(0.0, (_433 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25)) * 0.20000000298023223876953125;
+ }
+ else
+ {
+ _445 = 1.0;
+ }
+ _448 = 1.0 - (_445 * 0.20000000298023223876953125);
+ }
+ else
+ {
+ _448 = 1.0;
+ }
+ float4 _451 = float4(float3(1.0).x, float3(1.0).y, _219.z, float3(1.0).z);
+ _451.w = _248 ? sqrt(_448) : _218;
+ out.out_var_SV_Target0 = _451;
+ return out;
+}
+
diff --git a/reference/opt/shaders-msl/asm/ue4/global_constant_arrays/PostProcessCombineLUTs.dxc.asm.frag b/reference/opt/shaders-msl/asm/ue4/global_constant_arrays/PostProcessCombineLUTs.dxc.asm.frag
new file mode 100644
index 00000000..1c80274d
--- /dev/null
+++ b/reference/opt/shaders-msl/asm/ue4/global_constant_arrays/PostProcessCombineLUTs.dxc.asm.frag
@@ -0,0 +1,1347 @@
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct type_Globals
+{
+ float4 MappingPolynomial;
+ float3 InverseGamma;
+ float4 ColorMatrixR_ColorCurveCd1;
+ float4 ColorMatrixG_ColorCurveCd3Cm3;
+ float4 ColorMatrixB_ColorCurveCm2;
+ float4 ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3;
+ float4 ColorCurve_Ch1_Ch2;
+ float4 ColorShadow_Luma;
+ float4 ColorShadow_Tint1;
+ float4 ColorShadow_Tint2;
+ float FilmSlope;
+ float FilmToe;
+ float FilmShoulder;
+ float FilmBlackClip;
+ float FilmWhiteClip;
+ packed_float3 ColorScale;
+ float4 OverlayColor;
+ float WhiteTemp;
+ float WhiteTint;
+ float4 ColorSaturation;
+ float4 ColorContrast;
+ float4 ColorGamma;
+ float4 ColorGain;
+ float4 ColorOffset;
+ float4 ColorSaturationShadows;
+ float4 ColorContrastShadows;
+ float4 ColorGammaShadows;
+ float4 ColorGainShadows;
+ float4 ColorOffsetShadows;
+ float4 ColorSaturationMidtones;
+ float4 ColorContrastMidtones;
+ float4 ColorGammaMidtones;
+ float4 ColorGainMidtones;
+ float4 ColorOffsetMidtones;
+ float4 ColorSaturationHighlights;
+ float4 ColorContrastHighlights;
+ float4 ColorGammaHighlights;
+ float4 ColorGainHighlights;
+ float4 ColorOffsetHighlights;
+ float ColorCorrectionShadowsMax;
+ float ColorCorrectionHighlightsMin;
+ uint OutputDevice;
+ uint OutputGamut;
+ float BlueCorrection;
+ float ExpandGamut;
+};
+
+constant float _475[6] = { -4.0, -4.0, -3.1573765277862548828125, -0.485249996185302734375, 1.84773242473602294921875, 1.84773242473602294921875 };
+constant float _476[6] = { -0.718548238277435302734375, 2.0810306072235107421875, 3.66812419891357421875, 4.0, 4.0, 4.0 };
+constant float _479[10] = { -4.97062206268310546875, -3.0293781757354736328125, -2.1261999607086181640625, -1.5104999542236328125, -1.0578000545501708984375, -0.4668000042438507080078125, 0.11937999725341796875, 0.7088134288787841796875, 1.2911865711212158203125, 1.2911865711212158203125 };
+constant float _480[10] = { 0.80891323089599609375, 1.19108676910400390625, 1.5683000087738037109375, 1.94830000400543212890625, 2.308300018310546875, 2.63840007781982421875, 2.85949993133544921875, 2.9872608184814453125, 3.0127391815185546875, 3.0127391815185546875 };
+constant float _482[10] = { -2.3010299205780029296875, -2.3010299205780029296875, -1.9312000274658203125, -1.5204999446868896484375, -1.0578000545501708984375, -0.4668000042438507080078125, 0.11937999725341796875, 0.7088134288787841796875, 1.2911865711212158203125, 1.2911865711212158203125 };
+constant float _483[10] = { 0.801995217800140380859375, 1.19800484180450439453125, 1.5943000316619873046875, 1.99730002880096435546875, 2.3782999515533447265625, 2.7683999538421630859375, 3.0515000820159912109375, 3.2746293544769287109375, 3.32743072509765625, 3.32743072509765625 };
+
+constant float3 _391 = {};
+
+struct main0_out
+{
+ float4 out_var_SV_Target0 [[color(0)]];
+};
+
+struct main0_in
+{
+ float2 in_var_TEXCOORD0 [[user(locn0), center_no_perspective]];
+};
+
+fragment main0_out main0(main0_in in [[stage_in]], constant type_Globals& _Globals [[buffer(0)]], float4 gl_FragCoord [[position]], uint gl_Layer [[render_target_array_index]])
+{
+ main0_out out = {};
+ float3x3 _546 = float3x3(float3(0.41245639324188232421875, 0.3575761020183563232421875, 0.180437505245208740234375), float3(0.21267290413379669189453125, 0.715152204036712646484375, 0.072175003588199615478515625), float3(0.01933390088379383087158203125, 0.119191996753215789794921875, 0.950304090976715087890625)) * float3x3(float3(1.01303005218505859375, 0.0061053098179399967193603515625, -0.014971000142395496368408203125), float3(0.0076982299797236919403076171875, 0.99816501140594482421875, -0.005032029934227466583251953125), float3(-0.0028413101099431514739990234375, 0.0046851597726345062255859375, 0.92450702190399169921875));
+ float3x3 _547 = _546 * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125));
+ float3x3 _548 = float3x3(float3(0.662454187870025634765625, 0.1340042054653167724609375, 0.1561876833438873291015625), float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625), float3(-0.0055746496655046939849853515625, 0.0040607335977256298065185546875, 1.01033914089202880859375)) * float3x3(float3(0.98722398281097412109375, -0.0061132698319852352142333984375, 0.01595330052077770233154296875), float3(-0.007598360069096088409423828125, 1.00186002254486083984375, 0.0053300200961530208587646484375), float3(0.003072570078074932098388671875, -0.0050959498621523380279541015625, 1.0816800594329833984375));
+ float3x3 _549 = _548 * float3x3(float3(3.2409698963165283203125, -1.53738319873809814453125, -0.4986107647418975830078125), float3(-0.96924364566802978515625, 1.875967502593994140625, 0.0415550582110881805419921875), float3(0.055630080401897430419921875, -0.2039769589900970458984375, 1.05697154998779296875));
+ float3x3 _550 = float3x3(float3(0.952552378177642822265625, 0.0, 9.3678601842839270830154418945312e-05), float3(0.3439664542675018310546875, 0.728166103363037109375, -0.07213254272937774658203125), float3(0.0, 0.0, 1.00882518291473388671875)) * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125));
+ float3x3 _551 = float3x3(float3(0.662454187870025634765625, 0.1340042054653167724609375, 0.1561876833438873291015625), float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625), float3(-0.0055746496655046939849853515625, 0.0040607335977256298065185546875, 1.01033914089202880859375)) * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625));
+ float3x3 _576;
+ for (;;)
+ {
+ if (_Globals.OutputGamut == 1u)
+ {
+ _576 = _548 * float3x3(float3(2.493396282196044921875, -0.931345880031585693359375, -0.4026944935321807861328125), float3(-0.829486787319183349609375, 1.76265966892242431640625, 0.02362460084259510040283203125), float3(0.0358506999909877777099609375, -0.076182700693607330322265625, 0.957014024257659912109375));
+ break;
+ }
+ else
+ {
+ if (_Globals.OutputGamut == 2u)
+ {
+ _576 = _548 * float3x3(float3(1.71660840511322021484375, -0.3556621074676513671875, -0.253360092639923095703125), float3(-0.666682898998260498046875, 1.61647760868072509765625, 0.01576850004494190216064453125), float3(0.017642199993133544921875, -0.04277630150318145751953125, 0.94222867488861083984375));
+ break;
+ }
+ else
+ {
+ if (_Globals.OutputGamut == 3u)
+ {
+ _576 = float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625));
+ break;
+ }
+ else
+ {
+ if (_Globals.OutputGamut == 4u)
+ {
+ _576 = float3x3(float3(1.0, 0.0, 0.0), float3(0.0, 1.0, 0.0), float3(0.0, 0.0, 1.0));
+ break;
+ }
+ else
+ {
+ _576 = _549;
+ break;
+ }
+ }
+ }
+ }
+ }
+ float3 _577 = float4((in.in_var_TEXCOORD0 - float2(0.015625)) * float2(1.03225803375244140625), float(gl_Layer) * 0.0322580635547637939453125, 0.0).xyz;
+ float3 _599;
+ if (_Globals.OutputDevice >= 3u)
+ {
+ float3 _591 = pow(_577, float3(0.0126833133399486541748046875));
+ _599 = pow(fast::max(float3(0.0), _591 - float3(0.8359375)) / (float3(18.8515625) - (float3(18.6875) * _591)), float3(6.277394771575927734375)) * float3(10000.0);
+ }
+ else
+ {
+ _599 = (exp2((_577 - float3(0.434017598628997802734375)) * float3(14.0)) * float3(0.180000007152557373046875)) - (exp2(float3(-6.0762462615966796875)) * float3(0.180000007152557373046875));
+ }
+ float _602 = _Globals.WhiteTemp * 1.00055634975433349609375;
+ float _616 = (_602 <= 7000.0) ? (0.24406300485134124755859375 + ((99.1100006103515625 + ((2967800.0 - (4604438528.0 / _Globals.WhiteTemp)) / _602)) / _602)) : (0.23703999817371368408203125 + ((247.4799957275390625 + ((1901800.0 - (2005284352.0 / _Globals.WhiteTemp)) / _602)) / _602));
+ float2 _622 = float2(_616, ((((-3.0) * _616) * _616) + (2.86999988555908203125 * _616)) - 0.2750000059604644775390625);
+ float _633 = ((0.860117733478546142578125 + (0.00015411825734190642833709716796875 * _Globals.WhiteTemp)) + ((1.2864121856637211749330163002014e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp)) / ((1.0 + (0.0008424202096648514270782470703125 * _Globals.WhiteTemp)) + ((7.0814513719597016461193561553955e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp));
+ float _644 = ((0.317398726940155029296875 + (4.2280626075807958841323852539062e-05 * _Globals.WhiteTemp)) + ((4.2048167614439080352894961833954e-08 * _Globals.WhiteTemp) * _Globals.WhiteTemp)) / ((1.0 - (2.8974181986995972692966461181641e-05 * _Globals.WhiteTemp)) + ((1.6145605741257895715534687042236e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp));
+ float _649 = ((2.0 * _633) - (8.0 * _644)) + 4.0;
+ float2 _653 = float2((3.0 * _633) / _649, (2.0 * _644) / _649);
+ bool2 _655 = bool2(_Globals.WhiteTemp < 4000.0);
+ float2 _660 = normalize(float2(_633, _644));
+ float _665 = _633 + (((-_660.y) * _Globals.WhiteTint) * 0.0500000007450580596923828125);
+ float _669 = _644 + ((_660.x * _Globals.WhiteTint) * 0.0500000007450580596923828125);
+ float _674 = ((2.0 * _665) - (8.0 * _669)) + 4.0;
+ float2 _680 = float2(_655.x ? _653.x : _622.x, _655.y ? _653.y : _622.y) + (float2((3.0 * _665) / _674, (2.0 * _669) / _674) - _653);
+ float _681 = _680.x;
+ float _682 = _680.y;
+ float _683 = fast::max(_682, 1.0000000133514319600180897396058e-10);
+ float3 _685 = _391;
+ _685.x = _681 / _683;
+ float3 _686 = _685;
+ _686.y = 1.0;
+ float3 _690 = _686;
+ _690.z = ((1.0 - _681) - _682) / _683;
+ float _691 = fast::max(0.328999996185302734375, 1.0000000133514319600180897396058e-10);
+ float3 _693 = _391;
+ _693.x = 0.3127000033855438232421875 / _691;
+ float3 _694 = _693;
+ _694.y = 1.0;
+ float3 _696 = _694;
+ _696.z = 0.3582999706268310546875 / _691;
+ float3 _697 = _690 * float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875));
+ float3 _698 = _696 * float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875));
+ float3 _716 = _599 * ((float3x3(float3(0.41245639324188232421875, 0.3575761020183563232421875, 0.180437505245208740234375), float3(0.21267290413379669189453125, 0.715152204036712646484375, 0.072175003588199615478515625), float3(0.01933390088379383087158203125, 0.119191996753215789794921875, 0.950304090976715087890625)) * ((float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875)) * float3x3(float3(_698.x / _697.x, 0.0, 0.0), float3(0.0, _698.y / _697.y, 0.0), float3(0.0, 0.0, _698.z / _697.z))) * float3x3(float3(0.986992895603179931640625, -0.14705429971218109130859375, 0.15996269881725311279296875), float3(0.4323053061962127685546875, 0.518360316753387451171875, 0.049291200935840606689453125), float3(-0.00852870009839534759521484375, 0.0400427989661693572998046875, 0.968486726284027099609375)))) * float3x3(float3(3.2409698963165283203125, -1.53738319873809814453125, -0.4986107647418975830078125), float3(-0.96924364566802978515625, 1.875967502593994140625, 0.0415550582110881805419921875), float3(0.055630080401897430419921875, -0.2039769589900970458984375, 1.05697154998779296875)));
+ float3 _717 = _716 * _547;
+ float3 _745;
+ if (_Globals.ColorShadow_Tint2.w != 0.0)
+ {
+ float _724 = dot(_717, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625));
+ float3 _727 = (_717 / float3(_724)) - float3(1.0);
+ _745 = mix(_717, _717 * (_549 * (float3x3(float3(0.544169127941131591796875, 0.23959259688854217529296875, 0.16669429838657379150390625), float3(0.23946559429168701171875, 0.702153027057647705078125, 0.058381401002407073974609375), float3(-0.0023439000360667705535888671875, 0.0361833982169628143310546875, 1.05521833896636962890625)) * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125)))), float3((1.0 - exp2((-4.0) * dot(_727, _727))) * (1.0 - exp2((((-4.0) * _Globals.ExpandGamut) * _724) * _724))));
+ }
+ else
+ {
+ _745 = _717;
+ }
+ float _746 = dot(_745, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625));
+ float4 _751 = _Globals.ColorSaturationShadows * _Globals.ColorSaturation;
+ float4 _756 = _Globals.ColorContrastShadows * _Globals.ColorContrast;
+ float4 _761 = _Globals.ColorGammaShadows * _Globals.ColorGamma;
+ float4 _766 = _Globals.ColorGainShadows * _Globals.ColorGain;
+ float4 _771 = _Globals.ColorOffsetShadows + _Globals.ColorOffset;
+ float3 _772 = float3(_746);
+ float3 _777 = mix(_772, _745, _751.xyz * float3(_751.w));
+ float _804 = smoothstep(0.0, _Globals.ColorCorrectionShadowsMax, _746);
+ float4 _808 = _Globals.ColorSaturationHighlights * _Globals.ColorSaturation;
+ float4 _811 = _Globals.ColorContrastHighlights * _Globals.ColorContrast;
+ float4 _814 = _Globals.ColorGammaHighlights * _Globals.ColorGamma;
+ float4 _817 = _Globals.ColorGainHighlights * _Globals.ColorGain;
+ float4 _820 = _Globals.ColorOffsetHighlights + _Globals.ColorOffset;
+ float3 _825 = mix(_772, _745, _808.xyz * float3(_808.w));
+ float _852 = smoothstep(_Globals.ColorCorrectionHighlightsMin, 1.0, _746);
+ float4 _855 = _Globals.ColorSaturationMidtones * _Globals.ColorSaturation;
+ float4 _858 = _Globals.ColorContrastMidtones * _Globals.ColorContrast;
+ float4 _861 = _Globals.ColorGammaMidtones * _Globals.ColorGamma;
+ float4 _864 = _Globals.ColorGainMidtones * _Globals.ColorGain;
+ float4 _867 = _Globals.ColorOffsetMidtones + _Globals.ColorOffset;
+ float3 _872 = mix(_772, _745, _855.xyz * float3(_855.w));
+ float3 _905 = ((((pow(pow(fast::max(float3(0.0), _777) * float3(5.5555553436279296875), _756.xyz * float3(_756.w)) * float3(0.180000007152557373046875), float3(1.0) / (_761.xyz * float3(_761.w))) * (_766.xyz * float3(_766.w))) + (_771.xyz + float3(_771.w))) * float3(1.0 - _804)) + (((pow(pow(fast::max(float3(0.0), _872) * float3(5.5555553436279296875), _858.xyz * float3(_858.w)) * float3(0.180000007152557373046875), float3(1.0) / (_861.xyz * float3(_861.w))) * (_864.xyz * float3(_864.w))) + (_867.xyz + float3(_867.w))) * float3(_804 - _852))) + (((pow(pow(fast::max(float3(0.0), _825) * float3(5.5555553436279296875), _811.xyz * float3(_811.w)) * float3(0.180000007152557373046875), float3(1.0) / (_814.xyz * float3(_814.w))) * (_817.xyz * float3(_817.w))) + (_820.xyz + float3(_820.w))) * float3(_852));
+ float3 _906 = _905 * _549;
+ float3 _914 = float3(_Globals.BlueCorrection);
+ float3 _916 = mix(_905, _905 * ((_551 * float3x3(float3(0.940437257289886474609375, -0.01830687932670116424560546875, 0.07786960899829864501953125), float3(0.008378696627914905548095703125, 0.82866001129150390625, 0.162961304187774658203125), float3(0.0005471261101774871349334716796875, -0.00088337459601461887359619140625, 1.00033628940582275390625))) * _550), _914) * _551;
+ float _917 = _916.x;
+ float _918 = _916.y;
+ float _920 = _916.z;
+ float _923 = fast::max(fast::max(_917, _918), _920);
+ float _928 = (fast::max(_923, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_917, _918), _920), 1.0000000133514319600180897396058e-10)) / fast::max(_923, 0.00999999977648258209228515625);
+ float _941 = ((_920 + _918) + _917) + (1.75 * sqrt(((_920 * (_920 - _918)) + (_918 * (_918 - _917))) + (_917 * (_917 - _920))));
+ float _942 = _941 * 0.3333333432674407958984375;
+ float _943 = _928 - 0.4000000059604644775390625;
+ float _948 = fast::max(1.0 - abs(_943 * 2.5), 0.0);
+ float _956 = (1.0 + (float(int(sign(_943 * 5.0))) * (1.0 - (_948 * _948)))) * 0.02500000037252902984619140625;
+ float _969;
+ if (_942 <= 0.053333334624767303466796875)
+ {
+ _969 = _956;
+ }
+ else
+ {
+ float _968;
+ if (_942 >= 0.1599999964237213134765625)
+ {
+ _968 = 0.0;
+ }
+ else
+ {
+ _968 = _956 * ((0.23999999463558197021484375 / _941) - 0.5);
+ }
+ _969 = _968;
+ }
+ float _970 = 1.0 + _969;
+ float3 _972 = _916 * float3(_970);
+ float _973 = _972.x;
+ float _974 = _972.y;
+ float _976 = _972.z;
+ float _990;
+ if ((_973 == _974) && (_974 == _976))
+ {
+ _990 = 0.0;
+ }
+ else
+ {
+ _990 = 57.2957763671875 * atan2(sqrt(3.0) * (_974 - _976), ((2.0 * _973) - _974) - _976);
+ }
+ float _995;
+ if (_990 < 0.0)
+ {
+ _995 = _990 + 360.0;
+ }
+ else
+ {
+ _995 = _990;
+ }
+ float _996 = fast::clamp(_995, 0.0, 360.0);
+ float _1001;
+ if (_996 > 180.0)
+ {
+ _1001 = _996 - 360.0;
+ }
+ else
+ {
+ _1001 = _996;
+ }
+ float _1005 = smoothstep(0.0, 1.0, 1.0 - abs(_1001 * 0.01481481455266475677490234375));
+ float3 _1012 = _972;
+ _1012.x = _973 + ((((_1005 * _1005) * _928) * (0.02999999932944774627685546875 - _973)) * 0.180000007152557373046875);
+ float3 _1014 = fast::max(float3(0.0), _1012 * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)));
+ float _1023 = (1.0 + _Globals.FilmBlackClip) - _Globals.FilmToe;
+ float _1026 = 1.0 + _Globals.FilmWhiteClip;
+ float _1029 = _1026 - _Globals.FilmShoulder;
+ float _1056;
+ if (_Globals.FilmToe > 0.800000011920928955078125)
+ {
+ _1056 = ((0.819999992847442626953125 - _Globals.FilmToe) / _Globals.FilmSlope) + (log(0.180000007152557373046875) / log(10.0));
+ }
+ else
+ {
+ float _1035 = (0.180000007152557373046875 + _Globals.FilmBlackClip) / _1023;
+ _1056 = (log(0.180000007152557373046875) / log(10.0)) - ((0.5 * log(_1035 / (2.0 - _1035))) * (_1023 / _Globals.FilmSlope));
+ }
+ float _1061 = ((1.0 - _Globals.FilmToe) / _Globals.FilmSlope) - _1056;
+ float _1063 = (_Globals.FilmShoulder / _Globals.FilmSlope) - _1061;
+ float _1065 = log(10.0);
+ float3 _1067 = log(mix(float3(dot(_1014, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1014, float3(0.959999978542327880859375))) / float3(_1065);
+ float3 _1071 = float3(_Globals.FilmSlope) * (_1067 + float3(_1061));
+ float3 _1079 = float3(_1056);
+ float3 _1080 = _1067 - _1079;
+ float3 _1085 = float3(-_Globals.FilmBlackClip) + (float3(2.0 * _1023) / (float3(1.0) + exp(float3(((-2.0) * _Globals.FilmSlope) / _1023) * _1080)));
+ float3 _1092 = float3(_1063);
+ float3 _1098 = float3(_1026) - (float3(2.0 * _1029) / (float3(1.0) + exp(float3((2.0 * _Globals.FilmSlope) / _1029) * (_1067 - _1092))));
+ bool3 _1099 = _1067 < _1079;
+ bool3 _1101 = _1067 > _1092;
+ float _1103 = _1063 - _1056;
+ float3 _1106 = fast::clamp(_1080 / float3(_1103), float3(0.0), float3(1.0));
+ bool _1107 = _1063 < _1056;
+ float3 _1108 = float3(1.0) - _1106;
+ bool3 _1109 = bool3(_1107);
+ float3 _1110 = float3(_1109.x ? _1108.x : _1106.x, _1109.y ? _1108.y : _1106.y, _1109.z ? _1108.z : _1106.z);
+ float3 _1115 = mix(float3(_1099.x ? _1085.x : _1071.x, _1099.y ? _1085.y : _1071.y, _1099.z ? _1085.z : _1071.z), float3(_1101.x ? _1098.x : _1071.x, _1101.y ? _1098.y : _1071.y, _1101.z ? _1098.z : _1071.z), ((float3(3.0) - (float3(2.0) * _1110)) * _1110) * _1110);
+ float3 _1119 = fast::max(float3(0.0), mix(float3(dot(_1115, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1115, float3(0.930000007152557373046875)));
+ float3 _1189;
+ if (_Globals.ColorShadow_Tint2.w == 0.0)
+ {
+ float3 _1131 = _391;
+ _1131.x = dot(_906, _Globals.ColorMatrixR_ColorCurveCd1.xyz);
+ float3 _1136 = _1131;
+ _1136.y = dot(_906, _Globals.ColorMatrixG_ColorCurveCd3Cm3.xyz);
+ float3 _1141 = _1136;
+ _1141.z = dot(_906, _Globals.ColorMatrixB_ColorCurveCm2.xyz);
+ float3 _1157 = fast::max(float3(0.0), _1141 * (_Globals.ColorShadow_Tint1.xyz + (_Globals.ColorShadow_Tint2.xyz * float3(1.0 / (dot(_906, _Globals.ColorShadow_Luma.xyz) + 1.0)))));
+ float3 _1162 = fast::max(float3(0.0), _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.xxx - _1157);
+ float3 _1164 = fast::max(_1157, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.zzz);
+ _1189 = ((((_1164 * _Globals.ColorCurve_Ch1_Ch2.xxx) + _Globals.ColorCurve_Ch1_Ch2.yyy) * (float3(1.0) / (_1164 + _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.www))) + ((fast::clamp(_1157, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.xxx, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.zzz) * _Globals.ColorMatrixB_ColorCurveCm2.www) + (((_1162 * _Globals.ColorMatrixR_ColorCurveCd1.www) * (float3(1.0) / (_1162 + _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.yyy))) + _Globals.ColorMatrixG_ColorCurveCd3Cm3.www))) - float3(0.00200000009499490261077880859375);
+ }
+ else
+ {
+ _1189 = fast::max(float3(0.0), mix(_1119, _1119 * ((_551 * float3x3(float3(1.06317996978759765625, 0.02339559979736804962158203125, -0.08657260239124298095703125), float3(-0.010633699595928192138671875, 1.2063200473785400390625, -0.1956900060176849365234375), float3(-0.0005908869788981974124908447265625, 0.00105247995816171169281005859375, 0.999538004398345947265625))) * _550), _914) * _549);
+ }
+ float3 _1193 = _1189 * _1189;
+ float3 _1198 = float3(_Globals.MappingPolynomial.y) * _1189;
+ float3 _1218 = pow(fast::max(float3(0.0), mix((((float3(_Globals.MappingPolynomial.x) * _1193) + _1198) + float3(_Globals.MappingPolynomial.z)) * float3(_Globals.ColorScale), _Globals.OverlayColor.xyz, float3(_Globals.OverlayColor.w))), float3(_Globals.InverseGamma.y));
+ float3 _3001;
+ if (_Globals.OutputDevice == 0u)
+ {
+ float _2961 = _1218.x;
+ float _2973;
+ for (;;)
+ {
+ if (_2961 < 0.00313066993840038776397705078125)
+ {
+ _2973 = _2961 * 12.9200000762939453125;
+ break;
+ }
+ _2973 = (pow(_2961, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+ break;
+ }
+ float _2974 = _1218.y;
+ float _2986;
+ for (;;)
+ {
+ if (_2974 < 0.00313066993840038776397705078125)
+ {
+ _2986 = _2974 * 12.9200000762939453125;
+ break;
+ }
+ _2986 = (pow(_2974, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+ break;
+ }
+ float _2987 = _1218.z;
+ float _2999;
+ for (;;)
+ {
+ if (_2987 < 0.00313066993840038776397705078125)
+ {
+ _2999 = _2987 * 12.9200000762939453125;
+ break;
+ }
+ _2999 = (pow(_2987, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+ break;
+ }
+ _3001 = float3(_2973, _2986, _2999);
+ }
+ else
+ {
+ float3 _2960;
+ if (_Globals.OutputDevice == 1u)
+ {
+ float3 _2953 = fast::max(float3(6.1035199905745685100555419921875e-05), (_1218 * _547) * _576);
+ _2960 = fast::min(_2953 * float3(4.5), (pow(fast::max(_2953, float3(0.017999999225139617919921875)), float3(0.449999988079071044921875)) * float3(1.09899997711181640625)) - float3(0.098999999463558197021484375));
+ }
+ else
+ {
+ float3 _2950;
+ if ((_Globals.OutputDevice == 3u) || (_Globals.OutputDevice == 5u))
+ {
+ float3 _2100 = (_906 * float3(1.5)) * (_546 * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625)));
+ float _2101 = _2100.x;
+ float _2102 = _2100.y;
+ float _2104 = _2100.z;
+ float _2107 = fast::max(fast::max(_2101, _2102), _2104);
+ float _2112 = (fast::max(_2107, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_2101, _2102), _2104), 1.0000000133514319600180897396058e-10)) / fast::max(_2107, 0.00999999977648258209228515625);
+ float _2125 = ((_2104 + _2102) + _2101) + (1.75 * sqrt(((_2104 * (_2104 - _2102)) + (_2102 * (_2102 - _2101))) + (_2101 * (_2101 - _2104))));
+ float _2126 = _2125 * 0.3333333432674407958984375;
+ float _2127 = _2112 - 0.4000000059604644775390625;
+ float _2132 = fast::max(1.0 - abs(_2127 * 2.5), 0.0);
+ float _2140 = (1.0 + (float(int(sign(_2127 * 5.0))) * (1.0 - (_2132 * _2132)))) * 0.02500000037252902984619140625;
+ float _2153;
+ if (_2126 <= 0.053333334624767303466796875)
+ {
+ _2153 = _2140;
+ }
+ else
+ {
+ float _2152;
+ if (_2126 >= 0.1599999964237213134765625)
+ {
+ _2152 = 0.0;
+ }
+ else
+ {
+ _2152 = _2140 * ((0.23999999463558197021484375 / _2125) - 0.5);
+ }
+ _2153 = _2152;
+ }
+ float _2154 = 1.0 + _2153;
+ float3 _2156 = _2100 * float3(_2154);
+ float _2157 = _2156.x;
+ float _2158 = _2156.y;
+ float _2160 = _2156.z;
+ float _2174;
+ if ((_2157 == _2158) && (_2158 == _2160))
+ {
+ _2174 = 0.0;
+ }
+ else
+ {
+ _2174 = 57.2957763671875 * atan2(sqrt(3.0) * (_2158 - _2160), ((2.0 * _2157) - _2158) - _2160);
+ }
+ float _2179;
+ if (_2174 < 0.0)
+ {
+ _2179 = _2174 + 360.0;
+ }
+ else
+ {
+ _2179 = _2174;
+ }
+ float _2180 = fast::clamp(_2179, 0.0, 360.0);
+ float _2185;
+ if (_2180 > 180.0)
+ {
+ _2185 = _2180 - 360.0;
+ }
+ else
+ {
+ _2185 = _2180;
+ }
+ float _2235;
+ if ((_2185 > (-67.5)) && (_2185 < 67.5))
+ {
+ float _2191 = _2185 - (-67.5);
+ float _2192 = _2191 * 0.0296296291053295135498046875;
+ int _2193 = int(_2192);
+ float _2195 = _2192 - float(_2193);
+ float _2196 = _2195 * _2195;
+ float _2197 = _2196 * _2195;
+ float _2234;
+ if (_2193 == 3)
+ {
+ _2234 = (((_2197 * (-0.16666667163372039794921875)) + (_2196 * 0.5)) + (_2195 * (-0.5))) + 0.16666667163372039794921875;
+ }
+ else
+ {
+ float _2227;
+ if (_2193 == 2)
+ {
+ _2227 = ((_2197 * 0.5) + (_2196 * (-1.0))) + 0.666666686534881591796875;
+ }
+ else
+ {
+ float _2222;
+ if (_2193 == 1)
+ {
+ _2222 = (((_2197 * (-0.5)) + (_2196 * 0.5)) + (_2195 * 0.5)) + 0.16666667163372039794921875;
+ }
+ else
+ {
+ float _2215;
+ if (_2193 == 0)
+ {
+ _2215 = _2197 * 0.16666667163372039794921875;
+ }
+ else
+ {
+ _2215 = 0.0;
+ }
+ _2222 = _2215;
+ }
+ _2227 = _2222;
+ }
+ _2234 = _2227;
+ }
+ _2235 = _2234;
+ }
+ else
+ {
+ _2235 = 0.0;
+ }
+ float3 _2242 = _2156;
+ _2242.x = _2157 + ((((_2235 * 1.5) * _2112) * (0.02999999932944774627685546875 - _2157)) * 0.180000007152557373046875);
+ float3 _2245 = fast::clamp(fast::clamp(_2242, float3(0.0), float3(65535.0)) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)), float3(0.0), float3(65535.0));
+ float3 _2248 = mix(float3(dot(_2245, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _2245, float3(0.959999978542327880859375));
+ float _2249 = _2248.x;
+ float _2253 = 0.17999999225139617919921875 * exp2(18.0);
+ float _2255 = exp2(-14.0);
+ float _2258 = log((_2249 <= 0.0) ? _2255 : _2249) / _1065;
+ float _2260 = log(0.17999999225139617919921875 * exp2(-15.0)) / _1065;
+ float _2327;
+ if (_2258 <= _2260)
+ {
+ _2327 = log(9.9999997473787516355514526367188e-05) / _1065;
+ }
+ else
+ {
+ float _2267 = log(0.180000007152557373046875) / _1065;
+ float _2324;
+ if ((_2258 > _2260) && (_2258 < _2267))
+ {
+ float _2307 = (3.0 * (_2258 - _2260)) / (_2267 - _2260);
+ int _2308 = int(_2307);
+ float _2310 = _2307 - float(_2308);
+ _2324 = dot(float3(_2310 * _2310, _2310, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2308], _475[_2308 + 1], _475[_2308 + 2]));
+ }
+ else
+ {
+ float _2275 = log(_2253) / _1065;
+ float _2303;
+ if ((_2258 >= _2267) && (_2258 < _2275))
+ {
+ float _2286 = (3.0 * (_2258 - _2267)) / (_2275 - _2267);
+ int _2287 = int(_2286);
+ float _2289 = _2286 - float(_2287);
+ _2303 = dot(float3(_2289 * _2289, _2289, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2287], _476[_2287 + 1], _476[_2287 + 2]));
+ }
+ else
+ {
+ _2303 = log(10000.0) / _1065;
+ }
+ _2324 = _2303;
+ }
+ _2327 = _2324;
+ }
+ float3 _2329 = _391;
+ _2329.x = pow(10.0, _2327);
+ float _2330 = _2248.y;
+ float _2334 = log((_2330 <= 0.0) ? _2255 : _2330) / _1065;
+ float _2401;
+ if (_2334 <= _2260)
+ {
+ _2401 = log(9.9999997473787516355514526367188e-05) / _1065;
+ }
+ else
+ {
+ float _2341 = log(0.180000007152557373046875) / _1065;
+ float _2398;
+ if ((_2334 > _2260) && (_2334 < _2341))
+ {
+ float _2381 = (3.0 * (_2334 - _2260)) / (_2341 - _2260);
+ int _2382 = int(_2381);
+ float _2384 = _2381 - float(_2382);
+ _2398 = dot(float3(_2384 * _2384, _2384, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2382], _475[_2382 + 1], _475[_2382 + 2]));
+ }
+ else
+ {
+ float _2349 = log(_2253) / _1065;
+ float _2377;
+ if ((_2334 >= _2341) && (_2334 < _2349))
+ {
+ float _2360 = (3.0 * (_2334 - _2341)) / (_2349 - _2341);
+ int _2361 = int(_2360);
+ float _2363 = _2360 - float(_2361);
+ _2377 = dot(float3(_2363 * _2363, _2363, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2361], _476[_2361 + 1], _476[_2361 + 2]));
+ }
+ else
+ {
+ _2377 = log(10000.0) / _1065;
+ }
+ _2398 = _2377;
+ }
+ _2401 = _2398;
+ }
+ float3 _2403 = _2329;
+ _2403.y = pow(10.0, _2401);
+ float _2404 = _2248.z;
+ float _2408 = log((_2404 <= 0.0) ? _2255 : _2404) / _1065;
+ float _2475;
+ if (_2408 <= _2260)
+ {
+ _2475 = log(9.9999997473787516355514526367188e-05) / _1065;
+ }
+ else
+ {
+ float _2415 = log(0.180000007152557373046875) / _1065;
+ float _2472;
+ if ((_2408 > _2260) && (_2408 < _2415))
+ {
+ float _2455 = (3.0 * (_2408 - _2260)) / (_2415 - _2260);
+ int _2456 = int(_2455);
+ float _2458 = _2455 - float(_2456);
+ _2472 = dot(float3(_2458 * _2458, _2458, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2456], _475[_2456 + 1], _475[_2456 + 2]));
+ }
+ else
+ {
+ float _2423 = log(_2253) / _1065;
+ float _2451;
+ if ((_2408 >= _2415) && (_2408 < _2423))
+ {
+ float _2434 = (3.0 * (_2408 - _2415)) / (_2423 - _2415);
+ int _2435 = int(_2434);
+ float _2437 = _2434 - float(_2435);
+ _2451 = dot(float3(_2437 * _2437, _2437, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2435], _476[_2435 + 1], _476[_2435 + 2]));
+ }
+ else
+ {
+ _2451 = log(10000.0) / _1065;
+ }
+ _2472 = _2451;
+ }
+ _2475 = _2472;
+ }
+ float3 _2477 = _2403;
+ _2477.z = pow(10.0, _2475);
+ float3 _2479 = (_2477 * float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625))) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375));
+ float _2481 = 0.17999999225139617919921875 * pow(2.0, -12.0);
+ float _2485 = log((_2481 <= 0.0) ? _2255 : _2481) / _1065;
+ float _2552;
+ if (_2485 <= _2260)
+ {
+ _2552 = log(9.9999997473787516355514526367188e-05) / _1065;
+ }
+ else
+ {
+ float _2492 = log(0.180000007152557373046875) / _1065;
+ float _2549;
+ if ((_2485 > _2260) && (_2485 < _2492))
+ {
+ float _2532 = (3.0 * (_2485 - _2260)) / (_2492 - _2260);
+ int _2533 = int(_2532);
+ float _2535 = _2532 - float(_2533);
+ _2549 = dot(float3(_2535 * _2535, _2535, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2533], _475[_2533 + 1], _475[_2533 + 2]));
+ }
+ else
+ {
+ float _2500 = log(_2253) / _1065;
+ float _2528;
+ if ((_2485 >= _2492) && (_2485 < _2500))
+ {
+ float _2511 = (3.0 * (_2485 - _2492)) / (_2500 - _2492);
+ int _2512 = int(_2511);
+ float _2514 = _2511 - float(_2512);
+ _2528 = dot(float3(_2514 * _2514, _2514, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2512], _476[_2512 + 1], _476[_2512 + 2]));
+ }
+ else
+ {
+ _2528 = log(10000.0) / _1065;
+ }
+ _2549 = _2528;
+ }
+ _2552 = _2549;
+ }
+ float _2553 = pow(10.0, _2552);
+ float _2555 = log(0.180000007152557373046875) / _1065;
+ float _2611;
+ if (_2555 <= _2260)
+ {
+ _2611 = log(9.9999997473787516355514526367188e-05) / _1065;
+ }
+ else
+ {
+ float _2608;
+ if ((_2555 > _2260) && (_2555 < _2555))
+ {
+ _2608 = (float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(-0.485249996185302734375, 1.84773242473602294921875, 1.84773242473602294921875)).z;
+ }
+ else
+ {
+ float _2568 = log(_2253) / _1065;
+ float _2596;
+ if ((_2555 >= _2555) && (_2555 < _2568))
+ {
+ float _2579 = (3.0 * (_2555 - _2555)) / (_2568 - _2555);
+ int _2580 = int(_2579);
+ float _2582 = _2579 - float(_2580);
+ _2596 = dot(float3(_2582 * _2582, _2582, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2580], _476[_2580 + 1], _476[_2580 + 2]));
+ }
+ else
+ {
+ _2596 = log(10000.0) / _1065;
+ }
+ _2608 = _2596;
+ }
+ _2611 = _2608;
+ }
+ float _2612 = pow(10.0, _2611);
+ float _2614 = 0.17999999225139617919921875 * pow(2.0, 10.0);
+ float _2618 = log((_2614 <= 0.0) ? _2255 : _2614) / _1065;
+ float _2683;
+ if (_2618 <= _2260)
+ {
+ _2683 = log(9.9999997473787516355514526367188e-05) / _1065;
+ }
+ else
+ {
+ float _2680;
+ if ((_2618 > _2260) && (_2618 < _2555))
+ {
+ float _2663 = (3.0 * (_2618 - _2260)) / (_2555 - _2260);
+ int _2664 = int(_2663);
+ float _2666 = _2663 - float(_2664);
+ _2680 = dot(float3(_2666 * _2666, _2666, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2664], _475[_2664 + 1], _475[_2664 + 2]));
+ }
+ else
+ {
+ float _2631 = log(_2253) / _1065;
+ float _2659;
+ if ((_2618 >= _2555) && (_2618 < _2631))
+ {
+ float _2642 = (3.0 * (_2618 - _2555)) / (_2631 - _2555);
+ int _2643 = int(_2642);
+ float _2645 = _2642 - float(_2643);
+ _2659 = dot(float3(_2645 * _2645, _2645, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2643], _476[_2643 + 1], _476[_2643 + 2]));
+ }
+ else
+ {
+ _2659 = log(10000.0) / _1065;
+ }
+ _2680 = _2659;
+ }
+ _2683 = _2680;
+ }
+ float _2684 = pow(10.0, _2683);
+ float _2685 = _2479.x;
+ float _2689 = log((_2685 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2685) / _1065;
+ float _2690 = log(_2553);
+ float _2691 = _2690 / _1065;
+ float _2768;
+ if (_2689 <= _2691)
+ {
+ _2768 = (_2689 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1065) - ((3.0 * _2690) / _1065));
+ }
+ else
+ {
+ float _2698 = log(_2612) / _1065;
+ float _2760;
+ if ((_2689 > _2691) && (_2689 < _2698))
+ {
+ float _2743 = (7.0 * (_2689 - _2691)) / (_2698 - _2691);
+ int _2744 = int(_2743);
+ float _2746 = _2743 - float(_2744);
+ _2760 = dot(float3(_2746 * _2746, _2746, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_479[_2744], _479[_2744 + 1], _479[_2744 + 2]));
+ }
+ else
+ {
+ float _2705 = log(_2684);
+ float _2706 = _2705 / _1065;
+ float _2739;
+ if ((_2689 >= _2698) && (_2689 < _2706))
+ {
+ float _2722 = (7.0 * (_2689 - _2698)) / (_2706 - _2698);
+ int _2723 = int(_2722);
+ float _2725 = _2722 - float(_2723);
+ _2739 = dot(float3(_2725 * _2725, _2725, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_480[_2723], _480[_2723 + 1], _480[_2723 + 2]));
+ }
+ else
+ {
+ _2739 = (_2689 * 0.0599999986588954925537109375) + ((log(1000.0) / _1065) - ((0.0599999986588954925537109375 * _2705) / _1065));
+ }
+ _2760 = _2739;
+ }
+ _2768 = _2760;
+ }
+ float3 _2770 = _391;
+ _2770.x = pow(10.0, _2768);
+ float _2771 = _2479.y;
+ float _2775 = log((_2771 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2771) / _1065;
+ float _2852;
+ if (_2775 <= _2691)
+ {
+ _2852 = (_2775 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1065) - ((3.0 * _2690) / _1065));
+ }
+ else
+ {
+ float _2782 = log(_2612) / _1065;
+ float _2844;
+ if ((_2775 > _2691) && (_2775 < _2782))
+ {
+ float _2827 = (7.0 * (_2775 - _2691)) / (_2782 - _2691);
+ int _2828 = int(_2827);
+ float _2830 = _2827 - float(_2828);
+ _2844 = dot(float3(_2830 * _2830, _2830, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_479[_2828], _479[_2828 + 1], _479[_2828 + 2]));
+ }
+ else
+ {
+ float _2789 = log(_2684);
+ float _2790 = _2789 / _1065;
+ float _2823;
+ if ((_2775 >= _2782) && (_2775 < _2790))
+ {
+ float _2806 = (7.0 * (_2775 - _2782)) / (_2790 - _2782);
+ int _2807 = int(_2806);
+ float _2809 = _2806 - float(_2807);
+ _2823 = dot(float3(_2809 * _2809, _2809, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_480[_2807], _480[_2807 + 1], _480[_2807 + 2]));
+ }
+ else
+ {
+ _2823 = (_2775 * 0.0599999986588954925537109375) + ((log(1000.0) / _1065) - ((0.0599999986588954925537109375 * _2789) / _1065));
+ }
+ _2844 = _2823;
+ }
+ _2852 = _2844;
+ }
+ float3 _2854 = _2770;
+ _2854.y = pow(10.0, _2852);
+ float _2855 = _2479.z;
+ float _2859 = log((_2855 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2855) / _1065;
+ float _2936;
+ if (_2859 <= _2691)
+ {
+ _2936 = (_2859 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1065) - ((3.0 * _2690) / _1065));
+ }
+ else
+ {
+ float _2866 = log(_2612) / _1065;
+ float _2928;
+ if ((_2859 > _2691) && (_2859 < _2866))
+ {
+ float _2911 = (7.0 * (_2859 - _2691)) / (_2866 - _2691);
+ int _2912 = int(_2911);
+ float _2914 = _2911 - float(_2912);
+ _2928 = dot(float3(_2914 * _2914, _2914, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_479[_2912], _479[_2912 + 1], _479[_2912 + 2]));
+ }
+ else
+ {
+ float _2873 = log(_2684);
+ float _2874 = _2873 / _1065;
+ float _2907;
+ if ((_2859 >= _2866) && (_2859 < _2874))
+ {
+ float _2890 = (7.0 * (_2859 - _2866)) / (_2874 - _2866);
+ int _2891 = int(_2890);
+ float _2893 = _2890 - float(_2891);
+ _2907 = dot(float3(_2893 * _2893, _2893, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_480[_2891], _480[_2891 + 1], _480[_2891 + 2]));
+ }
+ else
+ {
+ _2907 = (_2859 * 0.0599999986588954925537109375) + ((log(1000.0) / _1065) - ((0.0599999986588954925537109375 * _2873) / _1065));
+ }
+ _2928 = _2907;
+ }
+ _2936 = _2928;
+ }
+ float3 _2938 = _2854;
+ _2938.z = pow(10.0, _2936);
+ float3 _2942 = pow(((_2938 - float3(3.5073844628641381859779357910156e-05)) * _576) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125));
+ _2950 = pow((float3(0.8359375) + (float3(18.8515625) * _2942)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _2942))), float3(78.84375));
+ }
+ else
+ {
+ float3 _2097;
+ if ((_Globals.OutputDevice == 4u) || (_Globals.OutputDevice == 6u))
+ {
+ float3 _1263 = (_906 * float3(1.5)) * (_546 * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625)));
+ float _1264 = _1263.x;
+ float _1265 = _1263.y;
+ float _1267 = _1263.z;
+ float _1270 = fast::max(fast::max(_1264, _1265), _1267);
+ float _1275 = (fast::max(_1270, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_1264, _1265), _1267), 1.0000000133514319600180897396058e-10)) / fast::max(_1270, 0.00999999977648258209228515625);
+ float _1288 = ((_1267 + _1265) + _1264) + (1.75 * sqrt(((_1267 * (_1267 - _1265)) + (_1265 * (_1265 - _1264))) + (_1264 * (_1264 - _1267))));
+ float _1289 = _1288 * 0.3333333432674407958984375;
+ float _1290 = _1275 - 0.4000000059604644775390625;
+ float _1295 = fast::max(1.0 - abs(_1290 * 2.5), 0.0);
+ float _1303 = (1.0 + (float(int(sign(_1290 * 5.0))) * (1.0 - (_1295 * _1295)))) * 0.02500000037252902984619140625;
+ float _1316;
+ if (_1289 <= 0.053333334624767303466796875)
+ {
+ _1316 = _1303;
+ }
+ else
+ {
+ float _1315;
+ if (_1289 >= 0.1599999964237213134765625)
+ {
+ _1315 = 0.0;
+ }
+ else
+ {
+ _1315 = _1303 * ((0.23999999463558197021484375 / _1288) - 0.5);
+ }
+ _1316 = _1315;
+ }
+ float _1317 = 1.0 + _1316;
+ float3 _1319 = _1263 * float3(_1317);
+ float _1320 = _1319.x;
+ float _1321 = _1319.y;
+ float _1323 = _1319.z;
+ float _1337;
+ if ((_1320 == _1321) && (_1321 == _1323))
+ {
+ _1337 = 0.0;
+ }
+ else
+ {
+ _1337 = 57.2957763671875 * atan2(sqrt(3.0) * (_1321 - _1323), ((2.0 * _1320) - _1321) - _1323);
+ }
+ float _1342;
+ if (_1337 < 0.0)
+ {
+ _1342 = _1337 + 360.0;
+ }
+ else
+ {
+ _1342 = _1337;
+ }
+ float _1343 = fast::clamp(_1342, 0.0, 360.0);
+ float _1348;
+ if (_1343 > 180.0)
+ {
+ _1348 = _1343 - 360.0;
+ }
+ else
+ {
+ _1348 = _1343;
+ }
+ float _1398;
+ if ((_1348 > (-67.5)) && (_1348 < 67.5))
+ {
+ float _1354 = _1348 - (-67.5);
+ float _1355 = _1354 * 0.0296296291053295135498046875;
+ int _1356 = int(_1355);
+ float _1358 = _1355 - float(_1356);
+ float _1359 = _1358 * _1358;
+ float _1360 = _1359 * _1358;
+ float _1397;
+ if (_1356 == 3)
+ {
+ _1397 = (((_1360 * (-0.16666667163372039794921875)) + (_1359 * 0.5)) + (_1358 * (-0.5))) + 0.16666667163372039794921875;
+ }
+ else
+ {
+ float _1390;
+ if (_1356 == 2)
+ {
+ _1390 = ((_1360 * 0.5) + (_1359 * (-1.0))) + 0.666666686534881591796875;
+ }
+ else
+ {
+ float _1385;
+ if (_1356 == 1)
+ {
+ _1385 = (((_1360 * (-0.5)) + (_1359 * 0.5)) + (_1358 * 0.5)) + 0.16666667163372039794921875;
+ }
+ else
+ {
+ float _1378;
+ if (_1356 == 0)
+ {
+ _1378 = _1360 * 0.16666667163372039794921875;
+ }
+ else
+ {
+ _1378 = 0.0;
+ }
+ _1385 = _1378;
+ }
+ _1390 = _1385;
+ }
+ _1397 = _1390;
+ }
+ _1398 = _1397;
+ }
+ else
+ {
+ _1398 = 0.0;
+ }
+ float3 _1405 = _1319;
+ _1405.x = _1320 + ((((_1398 * 1.5) * _1275) * (0.02999999932944774627685546875 - _1320)) * 0.180000007152557373046875);
+ float3 _1408 = fast::clamp(fast::clamp(_1405, float3(0.0), float3(65535.0)) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)), float3(0.0), float3(65535.0));
+ float3 _1411 = mix(float3(dot(_1408, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1408, float3(0.959999978542327880859375));
+ float _1412 = _1411.x;
+ float _1416 = 0.17999999225139617919921875 * exp2(18.0);
+ float _1418 = exp2(-14.0);
+ float _1421 = log((_1412 <= 0.0) ? _1418 : _1412) / _1065;
+ float _1423 = log(0.17999999225139617919921875 * exp2(-15.0)) / _1065;
+ float _1490;
+ if (_1421 <= _1423)
+ {
+ _1490 = log(9.9999997473787516355514526367188e-05) / _1065;
+ }
+ else
+ {
+ float _1430 = log(0.180000007152557373046875) / _1065;
+ float _1487;
+ if ((_1421 > _1423) && (_1421 < _1430))
+ {
+ float _1470 = (3.0 * (_1421 - _1423)) / (_1430 - _1423);
+ int _1471 = int(_1470);
+ float _1473 = _1470 - float(_1471);
+ _1487 = dot(float3(_1473 * _1473, _1473, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1471], _475[_1471 + 1], _475[_1471 + 2]));
+ }
+ else
+ {
+ float _1438 = log(_1416) / _1065;
+ float _1466;
+ if ((_1421 >= _1430) && (_1421 < _1438))
+ {
+ float _1449 = (3.0 * (_1421 - _1430)) / (_1438 - _1430);
+ int _1450 = int(_1449);
+ float _1452 = _1449 - float(_1450);
+ _1466 = dot(float3(_1452 * _1452, _1452, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1450], _476[_1450 + 1], _476[_1450 + 2]));
+ }
+ else
+ {
+ _1466 = log(10000.0) / _1065;
+ }
+ _1487 = _1466;
+ }
+ _1490 = _1487;
+ }
+ float3 _1492 = _391;
+ _1492.x = pow(10.0, _1490);
+ float _1493 = _1411.y;
+ float _1497 = log((_1493 <= 0.0) ? _1418 : _1493) / _1065;
+ float _1564;
+ if (_1497 <= _1423)
+ {
+ _1564 = log(9.9999997473787516355514526367188e-05) / _1065;
+ }
+ else
+ {
+ float _1504 = log(0.180000007152557373046875) / _1065;
+ float _1561;
+ if ((_1497 > _1423) && (_1497 < _1504))
+ {
+ float _1544 = (3.0 * (_1497 - _1423)) / (_1504 - _1423);
+ int _1545 = int(_1544);
+ float _1547 = _1544 - float(_1545);
+ _1561 = dot(float3(_1547 * _1547, _1547, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1545], _475[_1545 + 1], _475[_1545 + 2]));
+ }
+ else
+ {
+ float _1512 = log(_1416) / _1065;
+ float _1540;
+ if ((_1497 >= _1504) && (_1497 < _1512))
+ {
+ float _1523 = (3.0 * (_1497 - _1504)) / (_1512 - _1504);
+ int _1524 = int(_1523);
+ float _1526 = _1523 - float(_1524);
+ _1540 = dot(float3(_1526 * _1526, _1526, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1524], _476[_1524 + 1], _476[_1524 + 2]));
+ }
+ else
+ {
+ _1540 = log(10000.0) / _1065;
+ }
+ _1561 = _1540;
+ }
+ _1564 = _1561;
+ }
+ float3 _1566 = _1492;
+ _1566.y = pow(10.0, _1564);
+ float _1567 = _1411.z;
+ float _1571 = log((_1567 <= 0.0) ? _1418 : _1567) / _1065;
+ float _1638;
+ if (_1571 <= _1423)
+ {
+ _1638 = log(9.9999997473787516355514526367188e-05) / _1065;
+ }
+ else
+ {
+ float _1578 = log(0.180000007152557373046875) / _1065;
+ float _1635;
+ if ((_1571 > _1423) && (_1571 < _1578))
+ {
+ float _1618 = (3.0 * (_1571 - _1423)) / (_1578 - _1423);
+ int _1619 = int(_1618);
+ float _1621 = _1618 - float(_1619);
+ _1635 = dot(float3(_1621 * _1621, _1621, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1619], _475[_1619 + 1], _475[_1619 + 2]));
+ }
+ else
+ {
+ float _1586 = log(_1416) / _1065;
+ float _1614;
+ if ((_1571 >= _1578) && (_1571 < _1586))
+ {
+ float _1597 = (3.0 * (_1571 - _1578)) / (_1586 - _1578);
+ int _1598 = int(_1597);
+ float _1600 = _1597 - float(_1598);
+ _1614 = dot(float3(_1600 * _1600, _1600, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1598], _476[_1598 + 1], _476[_1598 + 2]));
+ }
+ else
+ {
+ _1614 = log(10000.0) / _1065;
+ }
+ _1635 = _1614;
+ }
+ _1638 = _1635;
+ }
+ float3 _1640 = _1566;
+ _1640.z = pow(10.0, _1638);
+ float3 _1642 = (_1640 * float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625))) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375));
+ float _1644 = 0.17999999225139617919921875 * pow(2.0, -12.0);
+ float _1648 = log((_1644 <= 0.0) ? _1418 : _1644) / _1065;
+ float _1715;
+ if (_1648 <= _1423)
+ {
+ _1715 = log(9.9999997473787516355514526367188e-05) / _1065;
+ }
+ else
+ {
+ float _1655 = log(0.180000007152557373046875) / _1065;
+ float _1712;
+ if ((_1648 > _1423) && (_1648 < _1655))
+ {
+ float _1695 = (3.0 * (_1648 - _1423)) / (_1655 - _1423);
+ int _1696 = int(_1695);
+ float _1698 = _1695 - float(_1696);
+ _1712 = dot(float3(_1698 * _1698, _1698, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1696], _475[_1696 + 1], _475[_1696 + 2]));
+ }
+ else
+ {
+ float _1663 = log(_1416) / _1065;
+ float _1691;
+ if ((_1648 >= _1655) && (_1648 < _1663))
+ {
+ float _1674 = (3.0 * (_1648 - _1655)) / (_1663 - _1655);
+ int _1675 = int(_1674);
+ float _1677 = _1674 - float(_1675);
+ _1691 = dot(float3(_1677 * _1677, _1677, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1675], _476[_1675 + 1], _476[_1675 + 2]));
+ }
+ else
+ {
+ _1691 = log(10000.0) / _1065;
+ }
+ _1712 = _1691;
+ }
+ _1715 = _1712;
+ }
+ float _1716 = pow(10.0, _1715);
+ float _1718 = log(0.180000007152557373046875) / _1065;
+ float _1774;
+ if (_1718 <= _1423)
+ {
+ _1774 = log(9.9999997473787516355514526367188e-05) / _1065;
+ }
+ else
+ {
+ float _1771;
+ if ((_1718 > _1423) && (_1718 < _1718))
+ {
+ _1771 = (float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(-0.485249996185302734375, 1.84773242473602294921875, 1.84773242473602294921875)).z;
+ }
+ else
+ {
+ float _1731 = log(_1416) / _1065;
+ float _1759;
+ if ((_1718 >= _1718) && (_1718 < _1731))
+ {
+ float _1742 = (3.0 * (_1718 - _1718)) / (_1731 - _1718);
+ int _1743 = int(_1742);
+ float _1745 = _1742 - float(_1743);
+ _1759 = dot(float3(_1745 * _1745, _1745, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1743], _476[_1743 + 1], _476[_1743 + 2]));
+ }
+ else
+ {
+ _1759 = log(10000.0) / _1065;
+ }
+ _1771 = _1759;
+ }
+ _1774 = _1771;
+ }
+ float _1775 = pow(10.0, _1774);
+ float _1777 = 0.17999999225139617919921875 * pow(2.0, 11.0);
+ float _1781 = log((_1777 <= 0.0) ? _1418 : _1777) / _1065;
+ float _1846;
+ if (_1781 <= _1423)
+ {
+ _1846 = log(9.9999997473787516355514526367188e-05) / _1065;
+ }
+ else
+ {
+ float _1843;
+ if ((_1781 > _1423) && (_1781 < _1718))
+ {
+ float _1826 = (3.0 * (_1781 - _1423)) / (_1718 - _1423);
+ int _1827 = int(_1826);
+ float _1829 = _1826 - float(_1827);
+ _1843 = dot(float3(_1829 * _1829, _1829, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1827], _475[_1827 + 1], _475[_1827 + 2]));
+ }
+ else
+ {
+ float _1794 = log(_1416) / _1065;
+ float _1822;
+ if ((_1781 >= _1718) && (_1781 < _1794))
+ {
+ float _1805 = (3.0 * (_1781 - _1718)) / (_1794 - _1718);
+ int _1806 = int(_1805);
+ float _1808 = _1805 - float(_1806);
+ _1822 = dot(float3(_1808 * _1808, _1808, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1806], _476[_1806 + 1], _476[_1806 + 2]));
+ }
+ else
+ {
+ _1822 = log(10000.0) / _1065;
+ }
+ _1843 = _1822;
+ }
+ _1846 = _1843;
+ }
+ float _1847 = pow(10.0, _1846);
+ float _1848 = _1642.x;
+ float _1852 = log((_1848 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _1848) / _1065;
+ float _1854 = log(_1716) / _1065;
+ float _1926;
+ if (_1852 <= _1854)
+ {
+ _1926 = log(0.004999999888241291046142578125) / _1065;
+ }
+ else
+ {
+ float _1861 = log(_1775) / _1065;
+ float _1923;
+ if ((_1852 > _1854) && (_1852 < _1861))
+ {
+ float _1906 = (7.0 * (_1852 - _1854)) / (_1861 - _1854);
+ int _1907 = int(_1906);
+ float _1909 = _1906 - float(_1907);
+ _1923 = dot(float3(_1909 * _1909, _1909, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_482[_1907], _482[_1907 + 1], _482[_1907 + 2]));
+ }
+ else
+ {
+ float _1868 = log(_1847);
+ float _1869 = _1868 / _1065;
+ float _1902;
+ if ((_1852 >= _1861) && (_1852 < _1869))
+ {
+ float _1885 = (7.0 * (_1852 - _1861)) / (_1869 - _1861);
+ int _1886 = int(_1885);
+ float _1888 = _1885 - float(_1886);
+ _1902 = dot(float3(_1888 * _1888, _1888, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_483[_1886], _483[_1886 + 1], _483[_1886 + 2]));
+ }
+ else
+ {
+ _1902 = (_1852 * 0.119999997317790985107421875) + ((log(2000.0) / _1065) - ((0.119999997317790985107421875 * _1868) / _1065));
+ }
+ _1923 = _1902;
+ }
+ _1926 = _1923;
+ }
+ float3 _1928 = _391;
+ _1928.x = pow(10.0, _1926);
+ float _1929 = _1642.y;
+ float _1933 = log((_1929 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _1929) / _1065;
+ float _2005;
+ if (_1933 <= _1854)
+ {
+ _2005 = log(0.004999999888241291046142578125) / _1065;
+ }
+ else
+ {
+ float _1940 = log(_1775) / _1065;
+ float _2002;
+ if ((_1933 > _1854) && (_1933 < _1940))
+ {
+ float _1985 = (7.0 * (_1933 - _1854)) / (_1940 - _1854);
+ int _1986 = int(_1985);
+ float _1988 = _1985 - float(_1986);
+ _2002 = dot(float3(_1988 * _1988, _1988, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_482[_1986], _482[_1986 + 1], _482[_1986 + 2]));
+ }
+ else
+ {
+ float _1947 = log(_1847);
+ float _1948 = _1947 / _1065;
+ float _1981;
+ if ((_1933 >= _1940) && (_1933 < _1948))
+ {
+ float _1964 = (7.0 * (_1933 - _1940)) / (_1948 - _1940);
+ int _1965 = int(_1964);
+ float _1967 = _1964 - float(_1965);
+ _1981 = dot(float3(_1967 * _1967, _1967, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_483[_1965], _483[_1965 + 1], _483[_1965 + 2]));
+ }
+ else
+ {
+ _1981 = (_1933 * 0.119999997317790985107421875) + ((log(2000.0) / _1065) - ((0.119999997317790985107421875 * _1947) / _1065));
+ }
+ _2002 = _1981;
+ }
+ _2005 = _2002;
+ }
+ float3 _2007 = _1928;
+ _2007.y = pow(10.0, _2005);
+ float _2008 = _1642.z;
+ float _2012 = log((_2008 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2008) / _1065;
+ float _2084;
+ if (_2012 <= _1854)
+ {
+ _2084 = log(0.004999999888241291046142578125) / _1065;
+ }
+ else
+ {
+ float _2019 = log(_1775) / _1065;
+ float _2081;
+ if ((_2012 > _1854) && (_2012 < _2019))
+ {
+ float _2064 = (7.0 * (_2012 - _1854)) / (_2019 - _1854);
+ int _2065 = int(_2064);
+ float _2067 = _2064 - float(_2065);
+ _2081 = dot(float3(_2067 * _2067, _2067, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_482[_2065], _482[_2065 + 1], _482[_2065 + 2]));
+ }
+ else
+ {
+ float _2026 = log(_1847);
+ float _2027 = _2026 / _1065;
+ float _2060;
+ if ((_2012 >= _2019) && (_2012 < _2027))
+ {
+ float _2043 = (7.0 * (_2012 - _2019)) / (_2027 - _2019);
+ int _2044 = int(_2043);
+ float _2046 = _2043 - float(_2044);
+ _2060 = dot(float3(_2046 * _2046, _2046, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_483[_2044], _483[_2044 + 1], _483[_2044 + 2]));
+ }
+ else
+ {
+ _2060 = (_2012 * 0.119999997317790985107421875) + ((log(2000.0) / _1065) - ((0.119999997317790985107421875 * _2026) / _1065));
+ }
+ _2081 = _2060;
+ }
+ _2084 = _2081;
+ }
+ float3 _2086 = _2007;
+ _2086.z = pow(10.0, _2084);
+ float3 _2089 = pow((_2086 * _576) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125));
+ _2097 = pow((float3(0.8359375) + (float3(18.8515625) * _2089)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _2089))), float3(78.84375));
+ }
+ else
+ {
+ float3 _1260;
+ if (_Globals.OutputDevice == 7u)
+ {
+ float3 _1252 = pow(((_906 * _547) * _576) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125));
+ _1260 = pow((float3(0.8359375) + (float3(18.8515625) * _1252)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _1252))), float3(78.84375));
+ }
+ else
+ {
+ _1260 = pow((_1218 * _547) * _576, float3(_Globals.InverseGamma.z));
+ }
+ _2097 = _1260;
+ }
+ _2950 = _2097;
+ }
+ _2960 = _2950;
+ }
+ _3001 = _2960;
+ }
+ float3 _3002 = _3001 * float3(0.95238101482391357421875);
+ float4 _3004 = float4(_3002.x, _3002.y, _3002.z, float4(0.0).w);
+ _3004.w = 0.0;
+ out.out_var_SV_Target0 = _3004;
+ return out;
+}
+
diff --git a/reference/opt/shaders-msl/asm/ue4/loop_accesschain_writethrough/DOFHybridScatterVertexShader.dxc.asm.vert b/reference/opt/shaders-msl/asm/ue4/loop_accesschain_writethrough/DOFHybridScatterVertexShader.dxc.asm.vert
new file mode 100644
index 00000000..f7d216ba
--- /dev/null
+++ b/reference/opt/shaders-msl/asm/ue4/loop_accesschain_writethrough/DOFHybridScatterVertexShader.dxc.asm.vert
@@ -0,0 +1,91 @@
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct type_Globals
+{
+ float4 ViewportSize;
+ float ScatteringScaling;
+ float CocRadiusToCircumscribedRadius;
+};
+
+struct type_StructuredBuffer_v4float
+{
+ float4 _m0[1];
+};
+
+struct main0_out
+{
+ float2 out_var_TEXCOORD0 [[user(locn0)]];
+ float4 out_var_TEXCOORD1 [[user(locn1)]];
+ float4 out_var_TEXCOORD2 [[user(locn2)]];
+ float4 out_var_TEXCOORD3 [[user(locn3)]];
+ float4 out_var_TEXCOORD4 [[user(locn4)]];
+ float4 out_var_TEXCOORD5 [[user(locn5)]];
+ float4 out_var_TEXCOORD6 [[user(locn6)]];
+ float4 gl_Position [[position]];
+};
+
+vertex main0_out main0(const device type_StructuredBuffer_v4float& ScatterDrawList [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], uint gl_VertexIndex [[vertex_id]], uint gl_InstanceIndex [[instance_id]])
+{
+ main0_out out = {};
+ uint _66 = gl_VertexIndex / 4u;
+ uint _68 = gl_VertexIndex - (_66 * 4u);
+ uint _70 = (16u * gl_InstanceIndex) + _66;
+ float _72;
+ _72 = 0.0;
+ float4 _61[4];
+ float _62[4];
+ float2 _63[4];
+ float _73;
+ uint _75 = 0u;
+ for (;;)
+ {
+ if (_75 < 4u)
+ {
+ uint _82 = ((5u * _70) + _75) + 1u;
+ _61[_75] = float4(ScatterDrawList._m0[_82].xyz, 0.0);
+ _62[_75] = ScatterDrawList._m0[_82].w;
+ if (_75 == 0u)
+ {
+ _73 = _62[_75];
+ _63[_75].x = (-0.5) / _62[_75];
+ _63[_75].y = (0.5 * _62[_75]) + 0.5;
+ _72 = _73;
+ _75++;
+ continue;
+ }
+ else
+ {
+ _73 = fast::max(_72, _62[_75]);
+ _63[_75].x = (-0.5) / _62[_75];
+ _63[_75].y = (0.5 * _62[_75]) + 0.5;
+ _72 = _73;
+ _75++;
+ continue;
+ }
+ _63[_75].x = (-0.5) / _62[_75];
+ _63[_75].y = (0.5 * _62[_75]) + 0.5;
+ _72 = _73;
+ _75++;
+ continue;
+ }
+ else
+ {
+ break;
+ }
+ }
+ float2 _144 = float2(_Globals.ScatteringScaling) * ScatterDrawList._m0[5u * _70].xy;
+ float2 _173 = (((float2((_72 * _Globals.CocRadiusToCircumscribedRadius) + 1.0) * ((float2(float(_68 % 2u), float(_68 / 2u)) * float2(2.0)) - float2(1.0))) + _144) + float2(0.5)) * _Globals.ViewportSize.zw;
+ out.out_var_TEXCOORD0 = _144;
+ out.out_var_TEXCOORD1 = float4(_61[0].xyz, _62[0]);
+ out.out_var_TEXCOORD2 = float4(_61[1].xyz, _62[1]);
+ out.out_var_TEXCOORD3 = float4(_61[2].xyz, _62[2]);
+ out.out_var_TEXCOORD4 = float4(_61[3].xyz, _62[3]);
+ out.out_var_TEXCOORD5 = float4(_63[0].x, _63[0].y, _63[1].x, _63[1].y);
+ out.out_var_TEXCOORD6 = float4(_63[2].x, _63[2].y, _63[3].x, _63[3].y);
+ out.gl_Position = float4((_173.x * 2.0) - 1.0, 1.0 - (_173.y * 2.0), 0.0, 1.0);
+ return out;
+}
+
diff --git a/reference/opt/shaders-msl/asm/ue4/padded_float_array_member_defef/PostProcessCombineLUTs.dxc.asm.frag b/reference/opt/shaders-msl/asm/ue4/padded_float_array_member_defef/PostProcessCombineLUTs.dxc.asm.frag
new file mode 100644
index 00000000..9edb8f86
--- /dev/null
+++ b/reference/opt/shaders-msl/asm/ue4/padded_float_array_member_defef/PostProcessCombineLUTs.dxc.asm.frag
@@ -0,0 +1,1397 @@
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct type_Globals
+{
+ float4 MappingPolynomial;
+ float3 InverseGamma;
+ float4 ColorMatrixR_ColorCurveCd1;
+ float4 ColorMatrixG_ColorCurveCd3Cm3;
+ float4 ColorMatrixB_ColorCurveCm2;
+ float4 ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3;
+ float4 ColorCurve_Ch1_Ch2;
+ float4 ColorShadow_Luma;
+ float4 ColorShadow_Tint1;
+ float4 ColorShadow_Tint2;
+ float FilmSlope;
+ float FilmToe;
+ float FilmShoulder;
+ float FilmBlackClip;
+ float FilmWhiteClip;
+ float4 LUTWeights[5];
+ float3 ColorScale;
+ float4 OverlayColor;
+ float WhiteTemp;
+ float WhiteTint;
+ float4 ColorSaturation;
+ float4 ColorContrast;
+ float4 ColorGamma;
+ float4 ColorGain;
+ float4 ColorOffset;
+ float4 ColorSaturationShadows;
+ float4 ColorContrastShadows;
+ float4 ColorGammaShadows;
+ float4 ColorGainShadows;
+ float4 ColorOffsetShadows;
+ float4 ColorSaturationMidtones;
+ float4 ColorContrastMidtones;
+ float4 ColorGammaMidtones;
+ float4 ColorGainMidtones;
+ float4 ColorOffsetMidtones;
+ float4 ColorSaturationHighlights;
+ float4 ColorContrastHighlights;
+ float4 ColorGammaHighlights;
+ float4 ColorGainHighlights;
+ float4 ColorOffsetHighlights;
+ float ColorCorrectionShadowsMax;
+ float ColorCorrectionHighlightsMin;
+ uint OutputDevice;
+ uint OutputGamut;
+ float BlueCorrection;
+ float ExpandGamut;
+};
+
+constant float _499[6] = { -4.0, -4.0, -3.1573765277862548828125, -0.485249996185302734375, 1.84773242473602294921875, 1.84773242473602294921875 };
+constant float _500[6] = { -0.718548238277435302734375, 2.0810306072235107421875, 3.66812419891357421875, 4.0, 4.0, 4.0 };
+constant float _503[10] = { -4.97062206268310546875, -3.0293781757354736328125, -2.1261999607086181640625, -1.5104999542236328125, -1.0578000545501708984375, -0.4668000042438507080078125, 0.11937999725341796875, 0.7088134288787841796875, 1.2911865711212158203125, 1.2911865711212158203125 };
+constant float _504[10] = { 0.80891323089599609375, 1.19108676910400390625, 1.5683000087738037109375, 1.94830000400543212890625, 2.308300018310546875, 2.63840007781982421875, 2.85949993133544921875, 2.9872608184814453125, 3.0127391815185546875, 3.0127391815185546875 };
+constant float _506[10] = { -2.3010299205780029296875, -2.3010299205780029296875, -1.9312000274658203125, -1.5204999446868896484375, -1.0578000545501708984375, -0.4668000042438507080078125, 0.11937999725341796875, 0.7088134288787841796875, 1.2911865711212158203125, 1.2911865711212158203125 };
+constant float _507[10] = { 0.801995217800140380859375, 1.19800484180450439453125, 1.5943000316619873046875, 1.99730002880096435546875, 2.3782999515533447265625, 2.7683999538421630859375, 3.0515000820159912109375, 3.2746293544769287109375, 3.32743072509765625, 3.32743072509765625 };
+
+constant float3 _523 = {};
+constant float3 _3121 = {};
+
+struct main0_out
+{
+ float4 out_var_SV_Target0 [[color(0)]];
+};
+
+struct main0_in
+{
+ float2 in_var_TEXCOORD0 [[user(locn0), center_no_perspective]];
+};
+
+fragment main0_out main0(main0_in in [[stage_in]], constant type_Globals& _Globals [[buffer(0)]], texture2d<float> Texture1 [[texture(0)]], sampler Texture1Sampler [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_Layer [[render_target_array_index]])
+{
+ main0_out out = {};
+ float3x3 _572 = float3x3(float3(0.41245639324188232421875, 0.3575761020183563232421875, 0.180437505245208740234375), float3(0.21267290413379669189453125, 0.715152204036712646484375, 0.072175003588199615478515625), float3(0.01933390088379383087158203125, 0.119191996753215789794921875, 0.950304090976715087890625)) * float3x3(float3(1.01303005218505859375, 0.0061053098179399967193603515625, -0.014971000142395496368408203125), float3(0.0076982299797236919403076171875, 0.99816501140594482421875, -0.005032029934227466583251953125), float3(-0.0028413101099431514739990234375, 0.0046851597726345062255859375, 0.92450702190399169921875));
+ float3x3 _573 = _572 * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125));
+ float3x3 _574 = float3x3(float3(0.662454187870025634765625, 0.1340042054653167724609375, 0.1561876833438873291015625), float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625), float3(-0.0055746496655046939849853515625, 0.0040607335977256298065185546875, 1.01033914089202880859375)) * float3x3(float3(0.98722398281097412109375, -0.0061132698319852352142333984375, 0.01595330052077770233154296875), float3(-0.007598360069096088409423828125, 1.00186002254486083984375, 0.0053300200961530208587646484375), float3(0.003072570078074932098388671875, -0.0050959498621523380279541015625, 1.0816800594329833984375));
+ float3x3 _575 = _574 * float3x3(float3(3.2409698963165283203125, -1.53738319873809814453125, -0.4986107647418975830078125), float3(-0.96924364566802978515625, 1.875967502593994140625, 0.0415550582110881805419921875), float3(0.055630080401897430419921875, -0.2039769589900970458984375, 1.05697154998779296875));
+ float3x3 _576 = float3x3(float3(0.952552378177642822265625, 0.0, 9.3678601842839270830154418945312e-05), float3(0.3439664542675018310546875, 0.728166103363037109375, -0.07213254272937774658203125), float3(0.0, 0.0, 1.00882518291473388671875)) * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125));
+ float3x3 _577 = float3x3(float3(0.662454187870025634765625, 0.1340042054653167724609375, 0.1561876833438873291015625), float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625), float3(-0.0055746496655046939849853515625, 0.0040607335977256298065185546875, 1.01033914089202880859375)) * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625));
+ float3x3 _602;
+ for (;;)
+ {
+ if (_Globals.OutputGamut == 1u)
+ {
+ _602 = _574 * float3x3(float3(2.493396282196044921875, -0.931345880031585693359375, -0.4026944935321807861328125), float3(-0.829486787319183349609375, 1.76265966892242431640625, 0.02362460084259510040283203125), float3(0.0358506999909877777099609375, -0.076182700693607330322265625, 0.957014024257659912109375));
+ break;
+ }
+ else
+ {
+ if (_Globals.OutputGamut == 2u)
+ {
+ _602 = _574 * float3x3(float3(1.71660840511322021484375, -0.3556621074676513671875, -0.253360092639923095703125), float3(-0.666682898998260498046875, 1.61647760868072509765625, 0.01576850004494190216064453125), float3(0.017642199993133544921875, -0.04277630150318145751953125, 0.94222867488861083984375));
+ break;
+ }
+ else
+ {
+ if (_Globals.OutputGamut == 3u)
+ {
+ _602 = float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625));
+ break;
+ }
+ else
+ {
+ if (_Globals.OutputGamut == 4u)
+ {
+ _602 = float3x3(float3(1.0, 0.0, 0.0), float3(0.0, 1.0, 0.0), float3(0.0, 0.0, 1.0));
+ break;
+ }
+ else
+ {
+ _602 = _575;
+ break;
+ }
+ }
+ }
+ }
+ }
+ float3 _603 = float4((in.in_var_TEXCOORD0 - float2(0.015625)) * float2(1.03225803375244140625), float(gl_Layer) * 0.0322580635547637939453125, 0.0).xyz;
+ float3 _625;
+ if (_Globals.OutputDevice >= 3u)
+ {
+ float3 _617 = pow(_603, float3(0.0126833133399486541748046875));
+ _625 = pow(fast::max(float3(0.0), _617 - float3(0.8359375)) / (float3(18.8515625) - (float3(18.6875) * _617)), float3(6.277394771575927734375)) * float3(10000.0);
+ }
+ else
+ {
+ _625 = (exp2((_603 - float3(0.434017598628997802734375)) * float3(14.0)) * float3(0.180000007152557373046875)) - (exp2(float3(-6.0762462615966796875)) * float3(0.180000007152557373046875));
+ }
+ float _628 = _Globals.WhiteTemp * 1.00055634975433349609375;
+ float _642 = (_628 <= 7000.0) ? (0.24406300485134124755859375 + ((99.1100006103515625 + ((2967800.0 - (4604438528.0 / _Globals.WhiteTemp)) / _628)) / _628)) : (0.23703999817371368408203125 + ((247.4799957275390625 + ((1901800.0 - (2005284352.0 / _Globals.WhiteTemp)) / _628)) / _628));
+ float2 _648 = float2(_642, ((((-3.0) * _642) * _642) + (2.86999988555908203125 * _642)) - 0.2750000059604644775390625);
+ float _659 = ((0.860117733478546142578125 + (0.00015411825734190642833709716796875 * _Globals.WhiteTemp)) + ((1.2864121856637211749330163002014e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp)) / ((1.0 + (0.0008424202096648514270782470703125 * _Globals.WhiteTemp)) + ((7.0814513719597016461193561553955e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp));
+ float _670 = ((0.317398726940155029296875 + (4.2280626075807958841323852539062e-05 * _Globals.WhiteTemp)) + ((4.2048167614439080352894961833954e-08 * _Globals.WhiteTemp) * _Globals.WhiteTemp)) / ((1.0 - (2.8974181986995972692966461181641e-05 * _Globals.WhiteTemp)) + ((1.6145605741257895715534687042236e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp));
+ float _675 = ((2.0 * _659) - (8.0 * _670)) + 4.0;
+ float2 _679 = float2((3.0 * _659) / _675, (2.0 * _670) / _675);
+ bool2 _681 = bool2(_Globals.WhiteTemp < 4000.0);
+ float2 _686 = normalize(float2(_659, _670));
+ float _691 = _659 + (((-_686.y) * _Globals.WhiteTint) * 0.0500000007450580596923828125);
+ float _695 = _670 + ((_686.x * _Globals.WhiteTint) * 0.0500000007450580596923828125);
+ float _700 = ((2.0 * _691) - (8.0 * _695)) + 4.0;
+ float2 _706 = float2(_681.x ? _679.x : _648.x, _681.y ? _679.y : _648.y) + (float2((3.0 * _691) / _700, (2.0 * _695) / _700) - _679);
+ float _707 = _706.x;
+ float _708 = _706.y;
+ float _709 = fast::max(_708, 1.0000000133514319600180897396058e-10);
+ float3 _711 = _523;
+ _711.x = _707 / _709;
+ float3 _712 = _711;
+ _712.y = 1.0;
+ float3 _716 = _712;
+ _716.z = ((1.0 - _707) - _708) / _709;
+ float _717 = fast::max(0.328999996185302734375, 1.0000000133514319600180897396058e-10);
+ float3 _719 = _523;
+ _719.x = 0.3127000033855438232421875 / _717;
+ float3 _720 = _719;
+ _720.y = 1.0;
+ float3 _722 = _720;
+ _722.z = 0.3582999706268310546875 / _717;
+ float3 _723 = _716 * float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875));
+ float3 _724 = _722 * float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875));
+ float3 _742 = _625 * ((float3x3(float3(0.41245639324188232421875, 0.3575761020183563232421875, 0.180437505245208740234375), float3(0.21267290413379669189453125, 0.715152204036712646484375, 0.072175003588199615478515625), float3(0.01933390088379383087158203125, 0.119191996753215789794921875, 0.950304090976715087890625)) * ((float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875)) * float3x3(float3(_724.x / _723.x, 0.0, 0.0), float3(0.0, _724.y / _723.y, 0.0), float3(0.0, 0.0, _724.z / _723.z))) * float3x3(float3(0.986992895603179931640625, -0.14705429971218109130859375, 0.15996269881725311279296875), float3(0.4323053061962127685546875, 0.518360316753387451171875, 0.049291200935840606689453125), float3(-0.00852870009839534759521484375, 0.0400427989661693572998046875, 0.968486726284027099609375)))) * float3x3(float3(3.2409698963165283203125, -1.53738319873809814453125, -0.4986107647418975830078125), float3(-0.96924364566802978515625, 1.875967502593994140625, 0.0415550582110881805419921875), float3(0.055630080401897430419921875, -0.2039769589900970458984375, 1.05697154998779296875)));
+ float3 _743 = _742 * _573;
+ float3 _771;
+ if (_Globals.ColorShadow_Tint2.w != 0.0)
+ {
+ float _750 = dot(_743, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625));
+ float3 _753 = (_743 / float3(_750)) - float3(1.0);
+ _771 = mix(_743, _743 * (_575 * (float3x3(float3(0.544169127941131591796875, 0.23959259688854217529296875, 0.16669429838657379150390625), float3(0.23946559429168701171875, 0.702153027057647705078125, 0.058381401002407073974609375), float3(-0.0023439000360667705535888671875, 0.0361833982169628143310546875, 1.05521833896636962890625)) * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125)))), float3((1.0 - exp2((-4.0) * dot(_753, _753))) * (1.0 - exp2((((-4.0) * _Globals.ExpandGamut) * _750) * _750))));
+ }
+ else
+ {
+ _771 = _743;
+ }
+ float _772 = dot(_771, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625));
+ float4 _777 = _Globals.ColorSaturationShadows * _Globals.ColorSaturation;
+ float4 _782 = _Globals.ColorContrastShadows * _Globals.ColorContrast;
+ float4 _787 = _Globals.ColorGammaShadows * _Globals.ColorGamma;
+ float4 _792 = _Globals.ColorGainShadows * _Globals.ColorGain;
+ float4 _797 = _Globals.ColorOffsetShadows + _Globals.ColorOffset;
+ float3 _798 = float3(_772);
+ float3 _803 = mix(_798, _771, _777.xyz * float3(_777.w));
+ float _830 = smoothstep(0.0, _Globals.ColorCorrectionShadowsMax, _772);
+ float4 _834 = _Globals.ColorSaturationHighlights * _Globals.ColorSaturation;
+ float4 _837 = _Globals.ColorContrastHighlights * _Globals.ColorContrast;
+ float4 _840 = _Globals.ColorGammaHighlights * _Globals.ColorGamma;
+ float4 _843 = _Globals.ColorGainHighlights * _Globals.ColorGain;
+ float4 _846 = _Globals.ColorOffsetHighlights + _Globals.ColorOffset;
+ float3 _851 = mix(_798, _771, _834.xyz * float3(_834.w));
+ float _878 = smoothstep(_Globals.ColorCorrectionHighlightsMin, 1.0, _772);
+ float4 _881 = _Globals.ColorSaturationMidtones * _Globals.ColorSaturation;
+ float4 _884 = _Globals.ColorContrastMidtones * _Globals.ColorContrast;
+ float4 _887 = _Globals.ColorGammaMidtones * _Globals.ColorGamma;
+ float4 _890 = _Globals.ColorGainMidtones * _Globals.ColorGain;
+ float4 _893 = _Globals.ColorOffsetMidtones + _Globals.ColorOffset;
+ float3 _898 = mix(_798, _771, _881.xyz * float3(_881.w));
+ float3 _931 = ((((pow(pow(fast::max(float3(0.0), _803) * float3(5.5555553436279296875), _782.xyz * float3(_782.w)) * float3(0.180000007152557373046875), float3(1.0) / (_787.xyz * float3(_787.w))) * (_792.xyz * float3(_792.w))) + (_797.xyz + float3(_797.w))) * float3(1.0 - _830)) + (((pow(pow(fast::max(float3(0.0), _898) * float3(5.5555553436279296875), _884.xyz * float3(_884.w)) * float3(0.180000007152557373046875), float3(1.0) / (_887.xyz * float3(_887.w))) * (_890.xyz * float3(_890.w))) + (_893.xyz + float3(_893.w))) * float3(_830 - _878))) + (((pow(pow(fast::max(float3(0.0), _851) * float3(5.5555553436279296875), _837.xyz * float3(_837.w)) * float3(0.180000007152557373046875), float3(1.0) / (_840.xyz * float3(_840.w))) * (_843.xyz * float3(_843.w))) + (_846.xyz + float3(_846.w))) * float3(_878));
+ float3 _932 = _931 * _575;
+ float3 _940 = float3(_Globals.BlueCorrection);
+ float3 _942 = mix(_931, _931 * ((_577 * float3x3(float3(0.940437257289886474609375, -0.01830687932670116424560546875, 0.07786960899829864501953125), float3(0.008378696627914905548095703125, 0.82866001129150390625, 0.162961304187774658203125), float3(0.0005471261101774871349334716796875, -0.00088337459601461887359619140625, 1.00033628940582275390625))) * _576), _940) * _577;
+ float _943 = _942.x;
+ float _944 = _942.y;
+ float _946 = _942.z;
+ float _949 = fast::max(fast::max(_943, _944), _946);
+ float _954 = (fast::max(_949, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_943, _944), _946), 1.0000000133514319600180897396058e-10)) / fast::max(_949, 0.00999999977648258209228515625);
+ float _967 = ((_946 + _944) + _943) + (1.75 * sqrt(((_946 * (_946 - _944)) + (_944 * (_944 - _943))) + (_943 * (_943 - _946))));
+ float _968 = _967 * 0.3333333432674407958984375;
+ float _969 = _954 - 0.4000000059604644775390625;
+ float _974 = fast::max(1.0 - abs(_969 * 2.5), 0.0);
+ float _982 = (1.0 + (float(int(sign(_969 * 5.0))) * (1.0 - (_974 * _974)))) * 0.02500000037252902984619140625;
+ float _995;
+ if (_968 <= 0.053333334624767303466796875)
+ {
+ _995 = _982;
+ }
+ else
+ {
+ float _994;
+ if (_968 >= 0.1599999964237213134765625)
+ {
+ _994 = 0.0;
+ }
+ else
+ {
+ _994 = _982 * ((0.23999999463558197021484375 / _967) - 0.5);
+ }
+ _995 = _994;
+ }
+ float _996 = 1.0 + _995;
+ float3 _998 = _942 * float3(_996);
+ float _999 = _998.x;
+ float _1000 = _998.y;
+ float _1002 = _998.z;
+ float _1016;
+ if ((_999 == _1000) && (_1000 == _1002))
+ {
+ _1016 = 0.0;
+ }
+ else
+ {
+ _1016 = 57.2957763671875 * atan2(sqrt(3.0) * (_1000 - _1002), ((2.0 * _999) - _1000) - _1002);
+ }
+ float _1021;
+ if (_1016 < 0.0)
+ {
+ _1021 = _1016 + 360.0;
+ }
+ else
+ {
+ _1021 = _1016;
+ }
+ float _1022 = fast::clamp(_1021, 0.0, 360.0);
+ float _1027;
+ if (_1022 > 180.0)
+ {
+ _1027 = _1022 - 360.0;
+ }
+ else
+ {
+ _1027 = _1022;
+ }
+ float _1031 = smoothstep(0.0, 1.0, 1.0 - abs(_1027 * 0.01481481455266475677490234375));
+ float3 _1038 = _998;
+ _1038.x = _999 + ((((_1031 * _1031) * _954) * (0.02999999932944774627685546875 - _999)) * 0.180000007152557373046875);
+ float3 _1040 = fast::max(float3(0.0), _1038 * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)));
+ float _1049 = (1.0 + _Globals.FilmBlackClip) - _Globals.FilmToe;
+ float _1052 = 1.0 + _Globals.FilmWhiteClip;
+ float _1055 = _1052 - _Globals.FilmShoulder;
+ float _1082;
+ if (_Globals.FilmToe > 0.800000011920928955078125)
+ {
+ _1082 = ((0.819999992847442626953125 - _Globals.FilmToe) / _Globals.FilmSlope) + (log(0.180000007152557373046875) / log(10.0));
+ }
+ else
+ {
+ float _1061 = (0.180000007152557373046875 + _Globals.FilmBlackClip) / _1049;
+ _1082 = (log(0.180000007152557373046875) / log(10.0)) - ((0.5 * log(_1061 / (2.0 - _1061))) * (_1049 / _Globals.FilmSlope));
+ }
+ float _1087 = ((1.0 - _Globals.FilmToe) / _Globals.FilmSlope) - _1082;
+ float _1089 = (_Globals.FilmShoulder / _Globals.FilmSlope) - _1087;
+ float _1091 = log(10.0);
+ float3 _1093 = log(mix(float3(dot(_1040, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1040, float3(0.959999978542327880859375))) / float3(_1091);
+ float3 _1097 = float3(_Globals.FilmSlope) * (_1093 + float3(_1087));
+ float3 _1105 = float3(_1082);
+ float3 _1106 = _1093 - _1105;
+ float3 _1111 = float3(-_Globals.FilmBlackClip) + (float3(2.0 * _1049) / (float3(1.0) + exp(float3(((-2.0) * _Globals.FilmSlope) / _1049) * _1106)));
+ float3 _1118 = float3(_1089);
+ float3 _1124 = float3(_1052) - (float3(2.0 * _1055) / (float3(1.0) + exp(float3((2.0 * _Globals.FilmSlope) / _1055) * (_1093 - _1118))));
+ bool3 _1125 = _1093 < _1105;
+ bool3 _1127 = _1093 > _1118;
+ float _1129 = _1089 - _1082;
+ float3 _1132 = fast::clamp(_1106 / float3(_1129), float3(0.0), float3(1.0));
+ bool _1133 = _1089 < _1082;
+ float3 _1134 = float3(1.0) - _1132;
+ bool3 _1135 = bool3(_1133);
+ float3 _1136 = float3(_1135.x ? _1134.x : _1132.x, _1135.y ? _1134.y : _1132.y, _1135.z ? _1134.z : _1132.z);
+ float3 _1141 = mix(float3(_1125.x ? _1111.x : _1097.x, _1125.y ? _1111.y : _1097.y, _1125.z ? _1111.z : _1097.z), float3(_1127.x ? _1124.x : _1097.x, _1127.y ? _1124.y : _1097.y, _1127.z ? _1124.z : _1097.z), ((float3(3.0) - (float3(2.0) * _1136)) * _1136) * _1136);
+ float3 _1145 = fast::max(float3(0.0), mix(float3(dot(_1141, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1141, float3(0.930000007152557373046875)));
+ float3 _1215;
+ if (_Globals.ColorShadow_Tint2.w == 0.0)
+ {
+ float3 _1157 = _3121;
+ _1157.x = dot(_932, _Globals.ColorMatrixR_ColorCurveCd1.xyz);
+ float3 _1162 = _1157;
+ _1162.y = dot(_932, _Globals.ColorMatrixG_ColorCurveCd3Cm3.xyz);
+ float3 _1167 = _1162;
+ _1167.z = dot(_932, _Globals.ColorMatrixB_ColorCurveCm2.xyz);
+ float3 _1183 = fast::max(float3(0.0), _1167 * (_Globals.ColorShadow_Tint1.xyz + (_Globals.ColorShadow_Tint2.xyz * float3(1.0 / (dot(_932, _Globals.ColorShadow_Luma.xyz) + 1.0)))));
+ float3 _1188 = fast::max(float3(0.0), _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.xxx - _1183);
+ float3 _1190 = fast::max(_1183, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.zzz);
+ _1215 = ((((_1190 * _Globals.ColorCurve_Ch1_Ch2.xxx) + _Globals.ColorCurve_Ch1_Ch2.yyy) * (float3(1.0) / (_1190 + _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.www))) + ((fast::clamp(_1183, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.xxx, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.zzz) * _Globals.ColorMatrixB_ColorCurveCm2.www) + (((_1188 * _Globals.ColorMatrixR_ColorCurveCd1.www) * (float3(1.0) / (_1188 + _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.yyy))) + _Globals.ColorMatrixG_ColorCurveCd3Cm3.www))) - float3(0.00200000009499490261077880859375);
+ }
+ else
+ {
+ _1215 = fast::max(float3(0.0), mix(_1145, _1145 * ((_577 * float3x3(float3(1.06317996978759765625, 0.02339559979736804962158203125, -0.08657260239124298095703125), float3(-0.010633699595928192138671875, 1.2063200473785400390625, -0.1956900060176849365234375), float3(-0.0005908869788981974124908447265625, 0.00105247995816171169281005859375, 0.999538004398345947265625))) * _576), _940) * _575);
+ }
+ float3 _1216 = fast::clamp(_1215, float3(0.0), float3(1.0));
+ float _1217 = _1216.x;
+ float _1229;
+ for (;;)
+ {
+ if (_1217 < 0.00313066993840038776397705078125)
+ {
+ _1229 = _1217 * 12.9200000762939453125;
+ break;
+ }
+ _1229 = (pow(_1217, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+ break;
+ }
+ float _1230 = _1216.y;
+ float _1242;
+ for (;;)
+ {
+ if (_1230 < 0.00313066993840038776397705078125)
+ {
+ _1242 = _1230 * 12.9200000762939453125;
+ break;
+ }
+ _1242 = (pow(_1230, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+ break;
+ }
+ float _1243 = _1216.z;
+ float _1255;
+ for (;;)
+ {
+ if (_1243 < 0.00313066993840038776397705078125)
+ {
+ _1255 = _1243 * 12.9200000762939453125;
+ break;
+ }
+ _1255 = (pow(_1243, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+ break;
+ }
+ float3 _1256 = float3(_1229, _1242, _1255);
+ float3 _1258 = (_1256 * float3(0.9375)) + float3(0.03125);
+ float _1270 = (_1258.z * 16.0) - 0.5;
+ float _1271 = floor(_1270);
+ float _1275 = (_1258.x + _1271) * 0.0625;
+ float _1276 = _1258.y;
+ float4 _1279 = Texture1.sample(Texture1Sampler, float2(_1275, _1276));
+ float4 _1283 = Texture1.sample(Texture1Sampler, float2(_1275 + 0.0625, _1276));
+ float3 _1289 = fast::max(float3(6.1035199905745685100555419921875e-05), (float3(_Globals.LUTWeights[0]) * _1256) + (float3(_Globals.LUTWeights[1]) * mix(_1279, _1283, float4(_1270 - _1271)).xyz));
+ bool3 _1290 = _1289 > float3(0.040449999272823333740234375);
+ float3 _1293 = pow((_1289 * float3(0.94786727428436279296875)) + float3(0.0521326996386051177978515625), float3(2.400000095367431640625));
+ float3 _1294 = _1289 * float3(0.077399380505084991455078125);
+ float3 _1295 = float3(_1290.x ? _1293.x : _1294.x, _1290.y ? _1293.y : _1294.y, _1290.z ? _1293.z : _1294.z);
+ float3 _1324 = pow(fast::max(float3(0.0), mix((((float3(_Globals.MappingPolynomial.x) * (_1295 * _1295)) + (float3(_Globals.MappingPolynomial.y) * _1295)) + float3(_Globals.MappingPolynomial.z)) * _Globals.ColorScale, _Globals.OverlayColor.xyz, float3(_Globals.OverlayColor.w))), float3(_Globals.InverseGamma.y));
+ float3 _3103;
+ if (_Globals.OutputDevice == 0u)
+ {
+ float _3063 = _1324.x;
+ float _3075;
+ for (;;)
+ {
+ if (_3063 < 0.00313066993840038776397705078125)
+ {
+ _3075 = _3063 * 12.9200000762939453125;
+ break;
+ }
+ _3075 = (pow(_3063, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+ break;
+ }
+ float _3076 = _1324.y;
+ float _3088;
+ for (;;)
+ {
+ if (_3076 < 0.00313066993840038776397705078125)
+ {
+ _3088 = _3076 * 12.9200000762939453125;
+ break;
+ }
+ _3088 = (pow(_3076, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+ break;
+ }
+ float _3089 = _1324.z;
+ float _3101;
+ for (;;)
+ {
+ if (_3089 < 0.00313066993840038776397705078125)
+ {
+ _3101 = _3089 * 12.9200000762939453125;
+ break;
+ }
+ _3101 = (pow(_3089, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+ break;
+ }
+ _3103 = float3(_3075, _3088, _3101);
+ }
+ else
+ {
+ float3 _3062;
+ if (_Globals.OutputDevice == 1u)
+ {
+ float3 _3055 = fast::max(float3(6.1035199905745685100555419921875e-05), (_1324 * _573) * _602);
+ _3062 = fast::min(_3055 * float3(4.5), (pow(fast::max(_3055, float3(0.017999999225139617919921875)), float3(0.449999988079071044921875)) * float3(1.09899997711181640625)) - float3(0.098999999463558197021484375));
+ }
+ else
+ {
+ float3 _3052;
+ if ((_Globals.OutputDevice == 3u) || (_Globals.OutputDevice == 5u))
+ {
+ float3 _2204 = (_932 * float3(1.5)) * (_572 * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625)));
+ float _2205 = _2204.x;
+ float _2206 = _2204.y;
+ float _2208 = _2204.z;
+ float _2211 = fast::max(fast::max(_2205, _2206), _2208);
+ float _2216 = (fast::max(_2211, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_2205, _2206), _2208), 1.0000000133514319600180897396058e-10)) / fast::max(_2211, 0.00999999977648258209228515625);
+ float _2229 = ((_2208 + _2206) + _2205) + (1.75 * sqrt(((_2208 * (_2208 - _2206)) + (_2206 * (_2206 - _2205))) + (_2205 * (_2205 - _2208))));
+ float _2230 = _2229 * 0.3333333432674407958984375;
+ float _2231 = _2216 - 0.4000000059604644775390625;
+ float _2236 = fast::max(1.0 - abs(_2231 * 2.5), 0.0);
+ float _2244 = (1.0 + (float(int(sign(_2231 * 5.0))) * (1.0 - (_2236 * _2236)))) * 0.02500000037252902984619140625;
+ float _2257;
+ if (_2230 <= 0.053333334624767303466796875)
+ {
+ _2257 = _2244;
+ }
+ else
+ {
+ float _2256;
+ if (_2230 >= 0.1599999964237213134765625)
+ {
+ _2256 = 0.0;
+ }
+ else
+ {
+ _2256 = _2244 * ((0.23999999463558197021484375 / _2229) - 0.5);
+ }
+ _2257 = _2256;
+ }
+ float _2258 = 1.0 + _2257;
+ float3 _2260 = _2204 * float3(_2258);
+ float _2261 = _2260.x;
+ float _2262 = _2260.y;
+ float _2264 = _2260.z;
+ float _2278;
+ if ((_2261 == _2262) && (_2262 == _2264))
+ {
+ _2278 = 0.0;
+ }
+ else
+ {
+ _2278 = 57.2957763671875 * atan2(sqrt(3.0) * (_2262 - _2264), ((2.0 * _2261) - _2262) - _2264);
+ }
+ float _2283;
+ if (_2278 < 0.0)
+ {
+ _2283 = _2278 + 360.0;
+ }
+ else
+ {
+ _2283 = _2278;
+ }
+ float _2284 = fast::clamp(_2283, 0.0, 360.0);
+ float _2289;
+ if (_2284 > 180.0)
+ {
+ _2289 = _2284 - 360.0;
+ }
+ else
+ {
+ _2289 = _2284;
+ }
+ float _2339;
+ if ((_2289 > (-67.5)) && (_2289 < 67.5))
+ {
+ float _2295 = _2289 - (-67.5);
+ float _2296 = _2295 * 0.0296296291053295135498046875;
+ int _2297 = int(_2296);
+ float _2299 = _2296 - float(_2297);
+ float _2300 = _2299 * _2299;
+ float _2301 = _2300 * _2299;
+ float _2338;
+ if (_2297 == 3)
+ {
+ _2338 = (((_2301 * (-0.16666667163372039794921875)) + (_2300 * 0.5)) + (_2299 * (-0.5))) + 0.16666667163372039794921875;
+ }
+ else
+ {
+ float _2331;
+ if (_2297 == 2)
+ {
+ _2331 = ((_2301 * 0.5) + (_2300 * (-1.0))) + 0.666666686534881591796875;
+ }
+ else
+ {
+ float _2326;
+ if (_2297 == 1)
+ {
+ _2326 = (((_2301 * (-0.5)) + (_2300 * 0.5)) + (_2299 * 0.5)) + 0.16666667163372039794921875;
+ }
+ else
+ {
+ float _2319;
+ if (_2297 == 0)
+ {
+ _2319 = _2301 * 0.16666667163372039794921875;
+ }
+ else
+ {
+ _2319 = 0.0;
+ }
+ _2326 = _2319;
+ }
+ _2331 = _2326;
+ }
+ _2338 = _2331;
+ }
+ _2339 = _2338;
+ }
+ else
+ {
+ _2339 = 0.0;
+ }
+ float3 _2346 = _2260;
+ _2346.x = _2261 + ((((_2339 * 1.5) * _2216) * (0.02999999932944774627685546875 - _2261)) * 0.180000007152557373046875);
+ float3 _2349 = fast::clamp(fast::clamp(_2346, float3(0.0), float3(65535.0)) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)), float3(0.0), float3(65535.0));
+ float3 _2352 = mix(float3(dot(_2349, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _2349, float3(0.959999978542327880859375));
+ float _2353 = _2352.x;
+ float _2357 = 0.17999999225139617919921875 * exp2(18.0);
+ float _2359 = exp2(-14.0);
+ float _2362 = log((_2353 <= 0.0) ? _2359 : _2353) / _1091;
+ float _2364 = log(0.17999999225139617919921875 * exp2(-15.0)) / _1091;
+ float _2431;
+ if (_2362 <= _2364)
+ {
+ _2431 = log(9.9999997473787516355514526367188e-05) / _1091;
+ }
+ else
+ {
+ float _2371 = log(0.180000007152557373046875) / _1091;
+ float _2428;
+ if ((_2362 > _2364) && (_2362 < _2371))
+ {
+ float _2411 = (3.0 * (_2362 - _2364)) / (_2371 - _2364);
+ int _2412 = int(_2411);
+ float _2414 = _2411 - float(_2412);
+ _2428 = dot(float3(_2414 * _2414, _2414, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2412], _499[_2412 + 1], _499[_2412 + 2]));
+ }
+ else
+ {
+ float _2379 = log(_2357) / _1091;
+ float _2407;
+ if ((_2362 >= _2371) && (_2362 < _2379))
+ {
+ float _2390 = (3.0 * (_2362 - _2371)) / (_2379 - _2371);
+ int _2391 = int(_2390);
+ float _2393 = _2390 - float(_2391);
+ _2407 = dot(float3(_2393 * _2393, _2393, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2391], _500[_2391 + 1], _500[_2391 + 2]));
+ }
+ else
+ {
+ _2407 = log(10000.0) / _1091;
+ }
+ _2428 = _2407;
+ }
+ _2431 = _2428;
+ }
+ float3 _2433 = _523;
+ _2433.x = pow(10.0, _2431);
+ float _2434 = _2352.y;
+ float _2438 = log((_2434 <= 0.0) ? _2359 : _2434) / _1091;
+ float _2505;
+ if (_2438 <= _2364)
+ {
+ _2505 = log(9.9999997473787516355514526367188e-05) / _1091;
+ }
+ else
+ {
+ float _2445 = log(0.180000007152557373046875) / _1091;
+ float _2502;
+ if ((_2438 > _2364) && (_2438 < _2445))
+ {
+ float _2485 = (3.0 * (_2438 - _2364)) / (_2445 - _2364);
+ int _2486 = int(_2485);
+ float _2488 = _2485 - float(_2486);
+ _2502 = dot(float3(_2488 * _2488, _2488, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2486], _499[_2486 + 1], _499[_2486 + 2]));
+ }
+ else
+ {
+ float _2453 = log(_2357) / _1091;
+ float _2481;
+ if ((_2438 >= _2445) && (_2438 < _2453))
+ {
+ float _2464 = (3.0 * (_2438 - _2445)) / (_2453 - _2445);
+ int _2465 = int(_2464);
+ float _2467 = _2464 - float(_2465);
+ _2481 = dot(float3(_2467 * _2467, _2467, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2465], _500[_2465 + 1], _500[_2465 + 2]));
+ }
+ else
+ {
+ _2481 = log(10000.0) / _1091;
+ }
+ _2502 = _2481;
+ }
+ _2505 = _2502;
+ }
+ float3 _2507 = _2433;
+ _2507.y = pow(10.0, _2505);
+ float _2508 = _2352.z;
+ float _2512 = log((_2508 <= 0.0) ? _2359 : _2508) / _1091;
+ float _2579;
+ if (_2512 <= _2364)
+ {
+ _2579 = log(9.9999997473787516355514526367188e-05) / _1091;
+ }
+ else
+ {
+ float _2519 = log(0.180000007152557373046875) / _1091;
+ float _2576;
+ if ((_2512 > _2364) && (_2512 < _2519))
+ {
+ float _2559 = (3.0 * (_2512 - _2364)) / (_2519 - _2364);
+ int _2560 = int(_2559);
+ float _2562 = _2559 - float(_2560);
+ _2576 = dot(float3(_2562 * _2562, _2562, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2560], _499[_2560 + 1], _499[_2560 + 2]));
+ }
+ else
+ {
+ float _2527 = log(_2357) / _1091;
+ float _2555;
+ if ((_2512 >= _2519) && (_2512 < _2527))
+ {
+ float _2538 = (3.0 * (_2512 - _2519)) / (_2527 - _2519);
+ int _2539 = int(_2538);
+ float _2541 = _2538 - float(_2539);
+ _2555 = dot(float3(_2541 * _2541, _2541, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2539], _500[_2539 + 1], _500[_2539 + 2]));
+ }
+ else
+ {
+ _2555 = log(10000.0) / _1091;
+ }
+ _2576 = _2555;
+ }
+ _2579 = _2576;
+ }
+ float3 _2581 = _2507;
+ _2581.z = pow(10.0, _2579);
+ float3 _2583 = (_2581 * float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625))) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375));
+ float _2585 = 0.17999999225139617919921875 * pow(2.0, -12.0);
+ float _2589 = log((_2585 <= 0.0) ? _2359 : _2585) / _1091;
+ float _2656;
+ if (_2589 <= _2364)
+ {
+ _2656 = log(9.9999997473787516355514526367188e-05) / _1091;
+ }
+ else
+ {
+ float _2596 = log(0.180000007152557373046875) / _1091;
+ float _2653;
+ if ((_2589 > _2364) && (_2589 < _2596))
+ {
+ float _2636 = (3.0 * (_2589 - _2364)) / (_2596 - _2364);
+ int _2637 = int(_2636);
+ float _2639 = _2636 - float(_2637);
+ _2653 = dot(float3(_2639 * _2639, _2639, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2637], _499[_2637 + 1], _499[_2637 + 2]));
+ }
+ else
+ {
+ float _2604 = log(_2357) / _1091;
+ float _2632;
+ if ((_2589 >= _2596) && (_2589 < _2604))
+ {
+ float _2615 = (3.0 * (_2589 - _2596)) / (_2604 - _2596);
+ int _2616 = int(_2615);
+ float _2618 = _2615 - float(_2616);
+ _2632 = dot(float3(_2618 * _2618, _2618, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2616], _500[_2616 + 1], _500[_2616 + 2]));
+ }
+ else
+ {
+ _2632 = log(10000.0) / _1091;
+ }
+ _2653 = _2632;
+ }
+ _2656 = _2653;
+ }
+ float _2657 = pow(10.0, _2656);
+ float _2659 = log(0.180000007152557373046875) / _1091;
+ float _2713;
+ if (_2659 <= _2364)
+ {
+ _2713 = log(9.9999997473787516355514526367188e-05) / _1091;
+ }
+ else
+ {
+ float _2710;
+ if ((_2659 > _2364) && (_2659 < _2659))
+ {
+ _2710 = (float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(-0.485249996185302734375, 1.84773242473602294921875, 1.84773242473602294921875)).z;
+ }
+ else
+ {
+ float _2672 = log(_2357) / _1091;
+ float _2700;
+ if ((_2659 >= _2659) && (_2659 < _2672))
+ {
+ float _2683 = (3.0 * (_2659 - _2659)) / (_2672 - _2659);
+ int _2684 = int(_2683);
+ float _2686 = _2683 - float(_2684);
+ _2700 = dot(float3(_2686 * _2686, _2686, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2684], _500[_2684 + 1], _500[_2684 + 2]));
+ }
+ else
+ {
+ _2700 = log(10000.0) / _1091;
+ }
+ _2710 = _2700;
+ }
+ _2713 = _2710;
+ }
+ float _2714 = pow(10.0, _2713);
+ float _2716 = 0.17999999225139617919921875 * pow(2.0, 10.0);
+ float _2720 = log((_2716 <= 0.0) ? _2359 : _2716) / _1091;
+ float _2785;
+ if (_2720 <= _2364)
+ {
+ _2785 = log(9.9999997473787516355514526367188e-05) / _1091;
+ }
+ else
+ {
+ float _2782;
+ if ((_2720 > _2364) && (_2720 < _2659))
+ {
+ float _2765 = (3.0 * (_2720 - _2364)) / (_2659 - _2364);
+ int _2766 = int(_2765);
+ float _2768 = _2765 - float(_2766);
+ _2782 = dot(float3(_2768 * _2768, _2768, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2766], _499[_2766 + 1], _499[_2766 + 2]));
+ }
+ else
+ {
+ float _2733 = log(_2357) / _1091;
+ float _2761;
+ if ((_2720 >= _2659) && (_2720 < _2733))
+ {
+ float _2744 = (3.0 * (_2720 - _2659)) / (_2733 - _2659);
+ int _2745 = int(_2744);
+ float _2747 = _2744 - float(_2745);
+ _2761 = dot(float3(_2747 * _2747, _2747, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2745], _500[_2745 + 1], _500[_2745 + 2]));
+ }
+ else
+ {
+ _2761 = log(10000.0) / _1091;
+ }
+ _2782 = _2761;
+ }
+ _2785 = _2782;
+ }
+ float _2786 = pow(10.0, _2785);
+ float _2787 = _2583.x;
+ float _2791 = log((_2787 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2787) / _1091;
+ float _2792 = log(_2657);
+ float _2793 = _2792 / _1091;
+ float _2870;
+ if (_2791 <= _2793)
+ {
+ _2870 = (_2791 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1091) - ((3.0 * _2792) / _1091));
+ }
+ else
+ {
+ float _2800 = log(_2714) / _1091;
+ float _2862;
+ if ((_2791 > _2793) && (_2791 < _2800))
+ {
+ float _2845 = (7.0 * (_2791 - _2793)) / (_2800 - _2793);
+ int _2846 = int(_2845);
+ float _2848 = _2845 - float(_2846);
+ _2862 = dot(float3(_2848 * _2848, _2848, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_503[_2846], _503[_2846 + 1], _503[_2846 + 2]));
+ }
+ else
+ {
+ float _2807 = log(_2786);
+ float _2808 = _2807 / _1091;
+ float _2841;
+ if ((_2791 >= _2800) && (_2791 < _2808))
+ {
+ float _2824 = (7.0 * (_2791 - _2800)) / (_2808 - _2800);
+ int _2825 = int(_2824);
+ float _2827 = _2824 - float(_2825);
+ _2841 = dot(float3(_2827 * _2827, _2827, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_504[_2825], _504[_2825 + 1], _504[_2825 + 2]));
+ }
+ else
+ {
+ _2841 = (_2791 * 0.0599999986588954925537109375) + ((log(1000.0) / _1091) - ((0.0599999986588954925537109375 * _2807) / _1091));
+ }
+ _2862 = _2841;
+ }
+ _2870 = _2862;
+ }
+ float3 _2872 = _523;
+ _2872.x = pow(10.0, _2870);
+ float _2873 = _2583.y;
+ float _2877 = log((_2873 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2873) / _1091;
+ float _2954;
+ if (_2877 <= _2793)
+ {
+ _2954 = (_2877 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1091) - ((3.0 * _2792) / _1091));
+ }
+ else
+ {
+ float _2884 = log(_2714) / _1091;
+ float _2946;
+ if ((_2877 > _2793) && (_2877 < _2884))
+ {
+ float _2929 = (7.0 * (_2877 - _2793)) / (_2884 - _2793);
+ int _2930 = int(_2929);
+ float _2932 = _2929 - float(_2930);
+ _2946 = dot(float3(_2932 * _2932, _2932, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_503[_2930], _503[_2930 + 1], _503[_2930 + 2]));
+ }
+ else
+ {
+ float _2891 = log(_2786);
+ float _2892 = _2891 / _1091;
+ float _2925;
+ if ((_2877 >= _2884) && (_2877 < _2892))
+ {
+ float _2908 = (7.0 * (_2877 - _2884)) / (_2892 - _2884);
+ int _2909 = int(_2908);
+ float _2911 = _2908 - float(_2909);
+ _2925 = dot(float3(_2911 * _2911, _2911, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_504[_2909], _504[_2909 + 1], _504[_2909 + 2]));
+ }
+ else
+ {
+ _2925 = (_2877 * 0.0599999986588954925537109375) + ((log(1000.0) / _1091) - ((0.0599999986588954925537109375 * _2891) / _1091));
+ }
+ _2946 = _2925;
+ }
+ _2954 = _2946;
+ }
+ float3 _2956 = _2872;
+ _2956.y = pow(10.0, _2954);
+ float _2957 = _2583.z;
+ float _2961 = log((_2957 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2957) / _1091;
+ float _3038;
+ if (_2961 <= _2793)
+ {
+ _3038 = (_2961 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1091) - ((3.0 * _2792) / _1091));
+ }
+ else
+ {
+ float _2968 = log(_2714) / _1091;
+ float _3030;
+ if ((_2961 > _2793) && (_2961 < _2968))
+ {
+ float _3013 = (7.0 * (_2961 - _2793)) / (_2968 - _2793);
+ int _3014 = int(_3013);
+ float _3016 = _3013 - float(_3014);
+ _3030 = dot(float3(_3016 * _3016, _3016, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_503[_3014], _503[_3014 + 1], _503[_3014 + 2]));
+ }
+ else
+ {
+ float _2975 = log(_2786);
+ float _2976 = _2975 / _1091;
+ float _3009;
+ if ((_2961 >= _2968) && (_2961 < _2976))
+ {
+ float _2992 = (7.0 * (_2961 - _2968)) / (_2976 - _2968);
+ int _2993 = int(_2992);
+ float _2995 = _2992 - float(_2993);
+ _3009 = dot(float3(_2995 * _2995, _2995, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_504[_2993], _504[_2993 + 1], _504[_2993 + 2]));
+ }
+ else
+ {
+ _3009 = (_2961 * 0.0599999986588954925537109375) + ((log(1000.0) / _1091) - ((0.0599999986588954925537109375 * _2975) / _1091));
+ }
+ _3030 = _3009;
+ }
+ _3038 = _3030;
+ }
+ float3 _3040 = _2956;
+ _3040.z = pow(10.0, _3038);
+ float3 _3044 = pow(((_3040 - float3(3.5073844628641381859779357910156e-05)) * _602) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125));
+ _3052 = pow((float3(0.8359375) + (float3(18.8515625) * _3044)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _3044))), float3(78.84375));
+ }
+ else
+ {
+ float3 _2201;
+ if ((_Globals.OutputDevice == 4u) || (_Globals.OutputDevice == 6u))
+ {
+ float3 _1369 = (_932 * float3(1.5)) * (_572 * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625)));
+ float _1370 = _1369.x;
+ float _1371 = _1369.y;
+ float _1373 = _1369.z;
+ float _1376 = fast::max(fast::max(_1370, _1371), _1373);
+ float _1381 = (fast::max(_1376, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_1370, _1371), _1373), 1.0000000133514319600180897396058e-10)) / fast::max(_1376, 0.00999999977648258209228515625);
+ float _1394 = ((_1373 + _1371) + _1370) + (1.75 * sqrt(((_1373 * (_1373 - _1371)) + (_1371 * (_1371 - _1370))) + (_1370 * (_1370 - _1373))));
+ float _1395 = _1394 * 0.3333333432674407958984375;
+ float _1396 = _1381 - 0.4000000059604644775390625;
+ float _1401 = fast::max(1.0 - abs(_1396 * 2.5), 0.0);
+ float _1409 = (1.0 + (float(int(sign(_1396 * 5.0))) * (1.0 - (_1401 * _1401)))) * 0.02500000037252902984619140625;
+ float _1422;
+ if (_1395 <= 0.053333334624767303466796875)
+ {
+ _1422 = _1409;
+ }
+ else
+ {
+ float _1421;
+ if (_1395 >= 0.1599999964237213134765625)
+ {
+ _1421 = 0.0;
+ }
+ else
+ {
+ _1421 = _1409 * ((0.23999999463558197021484375 / _1394) - 0.5);
+ }
+ _1422 = _1421;
+ }
+ float _1423 = 1.0 + _1422;
+ float3 _1425 = _1369 * float3(_1423);
+ float _1426 = _1425.x;
+ float _1427 = _1425.y;
+ float _1429 = _1425.z;
+ float _1443;
+ if ((_1426 == _1427) && (_1427 == _1429))
+ {
+ _1443 = 0.0;
+ }
+ else
+ {
+ _1443 = 57.2957763671875 * atan2(sqrt(3.0) * (_1427 - _1429), ((2.0 * _1426) - _1427) - _1429);
+ }
+ float _1448;
+ if (_1443 < 0.0)
+ {
+ _1448 = _1443 + 360.0;
+ }
+ else
+ {
+ _1448 = _1443;
+ }
+ float _1449 = fast::clamp(_1448, 0.0, 360.0);
+ float _1454;
+ if (_1449 > 180.0)
+ {
+ _1454 = _1449 - 360.0;
+ }
+ else
+ {
+ _1454 = _1449;
+ }
+ float _1504;
+ if ((_1454 > (-67.5)) && (_1454 < 67.5))
+ {
+ float _1460 = _1454 - (-67.5);
+ float _1461 = _1460 * 0.0296296291053295135498046875;
+ int _1462 = int(_1461);
+ float _1464 = _1461 - float(_1462);
+ float _1465 = _1464 * _1464;
+ float _1466 = _1465 * _1464;
+ float _1503;
+ if (_1462 == 3)
+ {
+ _1503 = (((_1466 * (-0.16666667163372039794921875)) + (_1465 * 0.5)) + (_1464 * (-0.5))) + 0.16666667163372039794921875;
+ }
+ else
+ {
+ float _1496;
+ if (_1462 == 2)
+ {
+ _1496 = ((_1466 * 0.5) + (_1465 * (-1.0))) + 0.666666686534881591796875;
+ }
+ else
+ {
+ float _1491;
+ if (_1462 == 1)
+ {
+ _1491 = (((_1466 * (-0.5)) + (_1465 * 0.5)) + (_1464 * 0.5)) + 0.16666667163372039794921875;
+ }
+ else
+ {
+ float _1484;
+ if (_1462 == 0)
+ {
+ _1484 = _1466 * 0.16666667163372039794921875;
+ }
+ else
+ {
+ _1484 = 0.0;
+ }
+ _1491 = _1484;
+ }
+ _1496 = _1491;
+ }
+ _1503 = _1496;
+ }
+ _1504 = _1503;
+ }
+ else
+ {
+ _1504 = 0.0;
+ }
+ float3 _1511 = _1425;
+ _1511.x = _1426 + ((((_1504 * 1.5) * _1381) * (0.02999999932944774627685546875 - _1426)) * 0.180000007152557373046875);
+ float3 _1514 = fast::clamp(fast::clamp(_1511, float3(0.0), float3(65535.0)) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)), float3(0.0), float3(65535.0));
+ float3 _1517 = mix(float3(dot(_1514, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1514, float3(0.959999978542327880859375));
+ float _1518 = _1517.x;
+ float _1522 = 0.17999999225139617919921875 * exp2(18.0);
+ float _1524 = exp2(-14.0);
+ float _1527 = log((_1518 <= 0.0) ? _1524 : _1518) / _1091;
+ float _1529 = log(0.17999999225139617919921875 * exp2(-15.0)) / _1091;
+ float _1596;
+ if (_1527 <= _1529)
+ {
+ _1596 = log(9.9999997473787516355514526367188e-05) / _1091;
+ }
+ else
+ {
+ float _1536 = log(0.180000007152557373046875) / _1091;
+ float _1593;
+ if ((_1527 > _1529) && (_1527 < _1536))
+ {
+ float _1576 = (3.0 * (_1527 - _1529)) / (_1536 - _1529);
+ int _1577 = int(_1576);
+ float _1579 = _1576 - float(_1577);
+ _1593 = dot(float3(_1579 * _1579, _1579, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1577], _499[_1577 + 1], _499[_1577 + 2]));
+ }
+ else
+ {
+ float _1544 = log(_1522) / _1091;
+ float _1572;
+ if ((_1527 >= _1536) && (_1527 < _1544))
+ {
+ float _1555 = (3.0 * (_1527 - _1536)) / (_1544 - _1536);
+ int _1556 = int(_1555);
+ float _1558 = _1555 - float(_1556);
+ _1572 = dot(float3(_1558 * _1558, _1558, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1556], _500[_1556 + 1], _500[_1556 + 2]));
+ }
+ else
+ {
+ _1572 = log(10000.0) / _1091;
+ }
+ _1593 = _1572;
+ }
+ _1596 = _1593;
+ }
+ float3 _1598 = _523;
+ _1598.x = pow(10.0, _1596);
+ float _1599 = _1517.y;
+ float _1603 = log((_1599 <= 0.0) ? _1524 : _1599) / _1091;
+ float _1670;
+ if (_1603 <= _1529)
+ {
+ _1670 = log(9.9999997473787516355514526367188e-05) / _1091;
+ }
+ else
+ {
+ float _1610 = log(0.180000007152557373046875) / _1091;
+ float _1667;
+ if ((_1603 > _1529) && (_1603 < _1610))
+ {
+ float _1650 = (3.0 * (_1603 - _1529)) / (_1610 - _1529);
+ int _1651 = int(_1650);
+ float _1653 = _1650 - float(_1651);
+ _1667 = dot(float3(_1653 * _1653, _1653, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1651], _499[_1651 + 1], _499[_1651 + 2]));
+ }
+ else
+ {
+ float _1618 = log(_1522) / _1091;
+ float _1646;
+ if ((_1603 >= _1610) && (_1603 < _1618))
+ {
+ float _1629 = (3.0 * (_1603 - _1610)) / (_1618 - _1610);
+ int _1630 = int(_1629);
+ float _1632 = _1629 - float(_1630);
+ _1646 = dot(float3(_1632 * _1632, _1632, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1630], _500[_1630 + 1], _500[_1630 + 2]));
+ }
+ else
+ {
+ _1646 = log(10000.0) / _1091;
+ }
+ _1667 = _1646;
+ }
+ _1670 = _1667;
+ }
+ float3 _1672 = _1598;
+ _1672.y = pow(10.0, _1670);
+ float _1673 = _1517.z;
+ float _1677 = log((_1673 <= 0.0) ? _1524 : _1673) / _1091;
+ float _1744;
+ if (_1677 <= _1529)
+ {
+ _1744 = log(9.9999997473787516355514526367188e-05) / _1091;
+ }
+ else
+ {
+ float _1684 = log(0.180000007152557373046875) / _1091;
+ float _1741;
+ if ((_1677 > _1529) && (_1677 < _1684))
+ {
+ float _1724 = (3.0 * (_1677 - _1529)) / (_1684 - _1529);
+ int _1725 = int(_1724);
+ float _1727 = _1724 - float(_1725);
+ _1741 = dot(float3(_1727 * _1727, _1727, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1725], _499[_1725 + 1], _499[_1725 + 2]));
+ }
+ else
+ {
+ float _1692 = log(_1522) / _1091;
+ float _1720;
+ if ((_1677 >= _1684) && (_1677 < _1692))
+ {
+ float _1703 = (3.0 * (_1677 - _1684)) / (_1692 - _1684);
+ int _1704 = int(_1703);
+ float _1706 = _1703 - float(_1704);
+ _1720 = dot(float3(_1706 * _1706, _1706, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1704], _500[_1704 + 1], _500[_1704 + 2]));
+ }
+ else
+ {
+ _1720 = log(10000.0) / _1091;
+ }
+ _1741 = _1720;
+ }
+ _1744 = _1741;
+ }
+ float3 _1746 = _1672;
+ _1746.z = pow(10.0, _1744);
+ float3 _1748 = (_1746 * float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625))) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375));
+ float _1750 = 0.17999999225139617919921875 * pow(2.0, -12.0);
+ float _1754 = log((_1750 <= 0.0) ? _1524 : _1750) / _1091;
+ float _1821;
+ if (_1754 <= _1529)
+ {
+ _1821 = log(9.9999997473787516355514526367188e-05) / _1091;
+ }
+ else
+ {
+ float _1761 = log(0.180000007152557373046875) / _1091;
+ float _1818;
+ if ((_1754 > _1529) && (_1754 < _1761))
+ {
+ float _1801 = (3.0 * (_1754 - _1529)) / (_1761 - _1529);
+ int _1802 = int(_1801);
+ float _1804 = _1801 - float(_1802);
+ _1818 = dot(float3(_1804 * _1804, _1804, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1802], _499[_1802 + 1], _499[_1802 + 2]));
+ }
+ else
+ {
+ float _1769 = log(_1522) / _1091;
+ float _1797;
+ if ((_1754 >= _1761) && (_1754 < _1769))
+ {
+ float _1780 = (3.0 * (_1754 - _1761)) / (_1769 - _1761);
+ int _1781 = int(_1780);
+ float _1783 = _1780 - float(_1781);
+ _1797 = dot(float3(_1783 * _1783, _1783, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1781], _500[_1781 + 1], _500[_1781 + 2]));
+ }
+ else
+ {
+ _1797 = log(10000.0) / _1091;
+ }
+ _1818 = _1797;
+ }
+ _1821 = _1818;
+ }
+ float _1822 = pow(10.0, _1821);
+ float _1824 = log(0.180000007152557373046875) / _1091;
+ float _1878;
+ if (_1824 <= _1529)
+ {
+ _1878 = log(9.9999997473787516355514526367188e-05) / _1091;
+ }
+ else
+ {
+ float _1875;
+ if ((_1824 > _1529) && (_1824 < _1824))
+ {
+ _1875 = (float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(-0.485249996185302734375, 1.84773242473602294921875, 1.84773242473602294921875)).z;
+ }
+ else
+ {
+ float _1837 = log(_1522) / _1091;
+ float _1865;
+ if ((_1824 >= _1824) && (_1824 < _1837))
+ {
+ float _1848 = (3.0 * (_1824 - _1824)) / (_1837 - _1824);
+ int _1849 = int(_1848);
+ float _1851 = _1848 - float(_1849);
+ _1865 = dot(float3(_1851 * _1851, _1851, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1849], _500[_1849 + 1], _500[_1849 + 2]));
+ }
+ else
+ {
+ _1865 = log(10000.0) / _1091;
+ }
+ _1875 = _1865;
+ }
+ _1878 = _1875;
+ }
+ float _1879 = pow(10.0, _1878);
+ float _1881 = 0.17999999225139617919921875 * pow(2.0, 11.0);
+ float _1885 = log((_1881 <= 0.0) ? _1524 : _1881) / _1091;
+ float _1950;
+ if (_1885 <= _1529)
+ {
+ _1950 = log(9.9999997473787516355514526367188e-05) / _1091;
+ }
+ else
+ {
+ float _1947;
+ if ((_1885 > _1529) && (_1885 < _1824))
+ {
+ float _1930 = (3.0 * (_1885 - _1529)) / (_1824 - _1529);
+ int _1931 = int(_1930);
+ float _1933 = _1930 - float(_1931);
+ _1947 = dot(float3(_1933 * _1933, _1933, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1931], _499[_1931 + 1], _499[_1931 + 2]));
+ }
+ else
+ {
+ float _1898 = log(_1522) / _1091;
+ float _1926;
+ if ((_1885 >= _1824) && (_1885 < _1898))
+ {
+ float _1909 = (3.0 * (_1885 - _1824)) / (_1898 - _1824);
+ int _1910 = int(_1909);
+ float _1912 = _1909 - float(_1910);
+ _1926 = dot(float3(_1912 * _1912, _1912, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1910], _500[_1910 + 1], _500[_1910 + 2]));
+ }
+ else
+ {
+ _1926 = log(10000.0) / _1091;
+ }
+ _1947 = _1926;
+ }
+ _1950 = _1947;
+ }
+ float _1951 = pow(10.0, _1950);
+ float _1952 = _1748.x;
+ float _1956 = log((_1952 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _1952) / _1091;
+ float _1958 = log(_1822) / _1091;
+ float _2030;
+ if (_1956 <= _1958)
+ {
+ _2030 = log(0.004999999888241291046142578125) / _1091;
+ }
+ else
+ {
+ float _1965 = log(_1879) / _1091;
+ float _2027;
+ if ((_1956 > _1958) && (_1956 < _1965))
+ {
+ float _2010 = (7.0 * (_1956 - _1958)) / (_1965 - _1958);
+ int _2011 = int(_2010);
+ float _2013 = _2010 - float(_2011);
+ _2027 = dot(float3(_2013 * _2013, _2013, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_506[_2011], _506[_2011 + 1], _506[_2011 + 2]));
+ }
+ else
+ {
+ float _1972 = log(_1951);
+ float _1973 = _1972 / _1091;
+ float _2006;
+ if ((_1956 >= _1965) && (_1956 < _1973))
+ {
+ float _1989 = (7.0 * (_1956 - _1965)) / (_1973 - _1965);
+ int _1990 = int(_1989);
+ float _1992 = _1989 - float(_1990);
+ _2006 = dot(float3(_1992 * _1992, _1992, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_507[_1990], _507[_1990 + 1], _507[_1990 + 2]));
+ }
+ else
+ {
+ _2006 = (_1956 * 0.119999997317790985107421875) + ((log(2000.0) / _1091) - ((0.119999997317790985107421875 * _1972) / _1091));
+ }
+ _2027 = _2006;
+ }
+ _2030 = _2027;
+ }
+ float3 _2032 = _523;
+ _2032.x = pow(10.0, _2030);
+ float _2033 = _1748.y;
+ float _2037 = log((_2033 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2033) / _1091;
+ float _2109;
+ if (_2037 <= _1958)
+ {
+ _2109 = log(0.004999999888241291046142578125) / _1091;
+ }
+ else
+ {
+ float _2044 = log(_1879) / _1091;
+ float _2106;
+ if ((_2037 > _1958) && (_2037 < _2044))
+ {
+ float _2089 = (7.0 * (_2037 - _1958)) / (_2044 - _1958);
+ int _2090 = int(_2089);
+ float _2092 = _2089 - float(_2090);
+ _2106 = dot(float3(_2092 * _2092, _2092, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_506[_2090], _506[_2090 + 1], _506[_2090 + 2]));
+ }
+ else
+ {
+ float _2051 = log(_1951);
+ float _2052 = _2051 / _1091;
+ float _2085;
+ if ((_2037 >= _2044) && (_2037 < _2052))
+ {
+ float _2068 = (7.0 * (_2037 - _2044)) / (_2052 - _2044);
+ int _2069 = int(_2068);
+ float _2071 = _2068 - float(_2069);
+ _2085 = dot(float3(_2071 * _2071, _2071, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_507[_2069], _507[_2069 + 1], _507[_2069 + 2]));
+ }
+ else
+ {
+ _2085 = (_2037 * 0.119999997317790985107421875) + ((log(2000.0) / _1091) - ((0.119999997317790985107421875 * _2051) / _1091));
+ }
+ _2106 = _2085;
+ }
+ _2109 = _2106;
+ }
+ float3 _2111 = _2032;
+ _2111.y = pow(10.0, _2109);
+ float _2112 = _1748.z;
+ float _2116 = log((_2112 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2112) / _1091;
+ float _2188;
+ if (_2116 <= _1958)
+ {
+ _2188 = log(0.004999999888241291046142578125) / _1091;
+ }
+ else
+ {
+ float _2123 = log(_1879) / _1091;
+ float _2185;
+ if ((_2116 > _1958) && (_2116 < _2123))
+ {
+ float _2168 = (7.0 * (_2116 - _1958)) / (_2123 - _1958);
+ int _2169 = int(_2168);
+ float _2171 = _2168 - float(_2169);
+ _2185 = dot(float3(_2171 * _2171, _2171, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_506[_2169], _506[_2169 + 1], _506[_2169 + 2]));
+ }
+ else
+ {
+ float _2130 = log(_1951);
+ float _2131 = _2130 / _1091;
+ float _2164;
+ if ((_2116 >= _2123) && (_2116 < _2131))
+ {
+ float _2147 = (7.0 * (_2116 - _2123)) / (_2131 - _2123);
+ int _2148 = int(_2147);
+ float _2150 = _2147 - float(_2148);
+ _2164 = dot(float3(_2150 * _2150, _2150, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_507[_2148], _507[_2148 + 1], _507[_2148 + 2]));
+ }
+ else
+ {
+ _2164 = (_2116 * 0.119999997317790985107421875) + ((log(2000.0) / _1091) - ((0.119999997317790985107421875 * _2130) / _1091));
+ }
+ _2185 = _2164;
+ }
+ _2188 = _2185;
+ }
+ float3 _2190 = _2111;
+ _2190.z = pow(10.0, _2188);
+ float3 _2193 = pow((_2190 * _602) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125));
+ _2201 = pow((float3(0.8359375) + (float3(18.8515625) * _2193)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _2193))), float3(78.84375));
+ }
+ else
+ {
+ float3 _1366;
+ if (_Globals.OutputDevice == 7u)
+ {
+ float3 _1358 = pow(((_932 * _573) * _602) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125));
+ _1366 = pow((float3(0.8359375) + (float3(18.8515625) * _1358)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _1358))), float3(78.84375));
+ }
+ else
+ {
+ _1366 = pow((_1324 * _573) * _602, float3(_Globals.InverseGamma.z));
+ }
+ _2201 = _1366;
+ }
+ _3052 = _2201;
+ }
+ _3062 = _3052;
+ }
+ _3103 = _3062;
+ }
+ float3 _3104 = _3103 * float3(0.95238101482391357421875);
+ float4 _3106 = float4(_3104.x, _3104.y, _3104.z, float4(0.0).w);
+ _3106.w = 0.0;
+ out.out_var_SV_Target0 = _3106;
+ return out;
+}
+
diff --git a/reference/opt/shaders-msl/asm/ue4/texture_buffer/ShadowDepthVertexShader.dxc.asm.vert b/reference/opt/shaders-msl/asm/ue4/texture_buffer/ShadowDepthVertexShader.dxc.asm.vert
new file mode 100644
index 00000000..72ec65ba
--- /dev/null
+++ b/reference/opt/shaders-msl/asm/ue4/texture_buffer/ShadowDepthVertexShader.dxc.asm.vert
@@ -0,0 +1,390 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct type_View
+{
+ float4x4 View_TranslatedWorldToClip;
+ float4x4 View_WorldToClip;
+ float4x4 View_TranslatedWorldToView;
+ float4x4 View_ViewToTranslatedWorld;
+ float4x4 View_TranslatedWorldToCameraView;
+ float4x4 View_CameraViewToTranslatedWorld;
+ float4x4 View_ViewToClip;
+ float4x4 View_ViewToClipNoAA;
+ float4x4 View_ClipToView;
+ float4x4 View_ClipToTranslatedWorld;
+ float4x4 View_SVPositionToTranslatedWorld;
+ float4x4 View_ScreenToWorld;
+ float4x4 View_ScreenToTranslatedWorld;
+ packed_float3 View_ViewForward;
+ float PrePadding_View_844;
+ packed_float3 View_ViewUp;
+ float PrePadding_View_860;
+ packed_float3 View_ViewRight;
+ float PrePadding_View_876;
+ packed_float3 View_HMDViewNoRollUp;
+ float PrePadding_View_892;
+ packed_float3 View_HMDViewNoRollRight;
+ float PrePadding_View_908;
+ float4 View_InvDeviceZToWorldZTransform;
+ float4 View_ScreenPositionScaleBias;
+ packed_float3 View_WorldCameraOrigin;
+ float PrePadding_View_956;
+ packed_float3 View_TranslatedWorldCameraOrigin;
+ float PrePadding_View_972;
+ packed_float3 View_WorldViewOrigin;
+ float PrePadding_View_988;
+ packed_float3 View_PreViewTranslation;
+ float PrePadding_View_1004;
+ float4x4 View_PrevProjection;
+ float4x4 View_PrevViewProj;
+ float4x4 View_PrevViewRotationProj;
+ float4x4 View_PrevViewToClip;
+ float4x4 View_PrevClipToView;
+ float4x4 View_PrevTranslatedWorldToClip;
+ float4x4 View_PrevTranslatedWorldToView;
+ float4x4 View_PrevViewToTranslatedWorld;
+ float4x4 View_PrevTranslatedWorldToCameraView;
+ float4x4 View_PrevCameraViewToTranslatedWorld;
+ packed_float3 View_PrevWorldCameraOrigin;
+ float PrePadding_View_1660;
+ packed_float3 View_PrevWorldViewOrigin;
+ float PrePadding_View_1676;
+ packed_float3 View_PrevPreViewTranslation;
+ float PrePadding_View_1692;
+ float4x4 View_PrevInvViewProj;
+ float4x4 View_PrevScreenToTranslatedWorld;
+ float4x4 View_ClipToPrevClip;
+ float4 View_TemporalAAJitter;
+ float4 View_GlobalClippingPlane;
+ float2 View_FieldOfViewWideAngles;
+ float2 View_PrevFieldOfViewWideAngles;
+ float4 View_ViewRectMin;
+ float4 View_ViewSizeAndInvSize;
+ float4 View_BufferSizeAndInvSize;
+ float4 View_BufferBilinearUVMinMax;
+ int View_NumSceneColorMSAASamples;
+ float View_PreExposure;
+ float View_OneOverPreExposure;
+ float PrePadding_View_2012;
+ float4 View_DiffuseOverrideParameter;
+ float4 View_SpecularOverrideParameter;
+ float4 View_NormalOverrideParameter;
+ float2 View_RoughnessOverrideParameter;
+ float View_PrevFrameGameTime;
+ float View_PrevFrameRealTime;
+ float View_OutOfBoundsMask;
+ float PrePadding_View_2084;
+ float PrePadding_View_2088;
+ float PrePadding_View_2092;
+ packed_float3 View_WorldCameraMovementSinceLastFrame;
+ float View_CullingSign;
+ float View_NearPlane;
+ float View_AdaptiveTessellationFactor;
+ float View_GameTime;
+ float View_RealTime;
+ float View_DeltaTime;
+ float View_MaterialTextureMipBias;
+ float View_MaterialTextureDerivativeMultiply;
+ uint View_Random;
+ uint View_FrameNumber;
+ uint View_StateFrameIndexMod8;
+ uint View_StateFrameIndex;
+ float View_CameraCut;
+ float View_UnlitViewmodeMask;
+ float PrePadding_View_2164;
+ float PrePadding_View_2168;
+ float PrePadding_View_2172;
+ float4 View_DirectionalLightColor;
+ packed_float3 View_DirectionalLightDirection;
+ float PrePadding_View_2204;
+ float4 View_TranslucencyLightingVolumeMin[2];
+ float4 View_TranslucencyLightingVolumeInvSize[2];
+ float4 View_TemporalAAParams;
+ float4 View_CircleDOFParams;
+ float View_DepthOfFieldSensorWidth;
+ float View_DepthOfFieldFocalDistance;
+ float View_DepthOfFieldScale;
+ float View_DepthOfFieldFocalLength;
+ float View_DepthOfFieldFocalRegion;
+ float View_DepthOfFieldNearTransitionRegion;
+ float View_DepthOfFieldFarTransitionRegion;
+ float View_MotionBlurNormalizedToPixel;
+ float View_bSubsurfacePostprocessEnabled;
+ float View_GeneralPurposeTweak;
+ float View_DemosaicVposOffset;
+ float PrePadding_View_2348;
+ packed_float3 View_IndirectLightingColorScale;
+ float View_HDR32bppEncodingMode;
+ packed_float3 View_AtmosphericFogSunDirection;
+ float View_AtmosphericFogSunPower;
+ float View_AtmosphericFogPower;
+ float View_AtmosphericFogDensityScale;
+ float View_AtmosphericFogDensityOffset;
+ float View_AtmosphericFogGroundOffset;
+ float View_AtmosphericFogDistanceScale;
+ float View_AtmosphericFogAltitudeScale;
+ float View_AtmosphericFogHeightScaleRayleigh;
+ float View_AtmosphericFogStartDistance;
+ float View_AtmosphericFogDistanceOffset;
+ float View_AtmosphericFogSunDiscScale;
+ uint View_AtmosphericFogRenderMask;
+ uint View_AtmosphericFogInscatterAltitudeSampleNum;
+ float4 View_AtmosphericFogSunColor;
+ packed_float3 View_NormalCurvatureToRoughnessScaleBias;
+ float View_RenderingReflectionCaptureMask;
+ float4 View_AmbientCubemapTint;
+ float View_AmbientCubemapIntensity;
+ float View_SkyLightParameters;
+ float PrePadding_View_2488;
+ float PrePadding_View_2492;
+ float4 View_SkyLightColor;
+ float4 View_SkyIrradianceEnvironmentMap[7];
+ float View_MobilePreviewMode;
+ float View_HMDEyePaddingOffset;
+ float View_ReflectionCubemapMaxMip;
+ float View_ShowDecalsMask;
+ uint View_DistanceFieldAOSpecularOcclusionMode;
+ float View_IndirectCapsuleSelfShadowingIntensity;
+ float PrePadding_View_2648;
+ float PrePadding_View_2652;
+ packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
+ int View_StereoPassIndex;
+ float4 View_GlobalVolumeCenterAndExtent[4];
+ float4 View_GlobalVolumeWorldToUVAddAndMul[4];
+ float View_GlobalVolumeDimension;
+ float View_GlobalVolumeTexelSize;
+ float View_MaxGlobalDistance;
+ float View_bCheckerboardSubsurfaceProfileRendering;
+ packed_float3 View_VolumetricFogInvGridSize;
+ float PrePadding_View_2828;
+ packed_float3 View_VolumetricFogGridZParams;
+ float PrePadding_View_2844;
+ float2 View_VolumetricFogSVPosToVolumeUV;
+ float View_VolumetricFogMaxDistance;
+ float PrePadding_View_2860;
+ packed_float3 View_VolumetricLightmapWorldToUVScale;
+ float PrePadding_View_2876;
+ packed_float3 View_VolumetricLightmapWorldToUVAdd;
+ float PrePadding_View_2892;
+ packed_float3 View_VolumetricLightmapIndirectionTextureSize;
+ float View_VolumetricLightmapBrickSize;
+ packed_float3 View_VolumetricLightmapBrickTexelSize;
+ float View_StereoIPD;
+ float View_IndirectLightingCacheShowFlag;
+ float View_EyeToPixelSpreadAngle;
+};
+
+struct type_Primitive
+{
+ float4x4 Primitive_LocalToWorld;
+ float4 Primitive_InvNonUniformScaleAndDeterminantSign;
+ float4 Primitive_ObjectWorldPositionAndRadius;
+ float4x4 Primitive_WorldToLocal;
+ float4x4 Primitive_PreviousLocalToWorld;
+ float4x4 Primitive_PreviousWorldToLocal;
+ packed_float3 Primitive_ActorWorldPosition;
+ float Primitive_UseSingleSampleShadowFromStationaryLights;
+ packed_float3 Primitive_ObjectBounds;
+ float Primitive_LpvBiasMultiplier;
+ float Primitive_DecalReceiverMask;
+ float Primitive_PerObjectGBufferData;
+ float Primitive_UseVolumetricLightmapShadowFromStationaryLights;
+ float Primitive_UseEditorDepthTest;
+ float4 Primitive_ObjectOrientation;
+ float4 Primitive_NonUniformScale;
+ packed_float3 Primitive_LocalObjectBoundsMin;
+ float PrePadding_Primitive_380;
+ packed_float3 Primitive_LocalObjectBoundsMax;
+ uint Primitive_LightingChannelMask;
+ uint Primitive_LightmapDataIndex;
+ int Primitive_SingleCaptureIndex;
+};
+
+struct type_MobileShadowDepthPass
+{
+ float PrePadding_MobileShadowDepthPass_0;
+ float PrePadding_MobileShadowDepthPass_4;
+ float PrePadding_MobileShadowDepthPass_8;
+ float PrePadding_MobileShadowDepthPass_12;
+ float PrePadding_MobileShadowDepthPass_16;
+ float PrePadding_MobileShadowDepthPass_20;
+ float PrePadding_MobileShadowDepthPass_24;
+ float PrePadding_MobileShadowDepthPass_28;
+ float PrePadding_MobileShadowDepthPass_32;
+ float PrePadding_MobileShadowDepthPass_36;
+ float PrePadding_MobileShadowDepthPass_40;
+ float PrePadding_MobileShadowDepthPass_44;
+ float PrePadding_MobileShadowDepthPass_48;
+ float PrePadding_MobileShadowDepthPass_52;
+ float PrePadding_MobileShadowDepthPass_56;
+ float PrePadding_MobileShadowDepthPass_60;
+ float PrePadding_MobileShadowDepthPass_64;
+ float PrePadding_MobileShadowDepthPass_68;
+ float PrePadding_MobileShadowDepthPass_72;
+ float PrePadding_MobileShadowDepthPass_76;
+ float4x4 MobileShadowDepthPass_ProjectionMatrix;
+ float2 MobileShadowDepthPass_ShadowParams;
+ float MobileShadowDepthPass_bClampToNearPlane;
+ float PrePadding_MobileShadowDepthPass_156;
+ float4x4 MobileShadowDepthPass_ShadowViewProjectionMatrices[6];
+};
+
+struct type_EmitterDynamicUniforms
+{
+ float2 EmitterDynamicUniforms_LocalToWorldScale;
+ float EmitterDynamicUniforms_EmitterInstRandom;
+ float PrePadding_EmitterDynamicUniforms_12;
+ float4 EmitterDynamicUniforms_AxisLockRight;
+ float4 EmitterDynamicUniforms_AxisLockUp;
+ float4 EmitterDynamicUniforms_DynamicColor;
+ float4 EmitterDynamicUniforms_MacroUVParameters;
+};
+
+struct type_EmitterUniforms
+{
+ float4 EmitterUniforms_ColorCurve;
+ float4 EmitterUniforms_ColorScale;
+ float4 EmitterUniforms_ColorBias;
+ float4 EmitterUniforms_MiscCurve;
+ float4 EmitterUniforms_MiscScale;
+ float4 EmitterUniforms_MiscBias;
+ float4 EmitterUniforms_SizeBySpeed;
+ float4 EmitterUniforms_SubImageSize;
+ float4 EmitterUniforms_TangentSelector;
+ packed_float3 EmitterUniforms_CameraFacingBlend;
+ float EmitterUniforms_RemoveHMDRoll;
+ float EmitterUniforms_RotationRateScale;
+ float EmitterUniforms_RotationBias;
+ float EmitterUniforms_CameraMotionBlurAmount;
+ float PrePadding_EmitterUniforms_172;
+ float2 EmitterUniforms_PivotOffset;
+};
+
+struct type_Globals
+{
+ uint ParticleIndicesOffset;
+};
+
+struct main0_out
+{
+ float out_var_TEXCOORD6 [[user(locn0)]];
+ float4 gl_Position [[position]];
+};
+
+struct main0_in
+{
+ float2 in_var_ATTRIBUTE0 [[attribute(0)]];
+};
+
+// Returns 2D texture coords corresponding to 1D texel buffer coords
+uint2 spvTexelBufferCoord(uint tc)
+{
+ return uint2(tc % 4096, tc / 4096);
+}
+
+vertex main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(1)]], constant type_Primitive& Primitive [[buffer(2)]], constant type_MobileShadowDepthPass& MobileShadowDepthPass [[buffer(3)]], constant type_EmitterDynamicUniforms& EmitterDynamicUniforms [[buffer(4)]], constant type_EmitterUniforms& EmitterUniforms [[buffer(5)]], constant type_Globals& _Globals [[buffer(6)]], texture2d<float> ParticleIndices [[texture(0)]], texture2d<float> PositionTexture [[texture(1)]], texture2d<float> VelocityTexture [[texture(2)]], texture2d<float> AttributesTexture [[texture(3)]], texture2d<float> CurveTexture [[texture(4)]], sampler PositionTextureSampler [[sampler(0)]], sampler VelocityTextureSampler [[sampler(1)]], sampler AttributesTextureSampler [[sampler(2)]], sampler CurveTextureSampler [[sampler(3)]], uint gl_VertexIndex [[vertex_id]], uint gl_InstanceIndex [[instance_id]])
+{
+ main0_out out = {};
+ float2 _133 = ParticleIndices.read(spvTexelBufferCoord((_Globals.ParticleIndicesOffset + ((gl_InstanceIndex * 16u) + (gl_VertexIndex / 4u))))).xy;
+ float4 _137 = PositionTexture.sample(PositionTextureSampler, _133, level(0.0));
+ float4 _145 = AttributesTexture.sample(AttributesTextureSampler, _133, level(0.0));
+ float _146 = _137.w;
+ float3 _158 = float3x3(Primitive.Primitive_LocalToWorld[0].xyz, Primitive.Primitive_LocalToWorld[1].xyz, Primitive.Primitive_LocalToWorld[2].xyz) * VelocityTexture.sample(VelocityTextureSampler, _133, level(0.0)).xyz;
+ float3 _160 = normalize(_158 + float3(0.0, 0.0, 9.9999997473787516355514526367188e-05));
+ float2 _204 = ((((_145.xy + float2((_145.x < 0.5) ? 0.0 : (-0.5), (_145.y < 0.5) ? 0.0 : (-0.5))) * float2(2.0)) * (((CurveTexture.sample(CurveTextureSampler, (EmitterUniforms.EmitterUniforms_MiscCurve.xy + (EmitterUniforms.EmitterUniforms_MiscCurve.zw * float2(_146))), level(0.0)) * EmitterUniforms.EmitterUniforms_MiscScale) + EmitterUniforms.EmitterUniforms_MiscBias).xy * EmitterDynamicUniforms.EmitterDynamicUniforms_LocalToWorldScale)) * fast::min(fast::max(EmitterUniforms.EmitterUniforms_SizeBySpeed.xy * float2(length(_158)), float2(1.0)), EmitterUniforms.EmitterUniforms_SizeBySpeed.zw)) * float2(step(_146, 1.0));
+ float3 _239 = float4((((Primitive.Primitive_LocalToWorld[0u].xyz * _137.xxx) + (Primitive.Primitive_LocalToWorld[1u].xyz * _137.yyy)) + (Primitive.Primitive_LocalToWorld[2u].xyz * _137.zzz)) + (Primitive.Primitive_LocalToWorld[3u].xyz + float3(View.View_PreViewTranslation)), 1.0).xyz;
+ float3 _242 = float3(EmitterUniforms.EmitterUniforms_RemoveHMDRoll);
+ float3 _251 = mix(mix(float3(View.View_ViewRight), float3(View.View_HMDViewNoRollRight), _242), EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.xyz, float3(EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.w));
+ float3 _259 = mix(-mix(float3(View.View_ViewUp), float3(View.View_HMDViewNoRollUp), _242), EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockUp.xyz, float3(EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockUp.w));
+ float3 _260 = float3(View.View_TranslatedWorldCameraOrigin) - _239;
+ float _261 = dot(_260, _260);
+ float3 _265 = _260 / float3(sqrt(fast::max(_261, 0.00999999977648258209228515625)));
+ float3 _335;
+ float3 _336;
+ if (EmitterUniforms.EmitterUniforms_CameraFacingBlend[0] > 0.0)
+ {
+ float3 _279 = cross(_265, float3(0.0, 0.0, 1.0));
+ float3 _284 = _279 / float3(sqrt(fast::max(dot(_279, _279), 0.00999999977648258209228515625)));
+ float3 _286 = float3(fast::clamp((_261 * EmitterUniforms.EmitterUniforms_CameraFacingBlend[1]) - EmitterUniforms.EmitterUniforms_CameraFacingBlend[2], 0.0, 1.0));
+ _335 = normalize(mix(_251, _284, _286));
+ _336 = normalize(mix(_259, cross(_265, _284), _286));
+ }
+ else
+ {
+ float3 _333;
+ float3 _334;
+ if (EmitterUniforms.EmitterUniforms_TangentSelector.y > 0.0)
+ {
+ float3 _297 = cross(_265, _160);
+ _333 = _297 / float3(sqrt(fast::max(dot(_297, _297), 0.00999999977648258209228515625)));
+ _334 = -_160;
+ }
+ else
+ {
+ float3 _331;
+ float3 _332;
+ if (EmitterUniforms.EmitterUniforms_TangentSelector.z > 0.0)
+ {
+ float3 _310 = cross(EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.xyz, _265);
+ _331 = EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.xyz;
+ _332 = -(_310 / float3(sqrt(fast::max(dot(_310, _310), 0.00999999977648258209228515625))));
+ }
+ else
+ {
+ float3 _329;
+ float3 _330;
+ if (EmitterUniforms.EmitterUniforms_TangentSelector.w > 0.0)
+ {
+ float3 _322 = cross(_265, float3(0.0, 0.0, 1.0));
+ float3 _327 = _322 / float3(sqrt(fast::max(dot(_322, _322), 0.00999999977648258209228515625)));
+ _329 = _327;
+ _330 = cross(_265, _327);
+ }
+ else
+ {
+ _329 = _251;
+ _330 = _259;
+ }
+ _331 = _329;
+ _332 = _330;
+ }
+ _333 = _331;
+ _334 = _332;
+ }
+ _335 = _333;
+ _336 = _334;
+ }
+ float _339 = ((_145.z + ((_145.w * EmitterUniforms.EmitterUniforms_RotationRateScale) * _146)) * 6.283185482025146484375) + EmitterUniforms.EmitterUniforms_RotationBias;
+ float3 _342 = float3(sin(_339));
+ float3 _343 = _342 * _336;
+ float3 _344 = float3(cos(_339));
+ float3 _345 = _344 * _335;
+ float3 _347 = _344 * _336;
+ float3 _348 = _342 * _335;
+ float4 _371 = float4(_239 + ((float3(_204.x * (in.in_var_ATTRIBUTE0.x + EmitterUniforms.EmitterUniforms_PivotOffset.x)) * (_343 + _345)) + (float3(_204.y * (in.in_var_ATTRIBUTE0.y + EmitterUniforms.EmitterUniforms_PivotOffset.y)) * (_347 - _348))), 1.0);
+ float4 _375 = MobileShadowDepthPass.MobileShadowDepthPass_ProjectionMatrix * float4(_371.x, _371.y, _371.z, _371.w);
+ float4 _386;
+ if ((MobileShadowDepthPass.MobileShadowDepthPass_bClampToNearPlane > 0.0) && (_375.z < 0.0))
+ {
+ float4 _384 = _375;
+ _384.z = 9.9999999747524270787835121154785e-07;
+ float4 _385 = _384;
+ _385.w = 1.0;
+ _386 = _385;
+ }
+ else
+ {
+ _386 = _375;
+ }
+ float4 _396 = _386;
+ _396.z = ((_386.z * MobileShadowDepthPass.MobileShadowDepthPass_ShadowParams.y) + MobileShadowDepthPass.MobileShadowDepthPass_ShadowParams.x) * _386.w;
+ out.out_var_TEXCOORD6 = 0.0;
+ out.gl_Position = _396;
+ return out;
+}
+