// ---- Created with 3Dmigoto v1.3.16 on Sat Dec 26 15:17:47 2020

cbuffer CBufferGlobalConstant_Z : register(b0)
{

  struct
  {
    float4 c[90];
  } Global : packoffset(c0);

}

cbuffer CBufferRenderStateConstant_Z : register(b1)
{

  struct
  {
    float AlphaRef;
    float NoOmni;
  } RenderState : packoffset(c0);

}

cbuffer CBufferObjectConstant_Z : register(b2)
{

  struct
  {
    float4 c[32];
  } Object : packoffset(c0);

}

SamplerState sMaterialSampler_s : register(s0);
Texture2D<float4> sDiffuse : register(t0);
Texture2DArray<float4> sBlueNoiseR8 : register(t10);


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


void main(
  float4 v0 : SV_Position0,
  float4 v1 : COLOR0,
  float4 v2 : TEXCOORD0,
  float v3 : INSTANCE_COLOR0,
  uint2 v4 : INSTANCE_INDEXES0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3,r4;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyzw = sDiffuse.Sample(sMaterialSampler_s, v2.xy).xyzw;
  r0.xyzw = v1.xyzw * r0.xyzw;
  r1.w = Object.c[21].w * r0.w;
  r0.w = cmp(RenderState.AlphaRef >= r1.w);
  if (r0.w != 0) discard;
  r1.xyz = r0.xyz * Object.c[20].xyz + Object.c[21].xyz;
  if (3 == 0) r0.x = 0; else if (3+2 < 32) {   r0.x = (uint)Global.c[1].x << (32-(3 + 2)); r0.x = (uint)r0.x >> (32-3);  } else r0.x = (uint)Global.c[1].x >> 2;
  r0.x = cmp((uint)r0.x >= 5);
  if (r0.x != 0) {
    r0.x = (int)Global.c[1].x & 1;
    if (r0.x != 0) {
      r0.xyz = log2(r1.xyz);
      r0.xyz = floor(r0.xyz);
      r0.xyz = float3(-6,-6,-5) + r0.xyz;
      r0.xyz = exp2(r0.xyz);
      r2.xy = (uint2)v0.xy;
      r2.xy = (int2)r2.xy & int2(63,63);
      r2.zw = float2(0,0);
      r2.x = sBlueNoiseR8.Load(r2.xyzw).x;
      r2.yz = float2(1,-1);
      r3.xyz = r2.xyy * r0.xyz;
      r0.xyz = float3(1,0,0) * r0.xyz;
      r4.xyz = cmp(float3(0,0,0) < r1.xyz);
      r4.xyz = r4.xyz ? float3(1,1,1) : 0;
      r0.xyz = r2.zxx * r3.xyz + r0.xyz;
      r1.xyz = r4.xyz * r0.xyz + r1.xyz;
    } else {
      r0.xy = (uint2)v0.xy;
      r0.xy = (int2)r0.xy & int2(63,63);
      r0.zw = float2(0,0);
      r0.x = sBlueNoiseR8.Load(r0.xyzw).x;
      r0.yzw = cmp(float3(0,0,0) < r1.xyz);
      r0.yzw = r0.yzw ? float3(1,1,1) : 0;
      r2.xyz = r0.xxx * float3(-0.00392156886,0.00392156886,0.00392156886) + float3(0.00392156886,0,0);
      r1.xyz = r0.yzw * r2.xyz + r1.xyz;
    }
  }
  o0.xyzw = r1.xyzw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//   using 3Dmigoto v1.3.16 on Sat Dec 26 15:17:47 2020
//
//
// Buffer Definitions:
//
// cbuffer CBufferGlobalConstant_Z
// {
//
//   struct StructGlobalConstant_Z
//   {
//
//       float4 c[90];                  // Offset:    0
//
//   } Global;                          // Offset:    0 Size:  1440
//
// }
//
// cbuffer CBufferRenderStateConstant_Z
// {
//
//   struct StructRenderStateConstant_Z
//   {
//
//       float AlphaRef;                // Offset:    0
//       float NoOmni;                  // Offset:    4
//
//   } RenderState;                     // Offset:    0 Size:     8
//
// }
//
// cbuffer CBufferObjectConstant_Z
// {
//
//   struct StructObjectConstant_Z
//   {
//
//       float4 c[32];                  // Offset:    0
//
//   } Object;                          // Offset:    0 Size:   512
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// sMaterialSampler                  sampler      NA          NA    0        1
// sDiffuse                          texture  float4          2d    0        1
// sBlueNoiseR8                      texture  float4     2darray   10        1
// CBufferGlobalConstant_Z           cbuffer      NA          NA    0        1
// CBufferRenderStateConstant_Z      cbuffer      NA          NA    1        1
// CBufferObjectConstant_Z           cbuffer      NA          NA    2        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xy
// COLOR                    0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 0   xyzw        2     NONE   float   xy
// INSTANCE_COLOR           0   x           3     NONE   float
// INSTANCE_INDEXES         0   xy          4     NONE    uint
//
//
// 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_constantbuffer cb1[1], immediateIndexed
dcl_constantbuffer cb2[22], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2darray (float,float,float,float) t10
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_input_ps linear v1.xyzw
dcl_input_ps linear v2.xy
dcl_output o0.xyzw
dcl_temps 5
sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v2.xyxx, t0.xyzw, s0
mul r0.xyzw, r0.xyzw, v1.xyzw
mul r1.w, r0.w, cb2[21].w
ge r0.w, cb1[0].x, r1.w
discard_nz r0.w
mad r1.xyz, r0.xyzx, cb2[20].xyzx, cb2[21].xyzx
ubfe r0.x, l(3), l(2), cb0[1].x
uge r0.x, r0.x, l(5)
if_nz r0.x
  and r0.x, cb0[1].x, l(1)
  if_nz r0.x
    log r0.xyz, r1.xyzx
    round_ni r0.xyz, r0.xyzx
    add r0.xyz, r0.xyzx, l(-6.000000, -6.000000, -5.000000, 0.000000)
    exp r0.xyz, r0.xyzx
    ftou r2.xy, v0.xyxx
    and r2.xy, r2.xyxx, l(63, 63, 0, 0)
    mov r2.zw, l(0,0,0,0)
    ld_indexable(texture2darray)(float,float,float,float) r2.x, r2.xyzw, t10.xyzw
    mov r2.yz, l(0,1.000000,-1.000000,0)
    mul r3.xyz, r0.xyzx, r2.xyyx
    mul r0.xyz, r0.xyzx, l(1.000000, 0.000000, 0.000000, 0.000000)
    lt r4.xyz, l(0.000000, 0.000000, 0.000000, 0.000000), r1.xyzx
    and r4.xyz, r4.xyzx, l(0x3f800000, 0x3f800000, 0x3f800000, 0)
    mad r0.xyz, r2.zxxz, r3.xyzx, r0.xyzx
    mad r1.xyz, r4.xyzx, r0.xyzx, r1.xyzx
  else
    ftou r0.xy, v0.xyxx
    and r0.xy, r0.xyxx, l(63, 63, 0, 0)
    mov r0.zw, l(0,0,0,0)
    ld_indexable(texture2darray)(float,float,float,float) r0.x, r0.xyzw, t10.xyzw
    lt r0.yzw, l(0.000000, 0.000000, 0.000000, 0.000000), r1.xxyz
    and r0.yzw, r0.yyzw, l(0, 0x3f800000, 0x3f800000, 0x3f800000)
    mad r2.xyz, r0.xxxx, l(-0.00392156886, 0.00392156886, 0.00392156886, 0.000000), l(0.00392156886, 0.000000, 0.000000, 0.000000)
    mad r1.xyz, r0.yzwy, r2.xyzx, r1.xyzx
  endif
endif
mov o0.xyzw, r1.xyzw
ret
// Approximately 39 instruction slots used

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