//Fog related to volumetric lighting.
// ---- Created with 3Dmigoto v1.3.16 on Sun Jan 09 12:49:26 2022
//
//cbuffer SceneInfo : register(b0)
//{
//  row_major float4x4 viewProjMat : packoffset(c0);
//  row_major float3x4 transposeViewMat : packoffset(c4);
//  row_major float3x4 transposeViewInvMat : packoffset(c7);
//  float4 projElement[2] : packoffset(c10);
//  float4 projInvElements[2] : packoffset(c12);
//  row_major float4x4 viewProjInvMat : packoffset(c14);
//  row_major float4x4 prevViewProjMat : packoffset(c18);
//  float3 ZToLinear : packoffset(c22);
//  float subdivisionLevel : packoffset(c22.w);
//  float2 screenSize : packoffset(c23);
//  float2 screenInverseSize : packoffset(c23.z);
//  float2 cullingHelper : packoffset(c24);
//  float cameraNearPlane : packoffset(c24.z);
//  float cameraFarPlane : packoffset(c24.w);
//  float4 viewFrustum[6] : packoffset(c25);
//  float4 clipplane : packoffset(c31);
//}
//
//cbuffer World : register(b1)
//{
//  row_major float4x4 worldMat : packoffset(c0);
//  row_major float4x4 prevWorldMat : packoffset(c4);
//  int jointOffset : packoffset(c8);
//  int prevJoinOffset : packoffset(c8.y);
//  int2 reserveWorld : packoffset(c8.z);
//}
//
//
//
//// 3Dmigoto declarations
//#define cmp -
//Texture1D<float4> IniParams : register(t120);
//Texture2D<float4> StereoParams : register(t125);
//
//
//void main(
//  float3 v0 : POSITION0,
//  float2 v1 : TEXCOORD0,
//  out float4 o0 : SV_Position0,
//  out float2 o1 : TEXCOORD0)
//{
//  float4 r0,r1;
//  uint4 bitmask, uiDest;
//  float4 fDest;
//
//  r0.xyzw = worldMat._m10_m11_m12_m13 * v0.yyyy;
//  r0.xyzw = v0.xxxx * worldMat._m00_m01_m02_m03 + r0.xyzw;
//  r0.xyzw = v0.zzzz * worldMat._m20_m21_m22_m23 + r0.xyzw;
//  r0.xyzw = worldMat._m30_m31_m32_m33 + r0.xyzw;
//  r1.xyz = viewProjMat._m10_m11_m13 * r0.yyy;
//  r1.xyz = r0.xxx * viewProjMat._m00_m01_m03 + r1.xyz;
//  r0.xyz = r0.zzz * viewProjMat._m20_m21_m23 + r1.xyz;
//  r0.xyz = r0.www * viewProjMat._m30_m31_m33 + r0.xyz;
//  r0.w = cmp(0 < r0.z);
//  if (r0.w != 0) {
//    r0.zw = r0.xy / r0.zz;
//  } else {
//    r0.zw = float2(8388608,8388608) * r0.xy;
//  }
//  o1.xy = jointOffset * v1.xy;
//  o0.xy = r0.zw;
//  o0.zw = float2(0,1);
//  return;
//}
//
///*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//   using 3Dmigoto v1.3.16 on Sun Jan 09 12:49:26 2022
//
//
// Buffer Definitions:
//
// cbuffer SceneInfo
// {
//
//   row_major float4x4 viewProjMat;    // Offset:    0 Size:    64
//   row_major float3x4 transposeViewMat;// Offset:   64 Size:    48 [unused]
//   row_major float3x4 transposeViewInvMat;// Offset:  112 Size:    48 [unused]
//   float4 projElement[2];             // Offset:  160 Size:    32 [unused]
//   float4 projInvElements[2];         // Offset:  192 Size:    32 [unused]
//   row_major float4x4 viewProjInvMat; // Offset:  224 Size:    64 [unused]
//   row_major float4x4 prevViewProjMat;// Offset:  288 Size:    64 [unused]
//   float3 ZToLinear;                  // Offset:  352 Size:    12 [unused]
//   float subdivisionLevel;            // Offset:  364 Size:     4 [unused]
//   float2 screenSize;                 // Offset:  368 Size:     8 [unused]
//   float2 screenInverseSize;          // Offset:  376 Size:     8 [unused]
//   float2 cullingHelper;              // Offset:  384 Size:     8 [unused]
//   float cameraNearPlane;             // Offset:  392 Size:     4 [unused]
//   float cameraFarPlane;              // Offset:  396 Size:     4 [unused]
//   float4 viewFrustum[6];             // Offset:  400 Size:    96 [unused]
//   float4 clipplane;                  // Offset:  496 Size:    16 [unused]
//
// }
//
// cbuffer World
// {
//
//   row_major float4x4 worldMat;       // Offset:    0 Size:    64
//   row_major float4x4 prevWorldMat;   // Offset:   64 Size:    64 [unused]
//   int jointOffset;                   // Offset:  128 Size:     4
//   int prevJoinOffset;                // Offset:  132 Size:     4
//   int2 reserveWorld;                 // Offset:  136 Size:     8 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SceneInfo                         cbuffer      NA          NA    0        1
// World                             cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyz         0     NONE   float   xyz
// TEXCOORD                 0   xy          1     NONE   float   xy
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xy          1     NONE   float   xy
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[4], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_temps 28
dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r25.xyzw, l(0, 0, 0, 0), t125.xyzw
mul r0.xyzw, v0.yyyy, cb1[1].xyzw
mad r0.xyzw, v0.xxxx, cb1[0].xyzw, r0.xyzw
mad r0.xyzw, v0.zzzz, cb1[2].xyzw, r0.xyzw
add r0.xyzw, r0.xyzw, cb1[3].xyzw
mul r1.xyz, r0.yyyy, cb0[1].xywx
mad r1.xyz, r0.xxxx, cb0[0].xywx, r1.xyzx
mad r0.xyz, r0.zzzz, cb0[2].xywx, r1.xyzx
mad r0.xyz, r0.wwww, cb0[3].xywx, r0.xyzx

//r0.z not used because 1c8a72a6792d4e31-ps_replace.txt already puts it at full depth.
add r25.w, r0.z, -r25.y
//add r25.w, l(0.0), -r25.y
mad r0.x, r25.x, r25.w, r0.x

lt r0.w, l(0.000000), r0.z
if_nz r0.w
  div r0.zw, r0.xxxy, r0.zzzz
else
  mul r0.zw, r0.xxxy, l(0.000000, 0.000000, 8388608.000000, 8388608.000000)
endif
mul o1.xy, v1.xyxx, cb1[8].xyxx
mov o0.xy, r0.zwzz
mov o0.zw, l(0,0,0,1.000000)
ret
// Approximately 18 instruction slots used
