//Lighting PS 9. Low.
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//   using 3Dmigoto v0.6.181 on Thu Jul 13 00:42:12 2023
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   float4 projParams;                 // Index:    0.xyzw           Components:     4 [unused]
//   float4 inLightPos[3];              // Index:    1 2 3            Components:    12 [unused]
//   float4 inLightInvRadiusSq;         // Index:    4.xyzw           Components:     4 [unused]
//   float4 inLightColor[4];            // Index:    5 6 7 8          Components:    16 [unused]
//   float4 inLightSpotDir[3];          // Index:    9 10 11          Components:    12 [unused]
//   float4 inLightSpotAngle;           // Index:   12.xyzw           Components:     4 [unused]
//   float4 inLightSpotFalloff;         // Index:   13.xyzw           Components:     4 [unused]
//   float4 ambient;                    // Index:   14.xyzw           Components:     4 [unused]
//   float roughness;                   // Index:   15.x              Components:     1 [unused]
//   float4 specularColor;              // Index:   16.xyzw           Components:     4 [unused]
//   float4x4 worldToLightProj;         // Index:   17 18 19 20       Components:    16 [unused]
//   float4 scaleX;                     // Index:   21.xyzw           Components:     4 [unused]
//   float4 scaleY;                     // Index:   22.xyzw           Components:     4 [unused]
//   float4 offsetX;                    // Index:   23.xyzw           Components:     4 [unused]
//   float4 offsetY;                    // Index:   24.xyzw           Components:     4 [unused]
//   float4 atlasXOffset;               // Index:   25.xyzw           Components:     4 [unused]
//   float4 atlasYOffset;               // Index:   26.xyzw           Components:     4 [unused]
//   float4 farPlaneScalePSSM;          // Index:   27.xyzw           Components:     4 [unused]
//   float4 overDarkPSSM;               // Index:   28.xyzw           Components:     4 [unused]
//   float2 atlasScalePSSM;             // Index:   29.xy             Components:     2 [unused]
//   float2 fadeStartLength;            // Index:   29.zw             Components:     2 [unused]
//   float shadowSoftness;              // Index:   30.x              Components:     1 [unused]
//   float3 lightDirection;             // Index:   30.yzw            Components:     3
//   float4 lightColor;                 // Index:   31.xyzw           Components:     4
//   float lightBrightness;             // Index:   32.x              Components:     1
//   float4 lightAmbient;               // Index:   33.xyzw           Components:     4 [unused]
//   float3 eyePosWorld;                // Index:   34.xyz            Components:     3 [unused]
//   float3 vEye;                       // Index:   35.xyz            Components:     3 [unused]
//   float4 zNearFarInvNearFar;         // Index:   36.xyzw           Components:     4 [unused]
//   float4 lightMapParams;             // Index:   37.xyzw           Components:     4
//   float4x4 screenToWorld;            // Index:   38 39 40 41       Components:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// prePassBuffer_sampler_            sampler      NA          NA    0        1
// prePassDepthBuffer_sampler_       sampler      NA          NA    1        1
// prePassBufferTex                  texture  float4          2d    0        1
// prePassBuffer1Tex                 texture  float4          2d    5        1
// $Globals                          cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float
// TEXCOORD                 0   xy          1     NONE   float   xy
// TEXCOORD                 1   xyz         2     NONE   float   xyz
// TEXCOORD                 2   xyz         3     NONE   float
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
// SV_Target                1   xyzw        1   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer CB0[38], immediateIndexed
dcl_constantbuffer CB13[44], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t5
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyz
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_temps 29
dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r25.xyzw, l(0, 0, 0, 0), t125.xyzw

//mov r21.xy, v1.xyxx
//mad r21.x, r25.x, l(0.5), r21.x

//mov r20.xyzw, cb0[30].xyzw
////div r24.x, r25.y, r10.x
////add r24.x, r24.x, l(-1.0)
//mul r26.x, l(-1.0), cb13[0].x
//mul r26.y, l(-1.0), cb13[1].x
//mul r26.z, l(-1.0), cb13[2].x
//mul r26.w, cb13[0].x, cb13[0].x
//mad r26.w, cb13[1].x, cb13[1].x, r26.w
//mad r26.w, cb13[2].x, cb13[2].x, r26.w
//div r26.xyz, r26.xyzx, r26.wwww
////div r26.xyz, r26.xyzx, r0.x
////mul r26.xyz, r26.xyzx, cb0[0].y
////mul r26.xyz, r26.xyzx, l(0.1)
//mad r20.yzw, r25.xxxx, r26.xxyz, r20.yyzw

dp3 r0.x, v2.xyzx, v2.xyzx
rsq r0.x, r0.x
mad r0.yzw, -v2.xxyz, r0.xxxx, -cb0[30].yyzw

////div r24.x, r25.y, r10.x
////add r24.x, r24.x, l(-1.0)
//mul r26.x, l(1.0), cb13[0].x
//mul r26.y, l(1.0), cb13[1].x
//mul r26.z, l(1.0), cb13[2].x
//mul r26.w, cb13[0].x, cb13[0].x
//mad r26.w, cb13[1].x, cb13[1].x, r26.w
//mad r26.w, cb13[2].x, cb13[2].x, r26.w
//div r26.xyz, r26.xyzx, r26.wwww
////div r26.xyz, r26.xyzx, r0.x
////mul r26.xyz, r26.xyzx, cb0[0].y
////mul r26.xyz, r26.xyzx, l(0.1)
//mad r0.yzw, r25.xxxx, r26.xxyz, r0.yyzw



mul r1.xyz, r0.xxxx, v2.xyzx

//mul r26.xyz, r26.xyzx, r0.xxxx
//mad r1.xyz, r25.xxxx, r26.xyzx, r1.xyzx

//mad r0.y, r25.x, l(-0.5), r0.y

dp3 r0.x, r0.yzwy, r0.yzwy
rsq r0.x, r0.x
mul r0.xyz, r0.xxxx, r0.yzwy



dp3 r0.w, -r1.xyzx, r0.xyzx
max r0.w, r0.w, l(0.000010)
add r0.w, -r0.w, l(1.000000)
max r0.w, r0.w, l(0.000000)
mul r1.w, r0.w, r0.w
mul r1.w, r1.w, r1.w
mul r0.w, r0.w, r1.w
sample_l_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r2.xyz, v1.xyxx, t5.xyzw, s1, l(0.000000)
max r1.w, r2.y, r2.x
max r1.w, r2.z, r1.w
mul_sat r1.w, r1.w, l(50.000000)
add r3.xyz, -r2.xyzx, r1.wwww
mad r2.xyz, r3.xyzx, r0.wwww, r2.xyzx
sample_l_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r3.xyz, v1.xyxx, t0.xyzw, s0, l(0.000000)
mad r3.xy, r3.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
max r0.w, r3.z, l(0.020000)
ge r3.zw, r3.xxxy, l(0.000000, 0.000000, 0.000000, 0.000000)
movc r3.zw, r3.zzzw, l(0,0,1.000000,1.000000), l(0,0,-1.000000,-1.000000)
add r4.xyz, -|r3.xyxx|, l(1.000000, 1.000000, 1.000000, 0.000000)
mul r3.zw, r3.zzzw, r4.yyyz
add r4.z, -|r3.y|, r4.x
ge r1.w, r4.z, l(0.000000)

//mul r20.x, cb13[0].x, l(-1.0)
//mul r20.y, cb13[1].x, l(-1.0)
//mad r3.x, r25.x, r20.x, r3.x
//mad r3.y, r25.x, r20.y, r3.y

movc r4.xy, r1.wwww, r3.xyxx, r3.zwzz



dp3 r1.w, r4.xyzx, r4.xyzx
rsq r1.w, r1.w
mul r3.xyz, r1.wwww, r4.xyzx



dp3 r0.x, r3.xyzx, r0.xyzx
max r0.x, r0.x, l(0.000010)
mul r0.xw, r0.xxxw, r0.xxxw



mad r0.y, r0.w, r0.w, l(-1.000000)
mad r0.x, r0.x, r0.y, l(1.000000)
mul r0.xy, r0.xwxx, r0.xwxx
mul r0.x, r0.x, l(3.14159274)
mad r0.z, -r0.w, r0.w, l(1.000000)
div r0.x, r0.y, r0.x
mul r2.xyz, r2.xyzx, r0.xxxx



dp3 r0.w, r3.xyzx, -r1.xyzx
dp3 r1.x, r3.xyzx, -cb0[30].yzwy
max r1.x, r1.x, l(0.000010)
max r0.w, r0.w, l(0.000010)
mul r1.y, r1.x, r1.x
mad r1.y, r1.y, r0.z, r0.y
sqrt r1.y, r1.y
mul r1.y, r0.w, r1.y
mul r0.w, r0.w, r0.w
mad r0.y, r0.w, r0.z, r0.y
sqrt r0.y, r0.y
mad r0.y, r1.x, r0.y, r1.y
min r0.z, r1.x, l(1.000000)
mul r0.z, r0.z, cb0[32].x
div r0.w, l(0.500000), r0.y
ge r0.y, l(0.000000), r0.y
movc r0.y, r0.y, l(0), r0.w
mul r1.xyz, r0.yyyy, r2.xyzx
mul r1.w, r0.y, r0.x
mul_sat r1.xyzw, r0.zzzz, r1.xyzw
mov r2.w, l(1.000000)
mul r2.xyz, cb0[31].xyzx, cb0[37].xyzx
mul r1.xyzw, r1.xyzw, r2.xyzw
mul o0.xyz, r0.zzzz, r2.xyzx
mov o0.w, r1.w
mov o1.xyz, r1.xyzx
mov o1.w, l(0)
ret
// Approximately 71 instruction slots used
