//Tessellation PS?
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
//
//   using 3Dmigoto v1.3.16 on Sun Jan 16 00:46:33 2022
//
//
// Buffer Definitions:
//
// cbuffer ConstBuf__viewData
// {
//
//   struct ViewData
//   {
//
//       float4x4 view;                 // Index:    0
//       float4x4 invView;              // Index:    4
//       float4x4 proj;                 // Index:    8
//       float4x4 invViewProjNoZReproj; // Index:   12
//       float4x4 viewProj;             // Index:   16
//       float4x4 invViewProj;          // Index:   20
//       float4x4 previousViewProj;     // Index:   24
//       float4 prevLodEyePos;          // Index:   28
//       float4 lodEyePos;              // Index:   29
//       float4 viewDirDepthBias;       // Index:   30
//       float3 eyePos;                 // Index:   31
//       float2 viewportSize;           // Index:   32
//       float2 invViewportSize;        // Index:   32.z
//       float4 mirrorPlaneWS;          // Index:   33
//       float2 mirrorViewportSize;     // Index:   34
//       float2 opaqueRefractionViewportSize;// Index:   34.z
//       float windTime;                // Index:   35
//       float deltaTime;               // Index:   35.y
//       float depthReprojectScale;     // Index:   35.z
//       float depthReprojectBias;      // Index:   35.w
//       uint shadowViewType;           // Index:   36
//       float normalDepthBias;         // Index:   36.y
//       float noNormalAA;              // Index:   36.z
//       float noNormalFromAlpha;       // Index:   36.w
//       float noOpaqueTransparency;    // Index:   37
//       float translucentAmount;       // Index:   37.y
//       uint framePhase;               // Index:   37.z
//       float cameraAmbientExposure;   // Index:   37.w
//       float fxExposure;              // Index:   38
//       float fxAmbientExposure;       // Index:   38.y
//       uint checkerboardPhase;        // Index:   38.z
//       float sparkleIntensityScale;   // Index:   38.w
//
//   } resourceTables__viewData;        // Index:    0-38             Components:   156
//
// }
//
// cbuffer ConstBuf__materialData
// {
//
//   struct MaterialData
//   {
//
//       struct MaterialTextureMap
//       {
//
//           float3 matU;               // Index:    0
//           uint swizzle;              // Index:    0.w
//           float3 matV;               // Index:    1
//           uint mode;                 // Index:    1.w
//
//       } texPerm;                     // Index:    0
//       float cst_permScale0;          // Index:    2
//       float cst_permClearBorder;     // Index:    2.y
//
//       struct MaterialTextureMap
//       {
//
//           float3 matU;               // Index:    3
//           uint swizzle;              // Index:    3.w
//           float3 matV;               // Index:    4
//           uint mode;                 // Index:    4.w
//
//       } texHeightInitial;            // Index:    3
//
//       struct MaterialTextureMap
//       {
//
//           float3 matU;               // Index:    5
//           uint swizzle;              // Index:    5.w
//           float3 matV;               // Index:    6
//           uint mode;                 // Index:    6.w
//
//       } texHeightRaised;             // Index:    5
//       float cst_heightScale1;        // Index:    7
//
//       struct MaterialTextureMap
//       {
//
//           float3 matU;               // Index:    8
//           uint swizzle;              // Index:    8.w
//           float3 matV;               // Index:    9
//           uint mode;                 // Index:    9.w
//
//       } texHeightDetail;             // Index:    8
//       float cst_heightScale2;        // Index:   10
//       int cst_LayerBlendFunc2;       // Index:   10.y
//
//   } resourceTables__materialData;    // Index:    0-10.y           Components:    42
                                        // Textures:  t11-t14
//
// }
//
// Resource bind info for resourceTables__modelData.customRTs
// {
//
//   struct CustomRTTransform
//   {
//
//       float4x4 ws2ts;                // Index:    0
//
//   } $Element;                        // Index:    0 1 2 3          Components:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// resourceTables__viewData__smpLowAniso    sampler      NA          NA    2        1
// resourceTables__viewData__smpLinearClamp    sampler      NA          NA    5        1
// resourceTables__modelData.customRTs    texture  struct         r/o    7        1
// resourceTables__materialData.texPerm.tex    texture  float4          2d   11        1
// resourceTables__materialData.texHeightInitial.tex    texture  float4          2d   12        1
// resourceTables__materialData.texHeightRaised.tex    texture  float4          2d   13        1
// resourceTables__materialData.texHeightDetail.tex    texture  float4          2d   14        1
// ConstBuf__viewData                cbuffer      NA          NA    1        1
// ConstBuf__materialData            cbuffer      NA          NA    2        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyz
// VERT_ID                  0   x           1     NONE    uint
// TEXCOORD                 0   xy          2     NONE   float   xy
// NORMAL                   0   xyz         3     NONE   float
// TANGENT                  0   xyz         4     NONE   float
// BINORMAL                 0   xyz         5     NONE   float
// COLOR                    0   xyzw        6     NONE   float   x
// TEXCOORD                 8   xyz         7     NONE   float
//
//
// 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 cb1[33], immediateIndexed
dcl_constantbuffer cb2[11], immediateIndexed
dcl_sampler s2, mode_default
dcl_sampler s5, mode_default
dcl_resource_structured t7, 64
dcl_resource_texture2d (float,float,float,float) t11
dcl_resource_texture2d (float,float,float,float) t12
dcl_resource_texture2d (float,float,float,float) t13
dcl_resource_texture2d (float,float,float,float) t14
dcl_input_ps_siv linear noperspective v0.xyz, position
dcl_input_ps linear v2.xy
dcl_input_ps linear v6.x
dcl_output o0.xyzw
dcl_temps 50
dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r40.xyzw, l(0, 0, 0, 0), t125.xyzw

mov r30.xyz, v0.xyz
//add r40.w, l(640.0), -r40.y
//mad r30.x, -r40.x, r40.w, r30.x

mul r0.xy, v0.xyxx, cb1[32].zwzz

div r40.w, -r40.y, v0.w
add r40.w, r40.w, l(1.0)
mul r40.w, r40.w, l(0.5)
mad r0.x, -r40.x, r40.w, r0.x

mad r0.xy, r0.xyxx, l(2.000000, -2.000000, 0.000000, 0.000000), l(-1.000000, 1.000000, 0.000000, 0.000000)
mov r0.z, v0.z
mov r0.w, l(1.000000)

//add r40.w, r0.z, -r40.y
//mad r0.x, -r40.x, r40.w, r0.x




dp4 r1.x, r0.xyzw, cb1[20].xyzw
dp4 r1.y, r0.xyzw, cb1[21].xyzw
dp4 r1.z, r0.xyzw, cb1[22].xyzw
dp4 r0.x, r0.xyzw, cb1[23].xyzw

//mad r1.x, r40.x, r0.x, r1.x

div r0.xyz, r1.xyzx, r0.xxxx



add r1.x, l(-4.000000), cb1[29].y
round_ni r1.x, r1.x
add r0.y, r0.y, -r1.x
ine r1.x, cb2[4].w, l(0x0000ffff)
if_nz r1.x
  uge r1.x, cb2[4].w, l(103)
  uge r1.y, l(110), cb2[4].w
  and r1.x, r1.y, r1.x
  iadd r1.y, cb2[4].w, l(-103)
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r2.xyzw, r1.y, l(0), t7.xyzw
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r3.xyzw, r1.y, l(16), t7.xyzw
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r4.xyzw, r1.y, l(48), t7.xyzw
  mov r0.w, l(1.000000)
  
  
  
  dp4 r2.x, r0.xyzw, r2.xyzw
  dp4 r2.y, r0.xyzw, r3.xyzw
  dp4 r1.y, r0.xyzw, r4.xyzw
  
  
  
  div r1.yz, r2.xxyx, r1.yyyy
  movc r2.xy, r1.xxxx, r1.yzyy, v2.xyxx
  mov r2.z, l(1.000000)
  
  //add r40.w, r1.x, -r40.y
  //mad r2.x, -r40.x, r40.w, r2.x
  
  dp3 r3.x, r2.xyzx, cb2[3].xyzx
  dp3 r3.y, r2.xyzx, cb2[4].xyzx
  movc r1.xy, r1.xxxx, r1.yzyy, r3.xyxx
  sample_indexable(texture2d)(float,float,float,float) r1.x, r1.xyxx, t12.xyzw, s2
  div r1.x, r1.x, cb2[2].x
  add r1.x, r0.y, -r1.x
else
  mov r1.x, r0.y
endif
ine r1.y, cb2[1].w, l(0x0000ffff)
if_nz r1.y
  div r1.y, l(1.000000, 1.000000, 1.000000, 1.000000), cb2[2].x
  add r1.y, r0.y, -r1.y
  uge r1.z, cb2[1].w, l(103)
  uge r1.w, l(110), cb2[1].w
  and r1.z, r1.w, r1.z
  iadd r1.w, cb2[1].w, l(-103)
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r2.xyzw, r1.w, l(0), t7.xyzw
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r3.xyzw, r1.w, l(16), t7.xyzw
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r4.xyzw, r1.w, l(48), t7.xyzw
  mov r0.w, l(1.000000)
  
  
  
  dp4 r2.x, r0.xyzw, r2.xyzw
  dp4 r2.y, r0.xyzw, r3.xyzw
  dp4 r1.w, r0.xyzw, r4.xyzw
  
  //mad r2.x, r40.x, r1.w, r2.x
  
  div r2.xy, r2.xyxx, r1.wwww
  movc r3.xy, r1.zzzz, r2.xyxx, v2.xyxx
  mov r3.z, l(1.000000)
  
  
  
  dp3 r4.x, r3.xyzx, cb2[0].xyzx
  dp3 r4.y, r3.xyzx, cb2[1].xyzx
  movc r1.zw, r1.zzzz, r2.xxxy, r4.xxxy
  
  //mad r1.z, r40.x, l(1.0), r1.z
  
  sample_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r2.xy, r1.zwzz, t11.xyzw, s5
  sample_aoffimmi_indexable(-1,-1,0)(texture2d)(float,float,float,float) r2.zw, r1.zwzz, t11.zwxy, s5
  sample_aoffimmi_indexable(-1,0,0)(texture2d)(float,float,float,float) r3.xy, r1.zwzz, t11.xyzw, s5
  add r2.zw, r2.wwwz, r3.yyyx
  sample_aoffimmi_indexable(-1,1,0)(texture2d)(float,float,float,float) r3.xy, r1.zwzz, t11.xyzw, s5
  add r2.zw, r2.zzzw, r3.yyyx
  sample_aoffimmi_indexable(0,-1,0)(texture2d)(float,float,float,float) r3.xy, r1.zwzz, t11.xyzw, s5
  add r2.zw, r2.zzzw, r3.yyyx
  add r2.xz, r2.yyxy, r2.zzwz
  sample_aoffimmi_indexable(0,1,0)(texture2d)(float,float,float,float) r3.xy, r1.zwzz, t11.xyzw, s5
  add r2.xz, r2.xxzx, r3.yyxy
  sample_aoffimmi_indexable(1,-1,0)(texture2d)(float,float,float,float) r3.xy, r1.zwzz, t11.xyzw, s5
  add r2.xz, r2.xxzx, r3.yyxy
  sample_aoffimmi_indexable(1,0,0)(texture2d)(float,float,float,float) r3.xy, r1.zwzz, t11.xyzw, s5
  add r2.xz, r2.xxzx, r3.yyxy
  sample_aoffimmi_indexable(1,1,0)(texture2d)(float,float,float,float) r3.xy, r1.zwzz, t11.xyzw, s5
  add r2.xz, r2.xxzx, r3.yyxy
  mul r3.xy, r2.xzxx, l(0.111111112, 0.111111112, 0.000000, 0.000000)
  mad r2.x, -r2.x, l(0.111111112), r2.y
  mad r2.x, r2.x, l(0.500000), r3.x
  add r2.yw, -r1.zzzw, l(0.000000, 1.000000, 0.000000, 1.000000)
  min r1.zw, r1.zzzw, r2.yyyw
  min r1.z, r1.w, r1.z
  div_sat r1.z, r1.z, cb2[2].y
  add r1.w, -r1.z, l(1.000000)
  mad r2.y, -r2.z, l(0.111111112), r1.x
  mad r1.w, r1.w, r2.y, r3.y
  mul r1.z, r1.z, r2.x
  lt r2.x, r1.w, r1.x
  movc r1.w, r2.x, r1.w, r1.x
  max r1.w, r1.y, r1.w
  mov_sat r2.x, r1.z
  add r2.y, r0.y, -r1.x
  mul r2.x, r2.y, r2.x
  add r2.y, -r1.y, r1.w
  add r1.x, -r1.y, r1.x
  div_sat r1.x, r2.y, r1.x
  mad r1.x, r1.x, r2.x, r1.w
  ine r1.y, cb2[6].w, l(0x0000ffff)
  if_nz r1.y
    uge r1.y, cb2[6].w, l(103)
    uge r1.w, l(110), cb2[6].w
    and r1.y, r1.w, r1.y
    iadd r1.w, cb2[6].w, l(-103)
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r2.xyzw, r1.w, l(0), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r3.xyzw, r1.w, l(16), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r4.xyzw, r1.w, l(48), t7.xyzw
    dp4 r2.x, r0.xyzw, r2.xyzw
    dp4 r2.y, r0.xyzw, r3.xyzw
    dp4 r1.w, r0.xyzw, r4.xyzw
	
	//mad r2.x, r40.x, l(1280.0), r2.x
	
    div r2.xy, r2.xyxx, r1.wwww
    movc r3.xy, r1.yyyy, r2.xyxx, v2.xyxx
    mov r3.z, l(1.000000)
	
	//add r40.w, r1.y, -r40.y
    //mad r3.x, -r40.x, r40.w, r3.x
	
    dp3 r4.x, r3.xyzx, cb2[5].xyzx
    dp3 r4.y, r3.xyzx, cb2[6].xyzx
    movc r1.yw, r1.yyyy, r2.xxxy, r4.xxxy
	
	//mad r1.y, -r40.x, cb1[0].x, r1.y
	//mad r1.w, -r40.x, cb1[2].x, r1.w
	
    sample_indexable(texture2d)(float,float,float,float) r1.y, r1.ywyy, t13.yxzw, s2
    max r1.z, r1.z, l(0.050000)
    min r1.z, r1.z, l(0.300000)
    add r1.z, r1.z, l(-0.050000)
    mul r1.z, r1.z, l(4.000000)
    mul r1.y, r1.y, cb2[7].x
    mul r1.y, r1.y, r1.z
    mad r1.x, r1.y, l(0.250000), r1.x
  endif
  add r1.x, r0.y, -r1.x
  mul r1.x, r1.x, cb2[2].x
else
  mov r1.x, l(0)
endif
ine r2.x, cb2[9].w, l(0x0000ffff)
if_nz r2.x
  uge r2.x, cb2[9].w, l(103)
  uge r2.y, l(110), cb2[9].w
  and r2.x, r2.y, r2.x
  iadd r2.y, cb2[9].w, l(-103)
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r3.xyzw, r2.y, l(0), t7.xyzw
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r4.xyzw, r2.y, l(16), t7.xyzw
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r5.xyzw, r2.y, l(48), t7.xyzw
  mov r0.w, l(1.000000)
  
  
  
  dp4 r3.x, r0.xyzw, r3.xyzw
  dp4 r3.y, r0.xyzw, r4.xyzw
  dp4 r0.x, r0.xyzw, r5.xyzw
  
  
  
  div r0.xy, r3.xyxx, r0.xxxx
  movc r3.xy, r2.xxxx, r0.xyxx, v2.xyxx
  mov r3.z, l(1.000000)
  dp3 r4.x, r3.xyzx, cb2[8].xyzx
  dp3 r4.y, r3.xyzx, cb2[9].xyzx
  movc r0.xy, r2.xxxx, r0.xyxx, r4.xyxx
  sample_indexable(texture2d)(float,float,float,float) r0.x, r0.xyxx, t14.xyzw, s2
  mul r0.y, r0.x, cb2[10].x
  if_nz cb2[10].y
    ine r0.z, cb2[10].y, l(1)
    if_nz r0.z
      mad_sat r0.z, r0.x, cb2[10].x, -r1.x
      mul r0.w, r0.y, r1.x
      max r2.x, r0.y, r1.x
      ieq r3.xyzw, cb2[10].yyyy, l(2, 3, 4, 5)
      min r2.y, r0.y, r1.x
      movc r0.y, r3.w, r2.y, r0.y
      movc r0.y, r3.z, r2.x, r0.y
      movc r0.y, r3.y, r0.w, r0.y
      movc r1.x, r3.x, r0.z, r0.y
    else
      mad_sat r1.x, -r0.x, cb2[10].x, r1.x
    endif
  else
    mad_sat r1.x, r0.x, cb2[10].x, r1.x
  endif
endif
add r0.x, v6.x, l(-0.010000)
mul_sat r0.x, r0.x, l(1.02040815)
mad r0.y, r0.x, l(-2.000000), l(3.000000)
mul r0.x, r0.x, r0.x
mul r1.y, r0.x, r0.y
mov r1.zw, l(0,0,0,1.000000)
mov o0.xyzw, r1.xyzw
ret
// Approximately 176 instruction slots used

///////////////////////////////// HLSL Code /////////////////////////////////
// // ---- Created with 3Dmigoto v1.3.16 on Sun Jan 16 00:46:33 2022
//
// struct CustomRTTransform
// {
//     float4x4 ws2ts;                // Offset:    0
// };
//
// cbuffer ConstBuf__viewData : register(b1)
// {
//
//   struct
//   {
//     float4x4 view;
//     float4x4 invView;
//     float4x4 proj;
//     float4x4 invViewProjNoZReproj;
//     float4x4 viewProj;
//     float4x4 invViewProj;
//     float4x4 previousViewProj;
//     float4 prevLodEyePos;
//     float4 lodEyePos;
//     float4 viewDirDepthBias;
//     float3 eyePos;
//     float2 viewportSize;
//     float2 invViewportSize;
//     float4 mirrorPlaneWS;
//     float2 mirrorViewportSize;
//     float2 opaqueRefractionViewportSize;
//     float windTime;
//     float deltaTime;
//     float depthReprojectScale;
//     float depthReprojectBias;
//     uint shadowViewType;
//     float normalDepthBias;
//     float noNormalAA;
//     float noNormalFromAlpha;
//     float noOpaqueTransparency;
//     float translucentAmount;
//     uint framePhase;
//     float cameraAmbientExposure;
//     float fxExposure;
//     float fxAmbientExposure;
//     uint checkerboardPhase;
//     float sparkleIntensityScale;
//   } resourceTables__viewData : packoffset(c0);
//
// }
//
// cbuffer ConstBuf__materialData : register(b2)
// {
//
//   struct
//   {
//
//     struct
//     {
//       float3 matU;
//       uint swizzle;
//       float3 matV;
//       uint mode;
//     } texPerm;
//
//     float cst_permScale0;
//     float cst_permClearBorder;
//
//     struct
//     {
//       float3 matU;
//       uint swizzle;
//       float3 matV;
//       uint mode;
//     } texHeightInitial;
//
//
//     struct
//     {
//       float3 matU;
//       uint swizzle;
//       float3 matV;
//       uint mode;
//     } texHeightRaised;
//
//     float cst_heightScale1;
//
//     struct
//     {
//       float3 matU;
//       uint swizzle;
//       float3 matV;
//       uint mode;
//     } texHeightDetail;
//
//     float cst_heightScale2;
//     int cst_LayerBlendFunc2;
//   } resourceTables__materialData : packoffset(c0);
//
//
// SamplerState resourceTables__viewData__smpLowAniso_s : register(s2);
// SamplerState resourceTables__viewData__smpLinearClamp_s : register(s5);
// StructuredBuffer<CustomRTTransform> resourceTables__modelData.customRTs : register(t7);
// Texture2D<float4> resourceTables__materialData.texPerm.tex : register(t11);
// Texture2D<float4> resourceTables__materialData.texHeightInitial.tex : register(t12);
// Texture2D<float4> resourceTables__materialData.texHeightRaised.tex : register(t13);
// Texture2D<float4> resourceTables__materialData.texHeightDetail.tex : register(t14);
//
//
// // 3Dmigoto declarations
// #define cmp -
// Texture1D<float4> IniParams : register(t120);
// Texture2D<float4> StereoParams : register(t125);
//
//
// void main(
//   float4 v0 : SV_POSITION0,
//   uint v1 : VERT_ID0,
//   float2 v2 : TEXCOORD0,
//   float3 v3 : NORMAL0,
//   float3 v4 : TANGENT0,
//   float3 v5 : BINORMAL0,
//   float4 v6 : COLOR0,
//   float3 v7 : TEXCOORD8,
//   out float4 o0 : SV_Target0)
// {
//   Textures: =  * t11-t14;
//   float4 r0,r1,r2,r3,r4,r5;
//   uint4 bitmask, uiDest;
//   float4 fDest;
//
//   r0.xy = v0.xy * resourceTables__viewData.invViewportSize.xy + ;
//   r0.xy = r0.xy;
//   r0.z = v0.z;
//   r0.w = dot(1.000000, );
//   r1.x = dot(r0.xyzw, resourceTables__viewData.invViewProj._m00_m10_m20_m30);
//   r1.y = dot(r0.xyzw, resourceTables__viewData.invViewProj._m01_m11_m21_m31);
//   r1.z = dot(r0.xyzw, resourceTables__viewData.invViewProj._m02_m12_m22_m32);
//   r0.x = r0.x / resourceTables__viewData.invViewProj._m03;
// }
//////////////////////////////// HLSL Errors ////////////////////////////////
// error X3506: unrecognized compiler target '                                        // Textures:  t11-t14'
/////////////////////////////////////////////////////////////////////////////
