// ---- Created with 3Dmigoto v1.3.11 on Wed Sep 05 13:33:22 2018

cbuffer PerFrame : register(b13)
{
  float4x4 global_LightPropertyMatrix : packoffset(c0);
  float4x3 global_FogPropertyMatrix : packoffset(c4);
  float4 global_Data : packoffset(c7);
  float4 global_Data2 : packoffset(c8);
}

cbuffer PerView : register(b12)
{
  row_major float4x4 global_View : packoffset(c0);
  row_major float4x4 global_Projection : packoffset(c4);
  row_major float4x4 global_ViewProjection : packoffset(c8);
  float4 global_ViewPos : packoffset(c12);
  float4 global_ViewInfo : packoffset(c13);
  float4 global_ScaleAndBias : packoffset(c14);
}

Texture2D<float4> LinearDepth : register(t0);
Texture2D<float4> Base : register(t1);


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


void main(
  float4 v0 : SV_Position0,
  float2 v1 : TexCoord0,
  float3 v2 : TexCoord1,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xy = (int2)v0.xy;
  r0.zw = float2(0,0);
  r0.z = LinearDepth.Load(r0.xyz).x;
  r1.xyzw = Base.Load(r0.xyw).xyzw;
  r0.x = r0.z * v2.y + global_ViewPos.y;
  r0.yzw = v2.xyz * r0.zzz;
  r0.y = dot(r0.yzw, r0.yzw);
  r0.y = sqrt(r0.y);
  r0.yz = saturate(-r0.yy * global_Data2.zx + global_Data2.wy);
  r0.x = -global_FogPropertyMatrix._m22 + r0.x;
  r0.x = r0.x / global_FogPropertyMatrix._m32;
  r0.x = max(r0.y, r0.x);
  r0.x = min(1, r0.x);
  r2.x = global_FogPropertyMatrix._m10;
  r2.y = global_FogPropertyMatrix._m11;
  r2.z = global_FogPropertyMatrix._m12;
  r1.xyz = -r2.xyz + r1.xyz;
  o0.w = r1.w;
  r0.xyw = r0.xxx * r1.xyz + r2.xyz;
  r1.x = global_FogPropertyMatrix._m00;
  r1.y = global_FogPropertyMatrix._m01;
  r1.z = global_FogPropertyMatrix._m02;
  r0.xyw = -r1.xyz + r0.xyw;
  o0.xyz = r0.zzz * r0.xyw + r1.xyz;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.11 on Wed Sep 05 13:33:22 2018
//
//
// Buffer Definitions:
//
// cbuffer PerFrame
// {
//
//   float4x4 global_LightPropertyMatrix;// Offset:    0 Size:    64 [unused]
//   float4x3 global_FogPropertyMatrix; // Offset:   64 Size:    48
//   float4 global_Data;                // Offset:  112 Size:    16 [unused]
//   float4 global_Data2;               // Offset:  128 Size:    16
//
// }
//
// cbuffer PerView
// {
//
//   row_major float4x4 global_View;    // Offset:    0 Size:    64 [unused]
//   row_major float4x4 global_Projection;// Offset:   64 Size:    64 [unused]
//   row_major float4x4 global_ViewProjection;// Offset:  128 Size:    64 [unused]
//   float4 global_ViewPos;             // Offset:  192 Size:    16
//   float4 global_ViewInfo;            // Offset:  208 Size:    16 [unused]
//   float4 global_ScaleAndBias;        // Offset:  224 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// LinearDepth                       texture  float4          2d    0        1
// Base                              texture  float4          2d    1        1
// PerView                           cbuffer      NA          NA   12        1
// PerFrame                          cbuffer      NA          NA   13        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xy
// TexCoord                 0   xy          1     NONE   float
// 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_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb13[9], immediateIndexed
dcl_constantbuffer cb12[13], immediateIndexed
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_input_ps linear v2.xyz
dcl_output o0.xyzw
dcl_temps 3
ftoi r0.xy, v0.xyxx
mov r0.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r0.z, r0.xyzw, t0.yzxw
ld_indexable(texture2d)(float,float,float,float) r1.xyzw, r0.xyww, t1.xyzw
mad r0.x, r0.z, v2.y, cb12[12].y
mul r0.yzw, r0.zzzz, v2.xxyz
dp3 r0.y, r0.yzwy, r0.yzwy
sqrt r0.y, r0.y
mad_sat r0.yz, -r0.yyyy, cb13[8].zzxz, cb13[8].wwyw
add r0.x, r0.x, -cb13[6].z
div r0.x, r0.x, cb13[6].w
max r0.x, r0.x, r0.y
min r0.x, r0.x, l(1.000000)
mov r2.x, cb13[4].y
mov r2.y, cb13[5].y
mov r2.z, cb13[6].y
add r1.xyz, r1.xyzx, -r2.xyzx
mov o0.w, r1.w
mad r0.xyw, r0.xxxx, r1.xyxz, r2.xyxz
mov r1.x, cb13[4].x
mov r1.y, cb13[5].x
mov r1.z, cb13[6].x
add r0.xyw, r0.xyxw, -r1.xyxz
mad o0.xyz, r0.zzzz, r0.xywx, r1.xyzx
ret
// Approximately 25 instruction slots used

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