// asmtool.py -I ../.. --fix-unity-reflection --only-autofixed 1246f3056bad4a47-ps.txt
// 3DMigoto: 1246f3056bad4a47 |    Unity headers extracted from 0677543E3A13AF4FE7765418B5AB76E8_FB.shader
//    Shader "Hidden/UberShader/0677543E3A13AF4FE7765418B5AB76E8_FB" {
//      Properties {
//       _PivotSettings ("Pivot settings", Vector) = (0,0,0,0)
//       _UberShaderColorMask ("Uber color mask", Float) = 15
//       _UberShaderBlendModeDst ("Uber shader blend  mode dst", Float) = 10
//       _Color ("Color", Color) = (1,1,1,1)
//       _DepthFlipScreen ("Depth Flip Screen", Vector) = (0,0,0,0)
//       _DistortionMaskTex ("Distortion Mask Tex", 2D) = "white" { }
//       _DistortionMaskTex_US_ST ("Distortion Mask Tex_US_ST", Vector) = (0,0,0,0)
//       _DistortionSettings ("Distortion Settings", Vector) = (0,0,0,0)
//       _DistortionTex ("Distortion Tex", 2D) = "white" { }
//       _DistortionTex_Parralax ("Distortion Tex_Parralax", Vector) = (0,0,0,0)
//       _DistortionTex_US_ST ("Distortion Tex_US_ST", Vector) = (0,0,0,0)
//       _MainTex ("Main Tex", 2D) = "white" { }
//       _MainTex_US_ATLAS ("Main Tex_US_ATLAS", Vector) = (0,0,1,1)
//       _MainTex_US_ATLAS_ST ("Main Tex_US_ATLAS_ST", Vector) = (0,0,1,1)
//       _MainTex_US_ST ("Main Tex_US_ST", Vector) = (0,0,0,0)
//       _Screen ("Screen", Vector) = (0,0,0,0)
//       _ScreenMask ("Screen Mask", Vector) = (0,0,0,0)
//       _TurbulenceLocalRotationSettings ("Turbulence Local Rotation Settings", Vector) = (0,0,0,0)
//       _TurbulenceRotationAnimMask ("Turbulence Rotation Anim Mask", 2D) = "white" { }
//       _TurbulenceRotationAnimMask_US_ST ("Turbulence Rotation Anim Mask_US_ST", Vector) = (0,0,0,0)
//       _TurbulenceRotationOffset ("Turbulence Rotation Offset", Vector) = (0,0,0,0)
//       _TurbulenceRotationPivotMask ("Turbulence Rotation Pivot Mask", Vector) = (0,0,0,0)
//      }
//      SubShader 1/1 {
//        Tags { "IGNOREPROJECTOR"="true" "RenderType"="TransparentCutout" "UberShaderShader"="true" }
//        Pass 1/1 {
//          Tags { "IGNOREPROJECTOR"="true" "RenderType"="TransparentCutout" "UberShaderShader"="true" }
//          ZTest Less
//          ZWrite Off
//          Cull Off
//          Blend SrcAlpha [_UberShaderBlendModeDst], One OneMinusSrcAlpha
//          ColorMask [_UberShaderColorMask]
//          GpuProgramID 62457
//          Program "fp" {
//            SubProgram "d3d11 " {
//              GpuProgramIndex 3
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from 0677543E3A13AF4FE7765418B5AB76E8_FB.shader.decompressed:
//   API d3d11
//   Shader model ps_4_0
//   undeciphered1: 201509030 20 3 0
//   undeciphered2: 1 3 2 3 0
//   undeciphered3: 0 0
//   ConstBuffer "$Globals" 608
//   Vector 128 [_DepthFlipScreen]
//   Vector 144 [_Screen]
//   Vector 160 [_ScreenMask]
//   Vector 336 [_MainTex_US_ATLAS]
//   Vector 352 [_MainTex_US_ATLAS_ST]
//   Vector 368 [_Color]
//   Vector 496 [_DistortionSettings]
//   Vector 544 [_DistortionTex_Parralax]
//   ConstBuffer "UnityPerCamera" 144
//   Vector 64 [_WorldSpaceCameraPos] 3
//   SetTexture 0 [_DistortionTex] 2D 1
//   SetTexture 1 [_DistortionMaskTex] 2D 2
//   SetTexture 2 [_MainTex] 2D 0
//   BindCB "$Globals" 0
//   BindCB "UnityPerCamera" 1
//
// Headers extracted with DarkStarSword's extract_unity53_shaders.py
// https://github.com/DarkStarSword/3d-fixes

//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.2 on Mon Jul 23 23:42:14 2018
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float
// TEXCOORD                 0   xyzw        1     NONE   float   xy
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
// TEXCOORD                 3   xyzw        4     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer cb0[35], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyzw
dcl_input_ps linear v3.xyzw
dcl_input_ps linear v4.xyzw
dcl_output o0.xyzw
dcl_temps 5
dcl_constantbuffer cb10[4], immediateIndexed

// 3DMigoto StereoParams:
dcl_resource_texture2d (float,float,float,float) t125

ld_indexable(texture2d)(float,float,float,float) r3.xyzw, l(0, 0, 0, 0), t125.xyzw


// Unity reflection/specular fix inserted with DarkStarSword's asmtool.py:
// asmtool.py -I ../.. --fix-unity-reflection --only-autofixed 1246f3056bad4a47-ps.txt

mul r3.w, -r3.x, r3.y
mad r4.xyz, -r3.wwww, cb10[0].xyzw, cb1[4].xyzw

add r0.xy, -cb0[34].zwzz, r4.xyxx
mad r0.xy, r0.xyxx, cb0[34].xxxx, v2.xyxx
sample r0.xyzw, r0.xyxx, t0.xyzw, s1
mad r0.xy, r0.wzww, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
mul r0.xy, r0.xyxx, cb0[31].yxyy
sample r1.xyzw, v2.zwzz, t1.xyzw, s2
mad_sat r0.xy, r0.xyxx, r1.wwww, v1.yxyy
add r0.xy, r0.xyxx, -cb0[22].yxyy
div_sat r0.xy, r0.xyxx, cb0[22].wzww
mul r0.zw, r0.xxxy, cb0[8].yyyy
add r1.x, -cb0[8].y, l(1.000000)
mad r0.xy, r0.yxyy, r1.xxxx, r0.zwzz
mad r0.xy, r0.xyxx, cb0[21].zwzz, cb0[21].xyxx
sample r0.xyzw, r0.xyxx, t2.xyzw, s0
dp4_sat r1.x, r0.xyzw, cb0[9].xyzw
mad r0.xyzw, r1.xxxx, cb0[10].xyzw, r0.xyzw
div r0.xyz, r0.xyzx, r0.wwww
add r1.xyzw, cb0[23].xyzw, cb0[23].xyzw
mul r2.xyzw, r0.xyzw, r1.xyzw
mad r0.xyz, -r0.xyzx, r1.xyzx, v4.xyzx
mad r0.xyz, v4.wwww, r0.xyzx, r2.xyzx
mov o0.w, r2.w
add r1.xyz, -r0.xyzx, v3.xyzx
mad o0.xyz, v3.wwww, r1.xyzx, r0.xyzx
ret
// Approximately 0 instruction slots used