// Depth Buffer?

cbuffer SceneWideParameterConstantBuffer : register(b0)
{
  float4x4 ViewProjection : packoffset(c0);
  float4x4 View : packoffset(c4);
  float4x4 Projection : packoffset(c8);
  float4x4 ViewInverse : packoffset(c12);
  float3 EyePosition : packoffset(c16);
  float cameraNearTimesFar : packoffset(c16.w);
  float3 GlobalAmbientColor : packoffset(c17);
  float cameraFarMinusNear : packoffset(c17.w);
  float2 cameraNearFar : packoffset(c18);
  float2 ViewportWidthHeight : packoffset(c18.z);
  float2 screenWidthHeightInv : packoffset(c19);
  float2 screenWidthHeight : packoffset(c19.z);
  float4x4 PrevViewProj : packoffset(c20);
  float4 Jitter : packoffset(c24);
  float2 InvProjXY : packoffset(c25);
  uint PointLightCount : packoffset(c25.z);
  uint SpotLightCount : packoffset(c25.w);
  uint FoliageSpheresCount : packoffset(c26);
  float time : packoffset(c26.y);
  float2 CubeFadeValues : packoffset(c26.z);
  float4 FogParameters0 : packoffset(c27);
  float4 FogParameters1 : packoffset(c28);
  float4 FogParameters2 : packoffset(c29);
  float4 FogParameters3 : packoffset(c30);
  float3 CubeSunDir : packoffset(c31);
  float padding0 : packoffset(c31.w);
  float3 CubeSunColor : packoffset(c32);
  float padding1 : packoffset(c32.w);
  float2 WindDirection : packoffset(c33);
}

SamplerState PointSampler_s : register(s0);
Texture2D<float> DepthBuffer : register(t0);


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


void main( 
  float4 v0 : SV_POSITION0,
  float2 v1 : TEXCOORD0,
  out float o0 : SV_TARGET0)
{
  float4 r0;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyzw = DepthBuffer.Sample(PointSampler_s, v1.xy).xyzw;
  r0.x = r0.x * cameraFarMinusNear + -cameraNearFar.y;
  r0.x = cameraNearTimesFar / r0.x;
  o0.x = -r0.x / cameraNearFar.y;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//   using 3Dmigoto v1.2.47 on Tue Nov 29 19:29:39 2016
//
//
// Buffer Definitions: 
//
// cbuffer SceneWideParameterConstantBuffer
// {
//
//   float4x4 ViewProjection;           // Offset:    0 Size:    64 [unused]
//   float4x4 View;                     // Offset:   64 Size:    64 [unused]
//   float4x4 Projection;               // Offset:  128 Size:    64 [unused]
//   float4x4 ViewInverse;              // Offset:  192 Size:    64 [unused]
//   float3 EyePosition;                // Offset:  256 Size:    12 [unused]
//   float cameraNearTimesFar;          // Offset:  268 Size:     4
//   float3 GlobalAmbientColor;         // Offset:  272 Size:    12 [unused]
//   float cameraFarMinusNear;          // Offset:  284 Size:     4
//   float2 cameraNearFar;              // Offset:  288 Size:     8
//   float2 ViewportWidthHeight;        // Offset:  296 Size:     8 [unused]
//   float2 screenWidthHeightInv;       // Offset:  304 Size:     8 [unused]
//   float2 screenWidthHeight;          // Offset:  312 Size:     8 [unused]
//   float4x4 PrevViewProj;             // Offset:  320 Size:    64 [unused]
//   float4 Jitter;                     // Offset:  384 Size:    16 [unused]
//   float2 InvProjXY;                  // Offset:  400 Size:     8 [unused]
//   uint PointLightCount;              // Offset:  408 Size:     4 [unused]
//   uint SpotLightCount;               // Offset:  412 Size:     4 [unused]
//   uint FoliageSpheresCount;          // Offset:  416 Size:     4 [unused]
//   float time;                        // Offset:  420 Size:     4 [unused]
//   float2 CubeFadeValues;             // Offset:  424 Size:     8 [unused]
//   float4 FogParameters0;             // Offset:  432 Size:    16 [unused]
//   float4 FogParameters1;             // Offset:  448 Size:    16 [unused]
//   float4 FogParameters2;             // Offset:  464 Size:    16 [unused]
//   float4 FogParameters3;             // Offset:  480 Size:    16 [unused]
//   float3 CubeSunDir;                 // Offset:  496 Size:    12 [unused]
//   float padding0;                    // Offset:  508 Size:     4 [unused]
//   float3 CubeSunColor;               // Offset:  512 Size:    12 [unused]
//   float padding1;                    // Offset:  524 Size:     4 [unused]
//   float2 WindDirection;              // Offset:  528 Size:     8 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// PointSampler                      sampler      NA          NA    0        1
// DepthBuffer                       texture   float          2d    0        1
// SceneWideParameterConstantBuffer    cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float       
// TEXCOORD                 0   xy          1     NONE   float   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET                0   x           0   TARGET   float   x   
//
ps_4_0
dcl_constantbuffer cb0[19], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v1.xy
dcl_output o0.x
dcl_temps 1
sample r0.xyzw, v1.xyxx, t0.xyzw, s0
mad r0.x, r0.x, cb0[17].w, -cb0[18].y
div r0.x, cb0[16].w, r0.x
div o0.x, -r0.x, cb0[18].y
ret 
// Approximately 5 instruction slots used

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