Project

General

Profile

Emulator Issues #12725 » bad_ps_5_0_D3D_0.txt

tccalvin, 06/05/2022 11:05 PM

 
cbuffer PSBlock : register(b0) {
float4 resolution;
float4 window_resolution;
float4 src_rect;
int src_layer;
uint time;
uint ubo_align_1_;
uint ubo_align_2_;

};

Texture2DArray samp0 : register(t0);
SamplerState samp0_ss : register(s0);

#define main real_main
static float3 v_tex0;
static float4 ocol0;

// Wrappers for sampling functions.
#define texture(sampler, coords) sampler.Sample(sampler##_ss, coords)
#define textureOffset(sampler, coords, offset) sampler.Sample(sampler##_ss, coords, offset)

float4 Sample() { return texture(samp0, v_tex0); }
float4 SampleLocation(float2 location) { return texture(samp0, float3(location, float(v_tex0.z))); }
float4 SampleLayer(int layer) { return texture(samp0, float3(v_tex0.xy, float(layer))); }
#define SampleOffset(offset) textureOffset(samp0, v_tex0, offset)

float2 GetWindowResolution()
{
return window_resolution.xy;
}

float2 GetInvWindowResolution()
{
return window_resolution.zw;
}

float2 GetResolution()
{
return resolution.xy;
}

float2 GetInvResolution()
{
return resolution.zw;
}

float2 GetCoordinates()
{
return v_tex0.xy;
}

float GetLayer()
{
return v_tex0.z;
}

uint GetTime()
{
return time;
}

void SetOutput(float4 color)
{
ocol0 = color;
}

#define GetOption(x) (x)
#define OptionEnabled(x) ((x) != 0)

void main()

{

float4 c0 = Sample();

float2 rat = GetWindowResolution()/GetResolution();

float x = GetWindowResolution().x - GetResolution().x;

float y = GetWindowResolution().y - GetResolution().y;

float x1 = (x / 2.0) * GetInvWindowResolution().x;

float x2 = (GetWindowResolution().x - x / 2.0) * GetInvWindowResolution().x;

float y1 = (y / 2.0) * GetInvWindowResolution().y;

float y2 = (GetWindowResolution().y - y / 2.0) * GetInvWindowResolution().y;



float source_size = GetResolution().x;

float texel = GetCoordinates().x * source_size.x;

float texel_floored = floor(texel);

float s = fract(texel);

//float config_scale = 0.0; // GetOption(PRESCALE_FACTOR);

float scale = ceil(GetWindowResolution().x / source_size.x);

float region_range = 0.5 - 0.5 / scale;



// Figure out where in the texel to sample to get correct pre-scaled bilinear.

// Uses the hardware bilinear interpolator to avoid having to sample 4 times manually.



float center_dist = s - 0.5;

float f = (center_dist - clamp(center_dist, -region_range, region_range)) * scale + 0.5;



float mod_texel = texel_floored + f;

float xloc = mod_texel / source_size;



if (GetCoordinates().y < y1 || y2 < GetCoordinates().y)

{

c0.r = 0.0;

c0.b = 0.0;

c0.g = 0.0;

}

else

{

float2 offset = float2(xloc, (GetCoordinates().y * rat.y - y1 * rat.y));

c0 = SampleLocation(offset);

}

SetOutput(c0);

}



#undef main
void main(in float3 v_tex0_ : TEXCOORD0, out float4 ocol0_ : SV_Target)
{
v_tex0 = v_tex0_;
real_main();
ocol0_ = ocol0;
}
C:\Users\Tommaso\Downloads\Dolphin-x64\Shader@0x00000211774E21E0(85,13-24): error X3004: undeclared identifier 'fract'
Dolphin Version: Dolphin 5.0-16380
Video Backend: Direct3D 11
(3-3/5)