//Backgrounds PS 1.
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//   using 3Dmigoto v0.6.163 on Wed May 13 21:55:52 2026
//
//
// Buffer Definitions:
//
// cbuffer PerDrawCB
// {
//
//   struct
//   {
//
//       uint width;                    // Index:    0
//       uint height;                   // Index:    0.y
//       bool linear_filtering;         // Index:    0.z
//
//   } textures[2];                     // Index:    0-1.z            Components:     7
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_sampler0                        sampler      NA          NA    0        1
// g_texture0                        texture  float4          2d    0        1
// PerDrawCB                         cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float
// TEXCOORD                 0   xy          1     NONE   float   xy
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer CB1[1], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v1.xy
dcl_output o0.xyzw
dcl_temps 27
dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r25.xyzw, l(0, 0, 0, 0), t125.xyzw

mov r21.xy, v1.xyxx
//mad r21.x, r25.x, l(-0.25), r21.x

if_nz cb1[0].z
  utof r0.xy, cb1[0].xyxx
  mad r0.zw, r21.xxxy, r0.xxxy, l(0.000000, 0.000000, -0.500000, -0.500000)
  frc r0.zw, r0.zzzw
  add r1.x, r0.w, r0.z
  ge r1.x, r1.x, l(1.000000)
  movc r1.x, r1.x, l(-1.000000), l(-0.000000)
  add r1.zw, r0.zzzw, r1.xxxx
  div r0.zw, r1.zzzw, r0.xxxy
  add r0.zw, -r0.zzzw, r21.xxxy
  sample r2.xyzw, r0.zwzz, t0.xyzw, s0
  lt r0.zw, l(0.000000, 0.000000, 0.000000, 0.000000), r1.zzzw
  lt r3.xy, r1.zwzz, l(0.000000, 0.000000, 0.000000, 0.000000)
  iadd r0.zw, -r0.zzzw, r3.xxxy
  itof r0.zw, r0.zzzw
  add r1.xy, -r0.zwzz, r1.zwzz
  div r0.xyzw, r1.xwzy, r0.xyxy
  add r0.xyzw, -r0.xyzw, r21.xyxy
  sample r3.xyzw, r0.xyxx, t0.xyzw, s0
  sample r0.xyzw, r0.zwzz, t0.xyzw, s0
  add r3.xyz, -r2.xyzx, r3.xyzx
  mad r1.xyz, |r1.zzzz|, r3.xyzx, r2.xyzx
  add r0.xyz, -r2.xyzx, r0.xyzx
  mad r0.xyz, |r1.wwww|, r0.xyzx, r1.xyzx
else
  sample r0.xyzw, r21.xyxx, t0.xyzw, s0
endif
add r0.xyz, r0.xyzx, l(0.510000, 0.510000, 0.510000, 0.000000)
mul r1.xyz, r0.xyzx, l(0.495049506, 0.495049506, 0.495049506, 0.000000)
round_ni r1.xyz, r1.xyzx
mad r0.xyz, -r1.xyzx, l(2.020000, 2.020000, 2.020000, 0.000000), r0.xyzx
add_sat o0.xyz, r0.xyzx, l(-0.510000, -0.510000, -0.510000, 0.000000)
mov o0.w, l(1.000000)
ret
// Approximately 34 instruction slots used

///////////////////////////////// HLSL Code /////////////////////////////////
// // ---- Created with 3Dmigoto v0.6.163 on Wed May 13 21:55:52 2026
//
// cbuffer PerDrawCB : register(b1)
// {
//
//   struct
//   {
//     uint width;
//     uint height;
//     bool linear_filtering;
//   } textures[2] : packoffset(c0);
//
// }
//
// SamplerState g_sampler0_s : register(s0);
// Texture2D<float4> g_texture0 : register(t0);
//
//
// // 3Dmigoto declarations
// #define cmp -
// Texture1D<float4> IniParams : register(t120);
// Texture2D<float4> StereoParams : register(t125);
//
//
// void main(
//   float4 v0 : SV_POSITION0,
//   float2 v1 : TEXCOORD0,
//   out float4 o0 : SV_TARGET0)
// {
//   float4 r0,r1,r2,r3;
//   uint4 bitmask, uiDest;
//   float4 fDest;
//
//   if (textures[0].linear_filtering != 0) {
//     r0.xy = (uint5)textures[0].width;
//     r0.zw = v1.xy * r0.xy + float2(-0.5,-0.5);
//     r0.zw = frac(r0.zw);
//     r1.x = r0.z + r0.w;
//     r1.x = cmp(r1.x >= 1);
//     r1.x = r1.x ? -1 : -0;
//     r1.zw = r1.xx + r0.zw;
//     r0.zw = r1.zw / r0.xy;
//     r0.zw = v1.xy + -r0.zw;
//     r2.xyzw = g_texture0.Sample(g_sampler0_s, r0.zw).xyzw;
//     r0.zw = cmp(float2(0,0) < r1.zw);
//     r3.xy = cmp(r1.zw < float2(0,0));
//     r0.zw = (int2)-r0.zw + (int2)r3.xy;
//     r0.zw = (int2)r0.zw;
//     r1.xy = r1.zw + -r0.zw;
//     r0.xyzw = r1.xwzy / r0.xyxy;
//     r0.xyzw = v1.xyxy + -r0.xyzw;
//     r3.xyzw = g_texture0.Sample(g_sampler0_s, r0.xy).xyzw;
//     r0.xyzw = g_texture0.Sample(g_sampler0_s, r0.zw).xyzw;
//     r3.xyz = r3.xyz + -r2.xyz;
//     r1.xyz = abs(r1.zzz) * r3.xyz + r2.xyz;
//     r0.xyz = r0.xyz + -r2.xyz;
//     r0.xyz = abs(r1.www) * r0.xyz + r1.xyz;
//   } else {
//     r0.xyzw = g_texture0.Sample(g_sampler0_s, v1.xy).xyzw;
//   }
//   r0.xyz = float3(0.50999999,0.50999999,0.50999999) + r0.xyz;
//   r1.xyz = float3(0.495049506,0.495049506,0.495049506) * r0.xyz;
//   r1.xyz = floor(r1.xyz);
//   r0.xyz = -r1.xyz * float3(2.01999998,2.01999998,2.01999998) + r0.xyz;
//   o0.xyz = saturate(float3(-0.50999999,-0.50999999,-0.50999999) + r0.xyz);
//   o0.w = 1;
//   return;
// }
//////////////////////////////// HLSL Errors ////////////////////////////////
// D:\Juegos\BattleShip-windows\ShaderFixes\2eb1443759d8c6d4-ps_replace.txt(35,14-18): error X3004: undeclared identifier 'uint5'
/////////////////////////////////////////////////////////////////////////////
