//Blood VS 3. Convergence scaling.
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.16 on Sat Apr 10 16:18:25 2021
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyz
// NORMAL                   0   xyz         1     NONE   float
// TANGENT                  0   xyz         2     NONE   float
// TEXCOORD                 0   xyzw        3     NONE   float   xyzw
// TEXCOORD                 1   xyzw        4     NONE   float
// SV_InstanceID            0   x           5   INSTID    uint   x
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 1   xyzw        1     NONE   float   xyzw
// TEXCOORD                 2   xyzw        2     NONE   float   xyzw
// SV_POSITION              0   xyzw        3      POS   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb12[12], immediateIndexed
dcl_constantbuffer cb13[12], immediateIndexed
dcl_constantbuffer cb0[2], immediateIndexed
dcl_resource_raw t16
dcl_resource_raw t17
dcl_input v0.xyz
dcl_input v3.xyzw
dcl_input_sgv v5.x, instance_id
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output_siv o3.xyzw, position
dcl_temps 35
dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r25.xyzw, l(0, 0, 0, 0), t125.xyzw
and r0.x, l(0x00040000), cb0[1].w
ishl r0.y, v5.x, l(2)
ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r0.y, r0.y, t17.xxxx
movc r0.x, r0.x, r0.y, v5.x
imul null, r0.y, r0.x, l(240)
ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r1.xyzw, r0.y, t16.xyzw
ne r0.y, r1.w, l(0.000000)
if_nz r0.y
  imad r2.xyzw, r0.xxxx, l(240, 240, 240, 240), l(16, 48, 64, 192)
  ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r0.yzw, r2.x, t16.xxyz
  ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r3.xyz, r2.y, t16.xyzx
  ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r4.xyzw, r2.z, t16.xyzw
  ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r2.xzw, r2.w, t16.xxyz
  imad r5.xyz, r0.xxxx, l(240, 240, 240, 0), l(208, 224, 80, 0)
  ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r6.xyz, r5.x, t16.xyzx
  ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r5.xyw, r5.y, t16.xyxz
  mul r3.xyz, r3.xyzx, v0.xyzx
  mul r7.xyz, r3.zxyz, r4.xyzx
  mad r7.xyz, r4.zxyz, r3.xyzx, -r7.xyzx
  add r7.xyz, r7.xyzx, r7.xyzx
  mad r3.xyz, r7.zxyz, r4.wwww, r3.xyzx
  mul r8.xyz, r4.zxyz, r7.xyzx
  mad r4.xyz, r4.yzxy, r7.yzxy, -r8.xyzx
  add r3.xyz, r3.xyzx, r4.xyzx
  mul r3.xyz, r3.xyzx, cb0[1].xyzx
  and r4.xy, l(128, 256, 0, 0), cb0[1].wwww
  mul r7.xyz, r2.xzwx, r3.xxxx
  mad r7.xyz, r3.yyyy, r6.xyzx, r7.xyzx
  mad r7.xyz, r3.zzzz, r5.xywx, r7.xyzx
  dp3 r8.x, r2.xzwx, r3.xyzx
  dp3 r8.y, r6.xyzx, r3.xyzx
  dp3 r8.z, r5.xywx, r3.xyzx
  movc r2.xzw, r4.xxxx, r7.xxyz, r8.xxyz
  add r0.xyz, r0.yzwy, r2.xzwx
  mov r0.w, l(1.000000)
  
  //dp4 r10.x, cb12[11].xyzw, r0.xyzw
  //add r25.w, -r10.x, r25.y
  //div r25.w, r25.w, cb12[0].x
  //mad r0.x, -r25.x, r25.w, r0.x
  
  dp4 r20.x, cb12[8].xyzw, r0.xyzw
  dp4 r20.y, cb12[9].xyzw, r0.xyzw
  dp4 r2.x, cb12[10].xyzw, r0.xyzw
  dp4 r0.x, cb12[11].xyzw, r0.xyzw
  
  //add r25.w, r0.x, -r25.y
  ////div r25.w, r25.w, cb12[0].x
  //mad r20.x, r25.x, r25.w, r20.x
  
  ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r3.xyzw, r5.z, t16.xyzw
  add o1.xyzw, r3.xyzw, v3.xyzw
  div r3.x, r2.x, r0.x
  iadd r0.y, r2.y, l(12)
  ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r0.y, r0.y, t16.xxxx
  movc r3.y, r4.y, r0.y, l(0)
  mad r20.z, r0.x, cb0[0].z, r2.x
  mov r20.w, r0.x
  
  add r25.w, l(0.0), -r25.y
  mul r25.w, r25.w, cb12[0].x
  div r25.w, r25.w, cb13[0].x
  mad r20.x, r25.x, r25.w, r20.x
  
  mov o3.xyzw, r20.xyzw
else
  mov o1.xyzw, l(0,0,0,0)
  mov o3.xyzw, l(0,0,0,0)
  mov r3.xy, l(0,0,0,0)
endif
mov o0.xyzw, r1.xyzw
mov o2.xz, r3.xxyx
mov o2.yw, l(0,0,0,0)
ret
// Approximately 0 instruction slots used

///////////////////////////////// HLSL Code /////////////////////////////////
// // ---- Created with 3Dmigoto v1.3.16 on Sat Apr 10 16:18:25 2021
// cbuffer cb0 : register(b0)
// {
//   float4 cb0[2];
// }
//
// cbuffer cb12 : register(b12)
// {
//   float4 cb12[12];
// }
//
//
//
//
// // 3Dmigoto declarations
// #define cmp -
// Texture1D<float4> IniParams : register(t120);
// Texture2D<float4> StereoParams : register(t125);
//
//
// void main(
//   float4 v0 : POSITION0,
//   float3 v1 : NORMAL0,
//   float3 v2 : TANGENT0,
//   float4 v3 : TEXCOORD0,
//   float4 v4 : TEXCOORD1,
//   uint v5 : SV_InstanceID0,
//   out float4 o0 : TEXCOORD0,
//   out float4 o1 : TEXCOORD1,
//   out float4 o2 : TEXCOORD2,
//   out float4 o3 : SV_POSITION0)
// {
// // Needs manual fix for instruction:
// // unknown dcl_: dcl_resource_raw t16
// // Needs manual fix for instruction:
// // unknown dcl_: dcl_resource_raw t17
// // Needs manual fix for instruction:
// // unknown dcl_: dcl_input_sgv v5.x, instance_id
//   float4 r0,r1,r2,r3,r4,r5,r6,r7,r8;
//   uint4 bitmask, uiDest;
//   float4 fDest;
//
//   r0.x = 0x00040000 & asint(cb0[1].w);
//   r0.y = (uint)v5.x << 2;
// // No code for instruction (needs manual fix):
// ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r0.y, r0.y, t17.xxxx
//   r0.x = r0.x ? r0.y : v5.x;
//   r0.y = (int)r0.x * 240;
// // No code for instruction (needs manual fix):
// ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r1.xyzw, r0.y, t16.xyzw
//   r0.y = cmp(r1.w != 0.000000);
//   if (r0.y != 0) {
//     r2.xyzw = mad((int4)r0.xxxx, int4(240,240,240,240), int4(16,48,64,192));
//   // No code for instruction (needs manual fix):
//     ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r0.yzw, r2.x, t16.xxyz
//   // No code for instruction (needs manual fix):
//     ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r3.xyz, r2.y, t16.xyzx
//   // No code for instruction (needs manual fix):
//     ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r4.xyzw, r2.z, t16.xyzw
//   // No code for instruction (needs manual fix):
//     ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r2.xzw, r2.w, t16.xxyz
//     r5.xyz = mad((int3)r0.xxx, int3(240,240,240), int3(208,224,80));
//   // No code for instruction (needs manual fix):
//     ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r6.xyz, r5.x, t16.xyzx
//   // No code for instruction (needs manual fix):
//     ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r5.xyw, r5.y, t16.xyxz
//     r3.xyz = v0.xyz * r3.xyz;
//     r7.xyz = r4.xyz * r3.zxy;
//     r7.xyz = r4.zxy * r3.xyz + -r7.xyz;
//     r7.xyz = r7.xyz + r7.xyz;
//     r3.xyz = r7.zxy * r4.www + r3.xyz;
//     r8.xyz = r7.xyz * r4.zxy;
//     r4.xyz = r4.yzx * r7.yzx + -r8.xyz;
//     r3.xyz = r4.xyz + r3.xyz;
//     r3.xyz = cb0[1].xyz * r3.xyz;
//     r4.xy = int2(128,256) & asint(cb0[1].ww);
//     r7.xyz = r3.xxx * r2.xzw;
//     r7.xyz = r3.yyy * r6.xyz + r7.xyz;
//     r7.xyz = r3.zzz * r5.xyw + r7.xyz;
//     r8.x = dot(r2.xzw, r3.xyz);
//     r8.y = dot(r6.xyz, r3.xyz);
//     r8.z = dot(r5.xyw, r3.xyz);
//     r2.xzw = r4.xxx ? r7.xyz : r8.xyz;
//     r0.xyz = r2.xzw + r0.yzw;
//     r0.w = 1;
//     o3.x = dot(cb12[8].xyzw, r0.xyzw);
//     o3.y = dot(cb12[9].xyzw, r0.xyzw);
//     r2.x = dot(cb12[10].xyzw, r0.xyzw);
//     r0.x = dot(cb12[11].xyzw, r0.xyzw);
//   // No code for instruction (needs manual fix):
//     ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r3.xyzw, r5.z, t16.xyzw
//     o1.xyzw = v3.xyzw + r3.xyzw;
//     r3.x = r2.x / r0.x;
//     r0.y = (int)r2.y + 12;
//   // No code for instruction (needs manual fix):
//     ld_raw_indexable(raw_buffer)(mixed,mixed,mixed,mixed) r0.y, r0.y, t16.xxxx
//     r3.y = r4.y ? r0.y : 0;
//     o3.z = r0.x * cb0[0].z + r2.x;
//     o3.w = r0.x;
//   } else {
//     o1.xyzw = float4(0,0,0,0);
//     o3.xyzw = float4(0,0,0,0);
//     r3.xy = float2(0,0);
//   }
//   o0.xyzw = r1.xyzw;
//   o2.xz = r3.xy;
//   o2.yw = float2(0,0);
//   return;
// }
//////////////////////////////// HLSL Errors ////////////////////////////////
// E:\SteamLibrary\steamapps\common\Yakuza Kiwami 2\ShaderFixes\032d0a1eff25f0d9-vs_replace.txt(46,18-27): error X3004: undeclared identifier 'raw_buffer'
// E:\SteamLibrary\steamapps\common\Yakuza Kiwami 2\ShaderFixes\032d0a1eff25f0d9-vs_replace.txt(46,1-28): error X3004: undeclared identifier 'ld_raw_indexable'
/////////////////////////////////////////////////////////////////////////////
