// ---- Created with 3Dmigoto v1.2.35 on Tue Apr 26 22:31:04 2016

cbuffer Constants : register(b0)
{
  float mipLevels : packoffset(c0);
  float2 textureDims : packoffset(c1);
}

SamplerState sampler_tex_s : register(s0);
Texture2D<float4> tex : register(t0);


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


void main( 
  float2 v0 : TEXCOORD0,
  float4 v1 : COLOR0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyzw = textureDims.xxyy * v0.xyxy;
  r0.xy = ddx_coarse(r0.xy);
  r0.zw = ddy_coarse(r0.zw);
  r1.x = dot(r0.xy, r0.xy);
  r1.y = dot(r0.zw, r0.zw);
  r1.x = max(r1.x, r1.y);
  r1.x = log2(r1.x);
  r1.x = r1.x * 0.5 + -1;
  r1.x = max(0, r1.x);
  r1.y = mipLevels + -1;
  r1.x = min(r1.x, r1.y);
  r1.x = exp2(r1.x);
  r0.xyzw = r0.xyzw / r1.xxxx;
  r0.z = dot(r0.zw, r0.zw);
  r0.x = dot(r0.xy, r0.xy);
  r0.x = max(r0.x, r0.z);
  r0.x = sqrt(r0.x);
  r0.x = -r0.x * 0.5 + 1;
  r0.x = max(0, r0.x);
  r0.y = 1.88235307 * r0.x;
  r0.xz = r0.yy * float2(-1,1) + float2(2,-2);
  r0.xyz = saturate(r0.xyz);
  r1.x = tex.Sample(sampler_tex_s, v0.xy).x;
  r1.w = v1.w * r1.x;
  r1.xyz = v1.xyz;
  r0.w = 1;
  o0.xyzw = r1.xyzw * float4(0.00100000005,0.00100000005,0.00100000005,0.00100000005) + r0.xyzw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//
// Buffer Definitions: 
//
// cbuffer Constants
// {
//
//   float mipLevels;                   // Offset:    0 Size:     4
//   float2 textureDims;                // Offset:   16 Size:     8
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// sampler_tex                       sampler      NA          NA    0        1
// tex                               texture  float4          2d    0        1
// Constants                         cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xy          0     NONE   float   xy  
// COLOR                    0   xyzw        1     NONE   float   xyzw
//
//
// 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 cb0[2], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v0.xy
dcl_input_ps linear v1.xyzw
dcl_output o0.xyzw
dcl_temps 2
mul r0.xyzw, v0.xyxy, cb0[1].xxyy
deriv_rtx_coarse r0.xy, r0.xyxx
deriv_rty_coarse r0.zw, r0.zzzw
dp2 r1.x, r0.xyxx, r0.xyxx
dp2 r1.y, r0.zwzz, r0.zwzz
max r1.x, r1.y, r1.x
log r1.x, r1.x
mad r1.x, r1.x, l(0.500000), l(-1.000000)
max r1.x, r1.x, l(0.000000)
add r1.y, l(-1.000000), cb0[0].x
min r1.x, r1.y, r1.x
exp r1.x, r1.x
div r0.xyzw, r0.xyzw, r1.xxxx
dp2 r0.z, r0.zwzz, r0.zwzz
dp2 r0.x, r0.xyxx, r0.xyxx
max r0.x, r0.z, r0.x
sqrt r0.x, r0.x
mad r0.x, -r0.x, l(0.500000), l(1.000000)
max r0.x, r0.x, l(0.000000)
mul r0.y, r0.x, l(1.882353)
mad r0.xz, r0.yyyy, l(-1.000000, 0.000000, 1.000000, 0.000000), l(2.000000, 0.000000, -2.000000, 0.000000)
mov_sat r0.xyz, r0.xyzx
sample_indexable(texture2d)(float,float,float,float) r1.x, v0.xyxx, t0.xyzw, s0
mul r1.w, r1.x, v1.w
mov r1.xyz, v1.xyzx
mov r0.w, l(1.000000)
mad o0.xyzw, r1.xyzw, l(0.001000, 0.001000, 0.001000, 0.001000), r0.xyzw
ret 
// Approximately 28 instruction slots used

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