// ---- Created with 3Dmigoto v1.2.35 on Tue Apr 26 22:30:26 2016

cbuffer cbCopyShadowMapDepth : register(b6)
{
  float4x4 g_DynamicShadowToWorldMatrix : packoffset(c0);
  float4x4 g_WorldToDynamicShadowMatrix : packoffset(c4);
  float4x4 g_StaticShadowToWorldMatrix : packoffset(c8);
  float4x4 g_WorldToStaticShadowMatrix : packoffset(c12);
}

SamplerState SS_ClampPoint_s : register(s7);
Texture2D<float4> g_DepthTexture : register(t1);


// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main( 
  float4 v0 : SV_POSITION0,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD1,
  out float oDepth : SV_Depth)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xy = v1.xy;
  r0.z = 1;
  r1.x = dot(r0.xyz, g_DynamicShadowToWorldMatrix._m00_m10_m30);
  r1.y = dot(r0.xyz, g_DynamicShadowToWorldMatrix._m01_m11_m31);
  r1.z = dot(r0.xyz, g_DynamicShadowToWorldMatrix._m02_m12_m32);
  r1.w = dot(r0.xyz, g_DynamicShadowToWorldMatrix._m03_m13_m33);
  r0.x = dot(r1.xyzw, g_WorldToStaticShadowMatrix._m00_m10_m20_m30);
  r0.y = dot(r1.xyzw, g_WorldToStaticShadowMatrix._m01_m11_m21_m31);
  r0.z = dot(r1.xyzw, g_WorldToStaticShadowMatrix._m03_m13_m23_m33);
  r0.xy = r0.xy / r0.zz;
  r1.xy = cmp(r0.xy >= float2(0,0));
  r1.x = r1.y ? r1.x : 0;
  r1.yz = cmp(float2(1,1) >= r0.xy);
  r1.x = r1.y ? r1.x : 0;
  r1.x = r1.z ? r1.x : 0;
  r0.z = g_DepthTexture.Sample(SS_ClampPoint_s, r0.xy).x;
  r1.y = cmp(r0.z >= 1);
  r1.y = r1.y ? r1.x : 0;
  oDepth = 1;
  if (r1.y != 0) return;
  r0.w = 1;
  r2.x = dot(r0.xyzw, g_StaticShadowToWorldMatrix._m00_m10_m20_m30);
  r2.y = dot(r0.xyzw, g_StaticShadowToWorldMatrix._m01_m11_m21_m31);
  r2.z = dot(r0.xyzw, g_StaticShadowToWorldMatrix._m02_m12_m22_m32);
  r2.w = dot(r0.xyzw, g_StaticShadowToWorldMatrix._m03_m13_m23_m33);
  r0.x = dot(r2.xyzw, g_WorldToDynamicShadowMatrix._m02_m12_m22_m32);
  r0.y = dot(r2.xyzw, g_WorldToDynamicShadowMatrix._m03_m13_m23_m33);
  oDepth = r0.x / r0.y;
  if (r1.x != 0) return;
  if (-1 != 0) discard;
  oDepth = 1;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//
// Buffer Definitions: 
//
// cbuffer cbCopyShadowMapDepth
// {
//
//   float4x4 g_DynamicShadowToWorldMatrix;// Offset:    0 Size:    64
//   float4x4 g_WorldToDynamicShadowMatrix;// Offset:   64 Size:    64
//   float4x4 g_StaticShadowToWorldMatrix;// Offset:  128 Size:    64
//   float4x4 g_WorldToStaticShadowMatrix;// Offset:  192 Size:    64
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SS_ClampPoint                     sampler      NA          NA    7        1
// g_DepthTexture                    texture  float4          2d    1        1
// cbCopyShadowMapDepth              cbuffer      NA          NA    6        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   xyzw        2     NONE   float       
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Depth                 0    N/A   oDepth    DEPTH   float    YES
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb6[16], immediateIndexed
dcl_sampler s7, mode_default
dcl_resource_texture2d (float,float,float,float) t1
dcl_input_ps linear v1.xy
dcl_output oDepth
dcl_temps 3
mov r0.xy, v1.xyxx
mov r0.z, l(1.000000)
dp3 r1.x, r0.xyzx, cb6[0].xywx
dp3 r1.y, r0.xyzx, cb6[1].xywx
dp3 r1.z, r0.xyzx, cb6[2].xywx
dp3 r1.w, r0.xyzx, cb6[3].xywx
dp4 r0.x, r1.xyzw, cb6[12].xyzw
dp4 r0.y, r1.xyzw, cb6[13].xyzw
dp4 r0.z, r1.xyzw, cb6[15].xyzw
div r0.xy, r0.xyxx, r0.zzzz
ge r1.xy, r0.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
and r1.x, r1.y, r1.x
ge r1.yz, l(0.000000, 1.000000, 1.000000, 0.000000), r0.xxyx
and r1.x, r1.y, r1.x
and r1.x, r1.z, r1.x
sample_indexable(texture2d)(float,float,float,float) r0.z, r0.xyxx, t1.yzxw, s7
ge r1.y, r0.z, l(1.000000)
and r1.y, r1.y, r1.x
mov oDepth, l(1.000000)
retc_nz r1.y
mov r0.w, l(1.000000)
dp4 r2.x, r0.xyzw, cb6[8].xyzw
dp4 r2.y, r0.xyzw, cb6[9].xyzw
dp4 r2.z, r0.xyzw, cb6[10].xyzw
dp4 r2.w, r0.xyzw, cb6[11].xyzw
dp4 r0.x, r2.xyzw, cb6[6].xyzw
dp4 r0.y, r2.xyzw, cb6[7].xyzw
div oDepth, r0.x, r0.y
retc_nz r1.x
discard_nz l(-1)
mov oDepth, l(1.000000)
ret 
// Approximately 32 instruction slots used

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