//fog no fix here
// ---- Created with 3Dmigoto v1.3.11 on Tue Aug 07 20:45:15 2018

cbuffer cb_g_Frame : register(b1)
{

  struct
  {
    float4 m_CurrentTime;
    bool m_DeconstructionEnabled;
    float4 m_DeconstructionRanges;
    float4 m_DeconstructionOrigin;
    float4 m_GlobalWind;
    float4 m_WeatherInfo;
    float4 m_SkyVisibilityWetnessBias;
    float4 m_MainPlayerPosition;

    struct
    {
      float4 m_ShadowMapSize;
      float4 m_Offsets[4];
      float4 m_Scales[4];
      float4 m_SplitBlendMulAddUVAndZ[4];
      float4 m_NoiseScale;
      float4 m_NearFar;
      float4 m_FadeParams;
      float4 m_CascadesRangesMax;
      float4 m_CascadesRangesMin;
      float4 m_ShadowSplitBlendUVAmount;
      float4x4 m_WorldToLightProj;
      float4x4 m_FarWorldToLightProj;
      float4x4 m_DebugShadowVisiblePixelMat;
    } m_SunShadows;


    struct
    {
      float4 m_Direction;
      float4 m_Color;
    } m_SunLight;


    struct
    {
      float4 Params;
      float4 WSToIndirectionScale;
      float4 WSToIndirectionBias;
      float4 InvVolumeSize;
      float4 InvVolumeAtlasSize;
    } m_GIConsts;

    float4 m_LocalCubeMapParams[2];

    struct
    {
      float4 boxMax;
      float4 boxMin;
      float4 innerBlendBoxMax;
      float4 blendBoxMax;
      float4 worldPosition;
      float4x4 worldToLocal;
      uint cubeMapArrayIndex;
      float padding;
    } m_LocalCubeMaps[32];


    struct
    {
      float4 VolumeInvTransZ;
      float4 VolumeTexScale;
      float4 VolumeTexBias;
      float4 SunColor;
      float4 SunColorByOneOverPi;
    } m_VolumetricFog;


    struct
    {
      float RippleScale;
      float2 SurfaceFloodLevelRef;
      float4 RippleImpactSurfaceSizeInvSize;
    } m_SurfaceWeatherModifications;


    struct
    {
      float4 HeightMapSize;
      float4 HeightMapOffset;
    } m_RainBlockerConsts;

    float4 m_WorldMapFogExtents;
    float4 m_WorldMapFogTextureSize;
    float m_WorldMapFogMinHeight;
    float m_WorldMapFogMaxHeight;
    uint m_WorldMapFogVisibilityFlags;
    float4 m_WorldMapDistrictColors[32];
    float4 m_UILighting[6];
    float m_CharacterEffectMultiplier;
  } g_Frame : packoffset(c0);

}

cbuffer cb_g_Pass : register(b2)
{

  struct
  {
    float4 m_EyePosition;
    float4 m_EyeDirection;
    float4x4 m_ViewToWorld;
    float4x4 m_WorldToView;
    float4x4 m_ProjMatrix;
    float4x4 m_ViewProj;
    float4x4 m_ViewNoTranslationProj;
    float4 m_ViewTranslation;

    struct
    {
      float4x4 clipXYZToViewPos;
      float4x4 clipXYZToWorldPos;
      float4 clipZToViewZ;
    } reverseProjParams;

    float4 m_VPosToUV;
    float4 m_ViewportScaleOffset;
    float4 m_ClipPlane;
    float4 m_GlobalLightingScale;
    float4 m_ViewSpaceLightingBackWS;
    float4 m_ThinGeomAAPixelScale;
  } g_Pass : packoffset(c0);

}

cbuffer cb_g_SetAlphaConsts : register(b8)
{

  struct
  {
    float4 SetAlphaValue;
  } g_SetAlphaConsts : packoffset(c0);

}

SamplerState s_TrilinearClamp_s : register(s12);
Texture3D<float4> t_g_FogLookup : register(t0);
Texture2DMS<float,4> t_g_ViewDepthTexture : 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,
  uint v2 : SV_SampleIndex0,
  out float4 o0 : SV_Target0,
  out float4 o1 : SV_Target1)
{
  float4 r0;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xy = (uint2)v0.xy;
  r0.zw = float2(0,0);
  r0.x = t_g_ViewDepthTexture.Load(r0.xy, v2.x).x;
  r0.xy = r0.xx * g_Pass.reverseProjParams.clipZToViewZ.wz + g_Pass.reverseProjParams.clipZToViewZ.yx;
  r0.x = r0.x / r0.y;
  r0.x = log2(r0.x);
  r0.x = r0.x * g_Frame.m_VolumetricFog.VolumeInvTransZ.x + g_Frame.m_VolumetricFog.VolumeInvTransZ.y;
  r0.x = max(0, r0.x);
  r0.z = min(g_Frame.m_VolumetricFog.VolumeInvTransZ.z, r0.x);
  r0.xy = v0.xy;
  r0.xyz = r0.xyz * g_Frame.m_VolumetricFog.VolumeTexScale.xyz + g_Frame.m_VolumetricFog.VolumeTexBias.xyz;
  r0.xyzw = t_g_FogLookup.SampleLevel(s_TrilinearClamp_s, r0.xyz, 0).xyzw;
  r0.xyzw = r0.xyzw * r0.xyzw;
  o0.xyz = g_Pass.m_GlobalLightingScale.xxx * r0.xyz;
  o1.xyzw = r0.wwww;
  o0.w = g_SetAlphaConsts.SetAlphaValue.x;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.3.11 on Tue Aug 07 20:45:15 2018
//
//
// Buffer Definitions:
//
// cbuffer cb_g_Frame
// {
//
//   struct FrameConsts
//   {
//
//       float4 m_CurrentTime;          // Offset:    0
//       bool m_DeconstructionEnabled;  // Offset:   16
//       float4 m_DeconstructionRanges; // Offset:   32
//       float4 m_DeconstructionOrigin; // Offset:   48
//       float4 m_GlobalWind;           // Offset:   64
//       float4 m_WeatherInfo;          // Offset:   80
//       float4 m_SkyVisibilityWetnessBias;// Offset:   96
//       float4 m_MainPlayerPosition;   // Offset:  112
//
//       struct SunShadowConsts
//       {
//
//           float4 m_ShadowMapSize;    // Offset:  128
//           float4 m_Offsets[4];       // Offset:  144
//           float4 m_Scales[4];        // Offset:  208
//           float4 m_SplitBlendMulAddUVAndZ[4];// Offset:  272
//           float4 m_NoiseScale;       // Offset:  336
//           float4 m_NearFar;          // Offset:  352
//           float4 m_FadeParams;       // Offset:  368
//           float4 m_CascadesRangesMax;// Offset:  384
//           float4 m_CascadesRangesMin;// Offset:  400
//           float4 m_ShadowSplitBlendUVAmount;// Offset:  416
//           float4x4 m_WorldToLightProj;// Offset:  432
//           float4x4 m_FarWorldToLightProj;// Offset:  496
//           float4x4 m_DebugShadowVisiblePixelMat;// Offset:  560
//
//       } m_SunShadows;                // Offset:  128
//
//       struct DirectLightConsts
//       {
//
//           float4 m_Direction;        // Offset:  624
//           float4 m_Color;            // Offset:  640
//
//       } m_SunLight;                  // Offset:  624
//
//       struct GISamplingConfig
//       {
//
//           float4 Params;             // Offset:  656
//           float4 WSToIndirectionScale;// Offset:  672
//           float4 WSToIndirectionBias;// Offset:  688
//           float4 InvVolumeSize;      // Offset:  704
//           float4 InvVolumeAtlasSize; // Offset:  720
//
//       } m_GIConsts;                  // Offset:  656
//       float4 m_LocalCubeMapParams[2];// Offset:  736
//
//       struct LocalCubeMapParams
//       {
//
//           float4 boxMax;             // Offset:  768
//           float4 boxMin;             // Offset:  784
//           float4 innerBlendBoxMax;   // Offset:  800
//           float4 blendBoxMax;        // Offset:  816
//           float4 worldPosition;      // Offset:  832
//           float4x4 worldToLocal;     // Offset:  848
//           uint cubeMapArrayIndex;    // Offset:  912
//           float padding;             // Offset:  916
//
//       } m_LocalCubeMaps[32];         // Offset:  768
//
//       struct VolumetricFogConsts
//       {
//
//           float4 VolumeInvTransZ;    // Offset: 5888
//           float4 VolumeTexScale;     // Offset: 5904
//           float4 VolumeTexBias;      // Offset: 5920
//           float4 SunColor;           // Offset: 5936
//           float4 SunColorByOneOverPi;// Offset: 5952
//
//       } m_VolumetricFog;             // Offset: 5888
//
//       struct SurfaceWeatherModificationConsts
//       {
//
//           float RippleScale;         // Offset: 5968
//           float2 SurfaceFloodLevelRef;// Offset: 5972
//           float4 RippleImpactSurfaceSizeInvSize;// Offset: 5984
//
//       } m_SurfaceWeatherModifications;// Offset: 5968
//
//       struct RainBlockerConsts
//       {
//
//           float4 HeightMapSize;      // Offset: 6000
//           float4 HeightMapOffset;    // Offset: 6016
//
//       } m_RainBlockerConsts;         // Offset: 6000
//       float4 m_WorldMapFogExtents;   // Offset: 6032
//       float4 m_WorldMapFogTextureSize;// Offset: 6048
//       float m_WorldMapFogMinHeight;  // Offset: 6064
//       float m_WorldMapFogMaxHeight;  // Offset: 6068
//       uint m_WorldMapFogVisibilityFlags;// Offset: 6072
//       float4 m_WorldMapDistrictColors[32];// Offset: 6080
//       float4 m_UILighting[6];        // Offset: 6592
//       float m_CharacterEffectMultiplier;// Offset: 6688
//
//   } g_Frame;                         // Offset:    0 Size:  6692
//
// }
//
// cbuffer cb_g_Pass
// {
//
//   struct PassConsts
//   {
//
//       float4 m_EyePosition;          // Offset:    0
//       float4 m_EyeDirection;         // Offset:   16
//       float4x4 m_ViewToWorld;        // Offset:   32
//       float4x4 m_WorldToView;        // Offset:   96
//       float4x4 m_ProjMatrix;         // Offset:  160
//       float4x4 m_ViewProj;           // Offset:  224
//       float4x4 m_ViewNoTranslationProj;// Offset:  288
//       float4 m_ViewTranslation;      // Offset:  352
//
//       struct ReverseProjParams
//       {
//
//           float4x4 clipXYZToViewPos; // Offset:  368
//           float4x4 clipXYZToWorldPos;// Offset:  432
//           float4 clipZToViewZ;       // Offset:  496
//
//       } reverseProjParams;           // Offset:  368
//       float4 m_VPosToUV;             // Offset:  512
//       float4 m_ViewportScaleOffset;  // Offset:  528
//       float4 m_ClipPlane;            // Offset:  544
//       float4 m_GlobalLightingScale;  // Offset:  560
//       float4 m_ViewSpaceLightingBackWS;// Offset:  576
//       float4 m_ThinGeomAAPixelScale; // Offset:  592
//
//   } g_Pass;                          // Offset:    0 Size:   608
//
// }
//
// cbuffer cb_g_SetAlphaConsts
// {
//
//   struct SetAlphaConsts
//   {
//
//       float4 SetAlphaValue;          // Offset:    0
//
//   } g_SetAlphaConsts;                // Offset:    0 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// s_TrilinearClamp                  sampler      NA          NA   12        1
// t_g_FogLookup                     texture  float4          3d    0        1
// t_g_ViewDepthTexture              texture   float       2dMS4    1        1
// cb_g_Frame                        cbuffer      NA          NA    1        1
// cb_g_Pass                         cbuffer      NA          NA    2        1
// cb_g_SetAlphaConsts               cbuffer      NA          NA    8        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xy
// TEXCOORD                 0   xy          1     NONE   float
// SV_SampleIndex           0   x           2   SAMPLE    uint   x
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
// SV_Target                1   xyzw        1   TARGET   float   xyzw
//
// Pixel Shader runs at sample frequency
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb1[371], immediateIndexed
dcl_constantbuffer cb2[36], immediateIndexed
dcl_constantbuffer cb8[1], immediateIndexed
dcl_sampler s12, mode_default
dcl_resource_texture3d (float,float,float,float) t0
dcl_resource_texture2dms(4) (float,float,float,float) t1
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_input_ps_sgv v2.x, sampleIndex
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_temps 1
ftou r0.xy, v0.xyxx
mov r0.zw, l(0,0,0,0)
ldms_indexable(texture2dms)(float,float,float,float) r0.x, r0.xyzw, t1.xyzw, v2.x
mad r0.xy, r0.xxxx, cb2[31].wzww, cb2[31].yxyy
div r0.x, r0.x, r0.y
log r0.x, r0.x
mad r0.x, r0.x, cb1[368].x, cb1[368].y
max r0.x, r0.x, l(0.000000)
min r0.z, r0.x, cb1[368].z
mov r0.xy, v0.xyxx
mad r0.xyz, r0.xyzx, cb1[369].xyzx, cb1[370].xyzx
sample_l_indexable(texture3d)(float,float,float,float) r0.xyzw, r0.xyzx, t0.xyzw, s12, l(0.000000)
mul r0.xyzw, r0.xyzw, r0.xyzw
mul o0.xyz, r0.xyzx, cb2[35].xxxx
mov o1.xyzw, r0.wwww
mov o0.w, cb8[0].x
ret
// Approximately 17 instruction slots used

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