//lights 8
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.3.11 on Wed Aug 01 19:53:48 2018
//
//
// Buffer Definitions:
//
// cbuffer cb_g_Pass
// {
//
//   struct PassConsts
//   {
//
//       float4 m_EyePosition;          // Offset:    0
//       float4 m_EyeDirection;         // Offset:   16
//       float4x4 m_ViewToWorld;        // Offset:   32
//       float4x4 m_WorldToView;        // Offset:   96
//       float4x4 m_ProjMatrix;         // Offset:  160
//       float4x4 m_ViewProj;           // Offset:  224
//       float4x4 m_ViewNoTranslationProj;// Offset:  288
//       float4 m_ViewTranslation;      // Offset:  352
//
//       struct ReverseProjParams
//       {
//
//           float4x4 clipXYZToViewPos; // Offset:  368
//           float4x4 clipXYZToWorldPos;// Offset:  432
//           float4 clipZToViewZ;       // Offset:  496
//
//       } reverseProjParams;           // Offset:  368
//       float4 m_VPosToUV;             // Offset:  512
//       float4 m_ViewportScaleOffset;  // Offset:  528
//       float4 m_ClipPlane;            // Offset:  544
//       float4 m_GlobalLightingScale;  // Offset:  560
//       float4 m_ViewSpaceLightingBackWS;// Offset:  576
//       float4 m_ThinGeomAAPixelScale; // Offset:  592
//
//   } g_Pass;                          // Offset:    0 Size:   608
//
// }
//
// cbuffer cb_g_DeferredLights
// {
//
//   struct DeferredLightingConsts
//   {
//
//       struct OmniLightConsts
//       {
//
//           float4 m_Position;         // Offset:    0
//           float4 m_Color;            // Offset:   16
//           float4 m_Attenuation;      // Offset:   32
//
//       } m_OmniLight;                 // Offset:    0
//
//       struct DirectLightConsts
//       {
//
//           float4 m_Direction;        // Offset:   48
//           float4 m_Color;            // Offset:   64
//
//       } m_DirectLight;               // Offset:   48
//
//       struct SpotLightConsts
//       {
//
//           float4 m_Position;         // Offset:   80
//           float4 m_Color;            // Offset:   96
//           float4 m_Attenuation;      // Offset:  112
//           float4 m_Direction;        // Offset:  128
//           float4 m_ConeAngles;       // Offset:  144
//           float4 m_PositionAtNearClip;// Offset:  160
//
//       } m_SpotLight;                 // Offset:   80
//
//       struct ProjectorShadowParams
//       {
//
//           float4x4 worldToLight[6];  // Offset:  176
//           float4 shadowMapScaleOffset[6];// Offset:  560
//           float4 noiseScale;         // Offset:  656
//
//       } m_Projections;               // Offset:  176
//
//       struct ProjectorCookieParams
//       {
//
//           float4x4 worldToCookie;    // Offset:  672
//           int4 cookieArrayIndex;     // Offset:  736
//
//       } m_Cookie;                    // Offset:  672
//       float4 m_BackgroundColor;      // Offset:  752
//       float4 m_DepthParams;          // Offset:  768
//       float4 m_EyeXAxis;             // Offset:  784
//       float4 m_EyeYAxis;             // Offset:  800
//       float4 m_EyeZAxis;             // Offset:  816
//       float4 m_VPOSToUVs_Resolve;    // Offset:  832
//       float4 m_EyeWorldPosition_Resolve;// Offset:  848
//       float4 m_WeatherExposedParams; // Offset:  864
//       float4x4 m_LightClipToWorldMat;// Offset:  880
//       float4 m_IsolateVars;          // Offset:  944
//       float m_EnvironmentSpecularScale;// Offset:  960
//
//   } g_DeferredLights;                // Offset:    0 Size:   964
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// s_TrilinearClamp                  sampler      NA          NA   12        1
// t_Normals                         texture  float4       2dMS4    1        1
// t_DepthSurface                    texture   float       2dMS4    2        1
// t_SpecularReflectance             texture  float4       2dMS4    3        1
// t_MiscProps                       texture  float4       2dMS4   15        1
// t_BRDFLUT                         texture  float4          2d   55        1
// cb_g_Pass                         cbuffer      NA          NA    2        1
// cb_g_DeferredLights               cbuffer      NA          NA    5        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xy
//
//
// 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 cb2[36], immediateIndexed
dcl_constantbuffer cb5[3], immediateIndexed
dcl_sampler s12, mode_default
dcl_resource_texture2dms(4) (float,float,float,float) t1
dcl_resource_texture2dms(4) (float,float,float,float) t2
dcl_resource_texture2dms(4) (float,float,float,float) t3
dcl_resource_texture2dms(4) (float,float,float,float) t15
dcl_resource_texture2d (float,float,float,float) t55
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_output o0.xyzw
dcl_output o1.xyzw


//insert
dcl_temps 28
dcl_resource_texture2d (float,float,float,float) t125

ftou r0.xy, v0.xyxx
mov r0.zw, l(0,0,0,0)
ldms_indexable(texture2dms)(float,float,float,float) r1.z, r0.xyww, t2.yzxw, l(0)
mul r2.xy, v0.xyxx, cb2[32].xyxx
mad r1.xy, r2.xyxx, l(2.000000, -2.000000, 0.000000, 0.000000), l(-1.000000, 1.000000, 0.000000, 0.000000)
mov r1.w, l(1.000000)

//fix strategy from HLSL converted to ASM --- Losti
ld_indexable(texture2d)(float,float,float,float) r27.xyzw, l(0, 0, 0, 0), t125.xyzw
dp4 r26.w, r1.xyzw, cb2[26].xyzw
mul r27.w, r26.w, r27.y
add r27.w, r27.w, l(-1.0)
mul r27.w, r27.w, r27.x
add r1.x, r1.x, r27.w

dp4 r2.x, r1.xyzw, cb2[23].xyzw
dp4 r2.y, r1.xyzw, cb2[24].xyzw
dp4 r2.z, r1.xyzw, cb2[25].xyzw
dp4 r1.x, r1.xyzw, cb2[26].xyzw
div r1.xyz, r2.xyzx, r1.xxxx
mov r1.w, l(1.000000)
dp4 r2.x, r1.xyzw, cb2[2].xyzw
dp4 r2.y, r1.xyzw, cb2[3].xyzw
dp4 r2.z, r1.xyzw, cb2[4].xyzw
ldms_indexable(texture2dms)(float,float,float,float) r1.xyz, r0.xyww, t1.xyzw, l(0)
ldms_indexable(texture2dms)(float,float,float,float) r3.xyzw, r0.xyww, t15.xyzw, l(0)
mad r1.xyz, r1.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
dp3 r1.w, r1.xyzx, r1.xyzx
rsq r1.w, r1.w
mul r1.xyz, r1.wwww, r1.xyzx
mul r1.w, r3.w, l(255.000000)
ftou r1.w, r1.w
ieq r1.w, r1.w, l(255)
if_nz r1.w
  ldms_indexable(texture2dms)(float,float,float,float) r0.x, r0.xyzw, t3.yxzw, l(0)
  mad r0.yzw, r3.xxyz, l(0.000000, 2.000000, 2.000000, 2.000000), l(0.000000, -1.000000, -1.000000, -1.000000)
  dp3 r2.w, r0.yzwy, r0.yzwy
  rsq r2.w, r2.w
  mul r0.yzw, r0.yyzw, r2.wwww
  mov r3.yz, l(0,0,0,0)
else
  mov r0.xyzw, l(1.000000,1.000000,1.000000,1.000000)
endif
movc r0.x, r1.w, r0.x, l(1.000000)
add r2.xyz, -r2.xyzx, cb5[0].xyzx
dp3 r2.w, r2.xyzx, r2.xyzx
rsq r3.w, r2.w
mul r2.xyz, r2.xyzx, r3.wwww
div_sat r3.w, cb5[2].z, r2.w
mad_sat r2.w, r2.w, cb5[2].x, cb5[2].y
mul r4.x, r2.w, r2.w
mad r2.w, -r2.w, l(2.000000), l(3.000000)
mul r2.w, r2.w, r4.x
mul r2.w, r2.w, r3.w
dp3 r3.w, r2.xyzx, r0.yzwy
mad r0.yzw, -r3.wwww, r0.yyzw, r2.xxyz
dp3 r3.w, r0.yzwy, r0.yzwy
rsq r3.w, r3.w
mul r0.yzw, r0.yyzw, r3.wwww
movc r0.yzw, r1.wwww, r0.yyzw, r1.xxyz
dp3 r0.y, r0.yzwy, r2.xyzx
mad r3.x, r0.y, l(0.500000), l(0.500000)
mad r0.zw, r3.xxxy, l(0.000000, 0.000000, 0.968750, 0.968750), l(0.000000, 0.000000, 0.015625, 0.015625)
sample_l_indexable(texture2d)(float,float,float,float) r0.z, r0.zwzz, t55.xyzw, s12, l(0.000000)
mov_sat r0.y, -r0.y
mul r0.y, r0.y, r3.z
mul r1.xyz, r2.wwww, cb5[1].xyzx
mul r2.xyz, r0.zzzz, r1.xyzx
mad r0.yzw, r0.yyyy, r1.xxyz, r2.xxyz
mul r0.xyz, r0.xxxx, r0.yzwy
dp3 r0.w, r2.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
mul o0.xyzw, r0.xyzw, cb2[35].xxxx
mov o1.xyzw, l(0,0,0,1.000000)
ret
// Approximately 65 instruction slots used

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