// Glass Halo 2 - Disable

cbuffer _Globals : register(b4)
{
  float2 gm_vTextureSizeInv : packoffset(c0);
  float3 gd_vEyeUpperLeft : packoffset(c1);
  float3 gd_vEyeLowerRight : packoffset(c2);
  row_major float4x4 gm_mProjectionT : packoffset(c3);
  row_major float4x4 gm_mProjectionTI : packoffset(c7);
  float4 g_vParams0 : packoffset(c11);
  float4 g_vParams1 : packoffset(c12);
  float4 g_vParams2 : packoffset(c13);
  float4 g_vParams3 : packoffset(c14);
  float4 g_vParamsPC : packoffset(c15);
}

cbuffer _cbSharedPerViewData : register(b1)
{

  struct
  {
    row_major float4x4 mProjection;
    row_major float4x4 mViewToViewport;
    row_major float4x4 mViewToWorld;
    float4 vViewRemap;
    float4 vViewDepthRemap;
    float4 vEyeVectorUL;
    float4 vEyeVectorLR;
    float4 v4ShadowRange;
    float4 vViewSpaceUpVector;
    float4 vGlobalLitFactor;
    float4 vViewportSize;
    float4 vEngineTime;
    float4 vShaderColor0;
    float4 vShaderColor1;
    float4 vShaderColor2;
    float4 vShaderColor3;
    float4 vShaderColor4;
    float4 vClipPlane;
  } cbSharedPerViewData : packoffset(c0);

}

cbuffer _cbGlobalLightData : register(b2)
{

  struct
  {
    float4 vAmbientMiddle0;
    float4 vAmbientMiddle1;
    float4 vAmbientDelta0;
    float4 vAmbientDelta1;
    float4 vBackColor0;
    float4 vBackColor1;
    float4 vLightDirView;
    float4 vLightDirView2;
  } cbGlobalLightData : packoffset(c0);

}

SamplerState samplerLightModel_s : register(s0);
SamplerState samplerDeferred0_s : register(s1);
SamplerState samplerDeferred1_s : register(s2);
SamplerState samplerDeferred2_s : register(s3);
SamplerState samplerDeferred3_s : register(s4);
SamplerState samplerOcclusion_s : register(s5);
Texture2D<float4> mapLightModel : register(t0);
Texture2D<float4> mapDeferred0 : register(t1);
Texture2D<float4> mapDeferred1 : register(t2);
Texture2D<float4> mapDeferred2 : register(t3);
Texture2D<float4> mapDeferred3 : register(t4);
Texture2D<float4> mapOcclusion : register(t5);


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


void main( 
  float4 v0 : SV_POSITION0,
  float4 v1 : TEXCOORD0,
  float3 v2 : TEXCOORD1,
  out float4 o0 : SV_TARGET0)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyzw = gm_mProjectionTI._m10_m11_m12_m13 * v1.yyyy;
  r0.xyzw = v1.xxxx * gm_mProjectionTI._m00_m01_m02_m03 + r0.xyzw;
  r1.xyzw = mapDeferred0.Sample(samplerDeferred0_s, v1.xy).xyzw;
  r0.xyzw = r1.xxxx * gm_mProjectionTI._m20_m21_m22_m23 + r0.xyzw;
  r0.xyzw = gm_mProjectionTI._m30_m31_m32_m33 + r0.xyzw;
  r0.xyz = r0.xyz / r0.www;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.xyz = r0.xyz * r0.www;
  r0.w = dot(v2.xyz, v2.xyz);
  r0.w = rsqrt(r0.w);
  r1.xyz = v2.xyz * r0.www;
  r0.w = cmp(0 != g_vParamsPC.x);
  r0.xyz = r0.www ? -r0.xyz : r1.xyz;
  r1.xyzw = mapDeferred1.Sample(samplerDeferred1_s, v1.xy).xyzw;
  r1.xyz = float3(-0.5,-0.5,-0.5) + r1.xyz;
  r1.xyz = r1.xyz + r1.xyz;
  r0.w = dot(r1.xyz, r1.xyz);
  r0.w = rsqrt(r0.w);
  r1.xyz = r1.xyz * r0.www;
  r0.w = dot(r1.xyz, cbGlobalLightData.vLightDirView2.xyz);
  r2.xyz = r0.www * r1.xyz + -cbGlobalLightData.vLightDirView.xyz;
  r1.x = dot(r1.xyz, cbSharedPerViewData.vViewSpaceUpVector.xyz);
  r1.xyz = cbGlobalLightData.vAmbientDelta0.xyz * r1.xxx + cbGlobalLightData.vAmbientMiddle0.xyz;
  r3.x = saturate(0.5 * r0.w);
  r3.y = saturate(dot(r0.xyz, r2.xyz));
  r0.xyzw = mapDeferred2.Sample(samplerDeferred2_s, v1.xy).xyzw;
  r3.z = saturate(r0.w);
  r3.w = dot(r3.yz, float2(0.248046875,0.75390625));
  r2.xyzw = mapLightModel.Sample(samplerLightModel_s, r3.xw).xyzw;
  r1.xyz = r2.xyz * cbGlobalLightData.vBackColor0.xyz + r1.xyz;
  r1.w = r2.w * 1024 + -1000;
  r2.xyzw = mapDeferred3.Sample(samplerDeferred3_s, v1.xy).xyzw;
  r1.w = r2.y * r1.w;
  r1.w = exp2(r1.w);
  r1.w = r1.w * r2.x;
  r2.xyz = cbGlobalLightData.vBackColor0.xyz * r1.www;
  r0.xyz = r1.xyz * r0.xyz + r2.xyz;
  o0.w = saturate(-0.660000026 + r0.w);
  r1.xyzw = mapOcclusion.Sample(samplerOcclusion_s, v1.xy).xyzw;
  r1.xyz = r1.xyz * r1.xyz;
  o0.xyz = r1.xyz * r0.xyz;
  
  o0 = 0;
  
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
//   using 3Dmigoto v1.2.19 on Tue Dec 22 17:27:52 2015
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float2 gm_vTextureSizeInv;         // Offset:    0 Size:     8 [unused]
//   float3 gd_vEyeUpperLeft;           // Offset:   16 Size:    12 [unused]
//   float3 gd_vEyeLowerRight;          // Offset:   32 Size:    12 [unused]
//   row_major float4x4 gm_mProjectionT;// Offset:   48 Size:    64 [unused]
//   row_major float4x4 gm_mProjectionTI;// Offset:  112 Size:    64
//   float4 g_vParams0;                 // Offset:  176 Size:    16 [unused]
//   float4 g_vParams1;                 // Offset:  192 Size:    16 [unused]
//   float4 g_vParams2;                 // Offset:  208 Size:    16 [unused]
//   float4 g_vParams3;                 // Offset:  224 Size:    16 [unused]
//   float4 g_vParamsPC;                // Offset:  240 Size:    16
//
// }
//
// cbuffer _cbSharedPerViewData
// {
//
//   struct
//   {
//       
//       row_major float4x4 mProjection;// Offset:    0
//       row_major float4x4 mViewToViewport;// Offset:   64
//       row_major float4x4 mViewToWorld;// Offset:  128
//       float4 vViewRemap;             // Offset:  192
//       float4 vViewDepthRemap;        // Offset:  208
//       float4 vEyeVectorUL;           // Offset:  224
//       float4 vEyeVectorLR;           // Offset:  240
//       float4 v4ShadowRange;          // Offset:  256
//       float4 vViewSpaceUpVector;     // Offset:  272
//       float4 vGlobalLitFactor;       // Offset:  288
//       float4 vViewportSize;          // Offset:  304
//       float4 vEngineTime;            // Offset:  320
//       float4 vShaderColor0;          // Offset:  336
//       float4 vShaderColor1;          // Offset:  352
//       float4 vShaderColor2;          // Offset:  368
//       float4 vShaderColor3;          // Offset:  384
//       float4 vShaderColor4;          // Offset:  400
//       float4 vClipPlane;             // Offset:  416
//
//   } cbSharedPerViewData;             // Offset:    0 Size:   432
//
// }
//
// cbuffer _cbGlobalLightData
// {
//
//   struct
//   {
//       
//       float4 vAmbientMiddle0;        // Offset:    0
//       float4 vAmbientMiddle1;        // Offset:   16
//       float4 vAmbientDelta0;         // Offset:   32
//       float4 vAmbientDelta1;         // Offset:   48
//       float4 vBackColor0;            // Offset:   64
//       float4 vBackColor1;            // Offset:   80
//       float4 vLightDirView;          // Offset:   96
//       float4 vLightDirView2;         // Offset:  112
//
//   } cbGlobalLightData;               // Offset:    0 Size:   128
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// samplerLightModel                 sampler      NA          NA    0        1
// samplerDeferred0                  sampler      NA          NA    1        1
// samplerDeferred1                  sampler      NA          NA    2        1
// samplerDeferred2                  sampler      NA          NA    3        1
// samplerDeferred3                  sampler      NA          NA    4        1
// samplerOcclusion                  sampler      NA          NA    5        1
// mapLightModel                     texture  float4          2d    0        1
// mapDeferred0                      texture  float4          2d    1        1
// mapDeferred1                      texture  float4          2d    2        1
// mapDeferred2                      texture  float4          2d    3        1
// mapDeferred3                      texture  float4          2d    4        1
// mapOcclusion                      texture  float4          2d    5        1
// _cbSharedPerViewData              cbuffer      NA          NA    1        1
// _cbGlobalLightData                cbuffer      NA          NA    2        1
// $Globals                          cbuffer      NA          NA    4        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 
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer cb4[16], immediateIndexed
dcl_constantbuffer cb1[18], immediateIndexed
dcl_constantbuffer cb2[8], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_sampler s4, mode_default
dcl_sampler s5, 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) t4
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_temps 4
mul r0.xyzw, v1.yyyy, cb4[8].xyzw
mad r0.xyzw, v1.xxxx, cb4[7].xyzw, r0.xyzw
sample r1.xyzw, v1.xyxx, t1.xyzw, s1
mad r0.xyzw, r1.xxxx, cb4[9].xyzw, r0.xyzw
add r0.xyzw, r0.xyzw, cb4[10].xyzw
div r0.xyz, r0.xyzx, r0.wwww
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
dp3 r0.w, v2.xyzx, v2.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, v2.xyzx
ne r0.w, l(0.000000, 0.000000, 0.000000, 0.000000), cb4[15].x
movc r0.xyz, r0.wwww, -r0.xyzx, r1.xyzx
sample r1.xyzw, v1.xyxx, t2.xyzw, s2
add r1.xyz, r1.xyzx, l(-0.500000, -0.500000, -0.500000, 0.000000)
add r1.xyz, r1.xyzx, r1.xyzx
dp3 r0.w, r1.xyzx, r1.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, r1.xyzx
dp3 r0.w, r1.xyzx, cb2[7].xyzx
mad r2.xyz, r0.wwww, r1.xyzx, -cb2[6].xyzx
dp3 r1.x, r1.xyzx, cb1[17].xyzx
mad r1.xyz, cb2[2].xyzx, r1.xxxx, cb2[0].xyzx
mul_sat r3.x, r0.w, l(0.500000)
dp3_sat r3.y, r0.xyzx, r2.xyzx
sample r0.xyzw, v1.xyxx, t3.xyzw, s3
mov_sat r3.z, r0.w
dp2 r3.w, r3.yzyy, l(0.248046875, 0.753906250, 0.000000, 0.000000)
sample r2.xyzw, r3.xwxx, t0.xyzw, s0
mad r1.xyz, r2.xyzx, cb2[4].xyzx, r1.xyzx
mad r1.w, r2.w, l(1024.000000), l(-1000.000000)
sample r2.xyzw, v1.xyxx, t4.xyzw, s4
mul r1.w, r1.w, r2.y
exp r1.w, r1.w
mul r1.w, r2.x, r1.w
mul r2.xyz, r1.wwww, cb2[4].xyzx
mad r0.xyz, r1.xyzx, r0.xyzx, r2.xyzx
add_sat o0.w, r0.w, l(-0.660000)
sample r1.xyzw, v1.xyxx, t5.xyzw, s5
mul r1.xyz, r1.xyzx, r1.xyzx
mul o0.xyz, r0.xyzx, r1.xyzx
ret 
// Approximately 43 instruction slots used

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