// mirror new update 
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
//
//   using 3Dmigoto v1.3.11 on Wed Dec 19 15:04:08 2018
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   float1 ConstantVector1D_04_Value;  // Offset:    0 Size:     4
//   float1 ConstantVector1D_06_Value;  // Offset:    4 Size:     4
//   float1 ConstantVector1D_03_Value;  // Offset:    8 Size:     4
//   float1 ConstantVector1D_07_Value;  // Offset:   12 Size:     4
//   float1 ConstantVector1D_08_Value;  // Offset:   16 Size:     4
//   float4 gm_mTransform2D_01[2];      // Offset:   32 Size:    32
//   float1 ConstantVector1D_01_Value;  // Offset:   64 Size:     4
//   float1 ConstantVector1D_05_Value;  // Offset:   68 Size:     4
//   float4 gm_mTransform2D_02[2];      // Offset:   80 Size:    32
//   float1 ConstantVector1D_09_Value;  // Offset:  112 Size:     4
//
// }
//
// cbuffer _cbPerObject
// {
//
//   struct S_cbPerObject
//   {
//
//       row_major float4x4 go_mObjectToView;// Offset:    0
//       row_major float4x4 go_mObjectToViewPrev;// Offset:   64
//       float4 go_vPosScale;           // Offset:  128
//       float4 go_vPosBias;            // Offset:  144
//       float4 go_vTexScaleBias;       // Offset:  160
//       float4 go_vObjectId;           // Offset:  176
//       float4 go_Tesselation;         // Offset:  192
//       float4 go_Flags;               // Offset:  208
//       float4 go_vSimpleColor;        // Offset:  224
//
//   } cbPerObject;                     // Offset:    0 Size:   240
//
// }
//
// cbuffer _cbSharedPerViewData
// {
//
//   struct S_cbSharedPerViewData
//   {
//
//       row_major float4x4 mProjection;// Offset:    0
//       row_major float4x4 mProjectionPrev;// Offset:   64
//       row_major float4x4 mViewToViewport;// Offset:  128
//       row_major float4x4 mViewToWorld;// Offset:  192
//       row_major float4x4 mViewToWorldPrev;// Offset:  256
//       row_major float4x4 mFxWorldToSampleSpace;// Offset:  320
//       float4 vViewRemap;             // Offset:  384
//       float4 vViewDepthRemap;        // Offset:  400
//       float4 vEyeVectorUL;           // Offset:  416
//       float4 vEyeVectorLR;           // Offset:  432
//       float4 vEyeVectorDelta;        // Offset:  448
//       float4 vPixelToEyeVectorScaleBias;// Offset:  464
//       float4 vViewSpaceUpVector;     // Offset:  480
//       float4 vViewportSize;          // Offset:  496
//       float4 vTesselationEnabled;    // Offset:  512
//       float4 vEngineTime;            // Offset:  528
//       uint nFrameCounter;            // Offset:  544
//       float4 vShaderColor0;          // Offset:  560
//       float4 vShaderColor1;          // Offset:  576
//       float4 vShaderColor2;          // Offset:  592
//       float4 vShaderColor3;          // Offset:  608
//       float4 vShaderColor4;          // Offset:  624
//       float4 vClipPlane;             // Offset:  640
//       float4 vClipPlane0;            // Offset:  656
//       float4 vClipPlane1;            // Offset:  672
//       float4 vClipPlane2;            // Offset:  688
//       float4 vClipPlane3;            // Offset:  704
//       float4 vClipPlane4;            // Offset:  720
//       float4 vClipPlane5;            // Offset:  736
//       float4 vMippedDepthRemap;      // Offset:  752
//       float4 vSpecularOcclusionSettings;// Offset:  768
//       float4 vSaturatedAmbientOcclusionSettings;// Offset:  784
//       float4 vLightModelSettings;    // Offset:  800
//       float4 vHDRScale;              // Offset:  816
//       float4 vTweakableShaderParams; // Offset:  832
//       float4 vAtmosphericScatteringParameters;// Offset:  848
//       float4 vAtmosphericScatteringParameters2;// Offset:  864
//       float4 vAtmosphericScatteringParameters3;// Offset:  880
//       float3 vAtmosphericScatteringMieBeta;// Offset:  896
//       float3 vAtmosphericScatteringRayleighBeta;// Offset:  912
//       float3 vAtmosphericScatteringShadowedMieBeta;// Offset:  928
//       float3 vAtmosphericScatteringShadowedRayleighBeta;// Offset:  944
//       float3 vAttenuatedSunColor;    // Offset:  960
//       float3 vSunDirectionVS;        // Offset:  976
//       row_major float4x4 mViewToGlobalShadowVSPT;// Offset:  992
//       float4 vWindDirectionAndStrength;// Offset: 1056
//       float4 vWindDirectionAndStrengthPrev;// Offset: 1072
//       float4 vWindInitialDirectionAndStrength;// Offset: 1088
//       float4 vFxFadeParameters;      // Offset: 1104
//       float2 vFxSize;                // Offset: 1120
//       int nEnableGBufferSpecPowerAdjustment;// Offset: 1128
//       int nNumCSMCascades;           // Offset: 1132
//       float fCSMFadeAdd;             // Offset: 1136
//       int nEnableClothBias;          // Offset: 1140
//       int2 viNumTiles;               // Offset: 1144
//       int nLightTileDebugFlags;      // Offset: 1152
//       int nEnableBoxReflections;     // Offset: 1156
//       int nSelectedBoxReflectionId;  // Offset: 1160
//       int nEnableAtmosphericScatteringBackdrop;// Offset: 1164
//       int nEnableSampleFromUICameraBackbuffer;// Offset: 1168
//       int nFallbackRoomMask;         // Offset: 1172
//       float4 vClearColor;            // Offset: 1184
//       float3 vGlobalLightDirectionVS;// Offset: 1200
//       float3 vGlobalLightFrontColor; // Offset: 1216
//       float3 vGlobalLightBackColor;  // Offset: 1232
//       float4 vShadowAtlasSize;       // Offset: 1248
//       float2 vShadowPoissonScale;    // Offset: 1264
//       int nShadowSpotKernel;         // Offset: 1272
//       int nShadowCSMKernel;          // Offset: 1276
//       float4 vJitter;                // Offset: 1280
//       float4 vUnjitter;              // Offset: 1296
//       int nHashedAlphaPeriod;        // Offset: 1312
//       int nIsRenderingOffscreen;     // Offset: 1316
//       int nMirrorsDisabled;          // Offset: 1320
//
//   } cbSharedPerViewData;             // Offset:    0 Size:  1324
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// samplerLinearClamp                sampler      NA          NA    4        1
// samplerAnisotropicWrap            sampler      NA          NA    9        1
// mapTexture2D_01                   texture  float4          2d    0        1
// mapTexture2D_04                   texture  float4          2d    1        1
// mapTexture2D_03                   texture  float4          2d    2        1
// mapTexture2DCompoundNormal_01     texture  float4          2d    3        1
// srvReflection2D                   texture  float4          2d   39        1
// srvRefraction2D                   texture  float4          2d   40        1
// $Globals                          cbuffer      NA          NA    0        1
// _cbPerObject                      cbuffer      NA          NA    1        1
// _cbSharedPerViewData              cbuffer      NA          NA    2        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float
// POSITION                 0   xyzw        1     NONE   float   xyz
// TEXCOORDS0_OBJID_TEXBLENDFACTOR     0   xyzw        2     NONE   float   xy
// NORMAL_POSPREVX          0   xyzw        3     NONE   float   xyz
// TANGENT_POSPREVY         0   xyzw        4     NONE   float   xyz
// BINORMAL_POSPREVZ        0   xyzw        5     NONE   float   xyz
// VERTEXCOLOR              0   xyzw        6     NONE   float
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[8], immediateIndexed
dcl_constantbuffer cb1[14], immediateIndexed
dcl_constantbuffer cb2[58], immediateIndexed
dcl_sampler s4, mode_default
dcl_sampler s9, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t39
dcl_resource_texture2d (float,float,float,float) t40
dcl_input_ps linear v1.xyz
dcl_input_ps linear v2.xy
dcl_input_ps linear v3.xyz
dcl_input_ps linear v4.xyz
dcl_input_ps linear v5.xyz
dcl_output o0.xyzw
//dcl_temps 5

dcl_temps 37

// stereo2mono:
dcl_resource_texture2d (float,float,float,float) t100

dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r37.xyzw, l(0, 0, 0, 0), t125.xyzw

mul r0.xyz, cb1[3].yyyy, cb2[13].xyzx
mad r0.xyz, cb1[3].xxxx, cb2[12].xyzx, r0.xyzx
mad r0.xyz, cb1[3].zzzz, cb2[14].xyzx, r0.xyzx
dp3 r0.x, r0.xyzx, r0.xyzx
sqrt r0.x, r0.x
add r0.x, r0.x, l(-20.000000)
mul_sat r0.x, r0.x, l(0.200000)
add r0.x, -r0.x, l(1.000000)
mov r1.xy, v2.xyxx
mov r1.z, l(1.000000)
dp3 r2.x, cb0[5].xyzx, r1.xyzx
dp3 r2.y, cb0[6].xyzx, r1.xyzx
sample_indexable(texture2d)(float,float,float,float) r0.y, r2.xyxx, t2.xwyz, s9
mul_sat r0.y, r0.y, cb0[0].w
mul r0.y, r0.y, cb0[1].x
sample_indexable(texture2d)(float,float,float,float) r0.z, r2.xyxx, t1.xywz, s9
add r0.w, -cb0[0].x, cb0[0].y
mad r0.z, r0.z, r0.w, cb0[0].x
dp3 r3.x, cb0[2].xyzx, r1.xyzx
dp3 r3.y, cb0[3].xyzx, r1.xyzx
sample_indexable(texture2d)(float,float,float,float) r1.xyz, r3.xyxx, t3.xywz, s9
add r0.w, r1.z, l(-0.500000)
mad r1.z, -r0.z, l(2.000000), l(1.000000)
mad r1.z, r1.z, |r0.w|, r0.z
add r0.w, r0.w, r1.z
mov_sat r1.z, cb0[0].z
add r0.w, -r0.z, r0.w
mad r0.z, r1.z, r0.w, r0.z
add r0.z, -r0.z, l(1.000000)
mul r0.z, r0.z, l(9.000000)
mul r3.xyz, v1.yyyy, cb2[9].xywx
mad r3.xyz, v1.xxxx, cb2[8].xywx, r3.xyzx
mad r3.xyz, v1.zzzz, cb2[10].xywx, r3.xyzx

//fix 
add r37.w, r3.z, -r37.y
mul r37.w, r37.x, r37.w
div r37.w, r37.w, l(2.0)
add r3.x, r3.x, r37.w

add r3.xyz, r3.xyzx, cb2[11].xywx
div r3.xy, r3.xyxx, r3.zzzz
add r3.z, -r3.x, l(1.000000)

// Swap reflection eyes from stereo2mono reflection copy.
// Mip-maps disabled as the reverse stereo blit only copies them in one eye
mov r8.xyzw, r3.xyzw
mul r8.z, r8.z, l(0.5)
eq r37.w, r37.z, l(-1.0)
if_nz r37.w
  add r8.z, r8.z, l(0.5)
endif


//sample_l_indexable(texture2d)(float,float,float,float) r4.xyz, r3.zyzz, t39.xyzw, s4, r0.z
sample_l_indexable(texture2d)(float,float,float,float) r4.xyz, r8.zyzz, t100.xyzw, s4, r0.z

mul r4.xyz, r4.xyzx, cb2[51].xxxx
mul r0.yzw, r0.yyyy, r4.xxyz
sample_indexable(texture2d)(float,float,float,float) r1.zw, r2.xyxx, t0.zwxy, s9
mad r1.zw, r1.zzzw, l(0.000000, 0.000000, 2.000000, 2.000000), l(0.000000, 0.000000, -1.000000, -1.000000)
mul r1.zw, r1.zzzw, cb0[4].yyyy
dp2 r2.x, r1.zwzz, r1.zwzz
add r2.x, -r2.x, l(1.000000)
max r2.x, r2.x, l(0.000000)
mad r1.xy, r1.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
mul r1.xy, r1.xyxx, cb0[4].xxxx
dp2 r2.y, r1.xyxx, r1.xyxx
add r2.y, -r2.y, l(1.000000)
max r2.y, r2.y, l(0.000000)
sqrt r2.xy, r2.xyxx
mul r1.xy, r1.xyxx, r2.xxxx
mad r1.xy, r1.zwzz, r2.yyyy, r1.xyxx
mul r1.z, r2.y, r2.x
dp3 r1.w, r1.xyzx, r1.xyzx
rsq r1.w, r1.w
mul r1.xyz, r1.wwww, r1.xyzx
mul r2.xyz, r1.yyyy, -v5.xyzx
mad r1.xyw, v4.xyxz, r1.xxxx, r2.xyxz
mad r1.xyz, v3.xyzx, r1.zzzz, r1.xywx
dp3 r1.z, r1.xyzx, r1.xyzx
rsq r1.z, r1.z
mul r1.xy, r1.zzzz, r1.xyxx
mul r1.xy, -r1.xyxx, cb0[7].xxxx
mad r1.xy, -r1.xyxx, cb2[31].xyxx, r3.xyxx
sample_l_indexable(texture2d)(float,float,float,float) r1.xyz, r1.xyxx, t40.xyzw, s4, l(0.000000)
lt r2.xyz, l(0.000000, 0.000000, 0.000000, 0.000000), r1.xyzx
or r1.w, r2.y, r2.x
or r1.w, r2.z, r1.w
if_z r1.w
  sample_l_indexable(texture2d)(float,float,float,float) r1.xyz, r3.xyxx, t40.xyzw, s4, l(0.000000)
endif
mul r1.xyz, r1.xyzx, cb2[51].xxxx
mad r0.xyz, r0.xxxx, r0.yzwy, r1.xyzx
div r1.xyz, v1.xyzx, -v1.zzzz
mul r0.w, -r1.y, cb2[13].z
mad r0.w, -r1.x, cb2[12].z, r0.w
mad r0.w, -r1.z, cb2[14].z, r0.w
mul r0.w, r0.w, -v1.z
add r1.x, cb2[15].z, cb2[53].x
mul r1.yz, r0.wwww, -cb2[53].wwzw
mul r1.xw, r1.xxxx, -cb2[53].wwwz
ge r2.xy, r1.yzyy, l(0.000000, 0.000000, 0.000000, 0.000000)
movc r2.xy, r2.xyxx, l(1.000000,1.000000,0,0), l(-1.000000,-1.000000,0,0)
add r1.yz, |r1.yyzy|, l(0.000000, 0.000010, 0.000010, 0.000000)
mul r1.yz, r1.yyzy, r2.xxyx
mul r0.w, -v1.z, cb2[55].z
exp r1.xw, r1.xxxw
exp r2.xy, r1.yzyy
add r2.xy, r2.xyxx, l(-1.000000, -1.000000, 0.000000, 0.000000)
mul r1.xw, r1.xxxw, r2.xxxy
div r1.xy, r1.xwxx, r1.yzyy
mul r1.y, r1.y, l(1.100000)
mul r1.yzw, r1.yyyy, cb2[56].xxyz
mad r1.xyz, cb2[57].xyzx, r1.xxxx, r1.yzwy
mul r0.w, r0.w, l(2.081369)
mul r1.xyz, r0.wwww, r1.xyzx
exp r1.xyz, -r1.xyzx
mul r0.xyz, r0.xyzx, r1.xyzx
mul r0.xyz, r0.xyzx, cb1[13].yyyy
mul r0.xyz, r0.xyzx, cb2[51].yyyy
min o0.xyz, r0.xyzx, l(7936.000000, 7936.000000, 7936.000000, 0.000000)
mov o0.w, l(1.000000)
ret
// Approximately 104 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
