mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-01-05 08:10:10 +01:00
Remove an ugly hack pertaining to partial framebuffer-resident texture data - Its better to fill in the missing information with a wrap or clamp than to fake the texture reads in valid regions - Texture coordinate scaling is used to fill in for the cropped dimension available
This commit is contained in:
parent
cb9e6e75db
commit
4487cc8e7a
|
|
@ -444,15 +444,15 @@ namespace glsl
|
|||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE2D:
|
||||
return "texture($t, $0.xy * texture_parameters[$_i].xy)";
|
||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE2D_PROJ:
|
||||
return "textureProj($t, $0 , $1.x)"; // Note: $1.x is bias
|
||||
return "textureProj($t, $0 * vec4(texture_parameters[$_i].xy, 1., 1.), $1.x)"; // Note: $1.x is bias
|
||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE2D_LOD:
|
||||
return "textureLod($t, $0.xy * texture_parameters[$_i].xy, $1.x)";
|
||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLE2D_GRAD:
|
||||
return "textureGrad($t, $0.xy * texture_parameters[$_i].xy , $1.xy, $2.xy)";
|
||||
case FUNCTION::FUNCTION_TEXTURE_SHADOW2D:
|
||||
return "texture($t, $0.xyz)";
|
||||
return "texture($t, $0.xyz * vec3(texture_parameters[$_i].xy, 1.))";
|
||||
case FUNCTION::FUNCTION_TEXTURE_SHADOW2D_PROJ:
|
||||
return "textureProj($t, $0, $1.x)"; // Note: $1.x is bias
|
||||
return "textureProj($t, $0 * vec4(texture_parameters[$_i].xy, 1., 1.), $1.x)"; // Note: $1.x is bias
|
||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLECUBE:
|
||||
return "texture($t, $0.xyz)";
|
||||
case FUNCTION::FUNCTION_TEXTURE_SAMPLECUBE_PROJ:
|
||||
|
|
|
|||
|
|
@ -1311,28 +1311,6 @@ namespace rsx
|
|||
u32 internal_height = tex_height;
|
||||
get_native_dimensions(internal_width, internal_height, texptr);
|
||||
|
||||
if (internal_width > surface_width || internal_height > surface_height)
|
||||
{
|
||||
//An AA flag is likely missing
|
||||
//HACK
|
||||
auto aa_mode = texptr->aa_mode;
|
||||
if ((internal_width >> 1) == surface_width)
|
||||
{
|
||||
if (internal_height > surface_height)
|
||||
texptr->aa_mode = rsx::surface_antialiasing::square_centered_4_samples;
|
||||
else
|
||||
texptr->aa_mode = rsx::surface_antialiasing::diagonal_centered_2_samples;
|
||||
|
||||
internal_width = tex_width;
|
||||
internal_height = tex_height;
|
||||
get_native_dimensions(internal_width, internal_height, texptr);
|
||||
}
|
||||
|
||||
internal_width = std::min(internal_width, (u32)surface_width);
|
||||
internal_height = std::min(internal_height, (u32)surface_height);
|
||||
texptr->aa_mode = aa_mode;
|
||||
}
|
||||
|
||||
const bool unnormalized = (gcm_format & CELL_GCM_TEXTURE_UN) != 0;
|
||||
f32 scale_x = (unnormalized)? (1.f / tex_width) : 1.f;
|
||||
f32 scale_y = (unnormalized)? (1.f / tex_height) : 1.f;
|
||||
|
|
@ -1343,9 +1321,18 @@ namespace rsx
|
|||
scale_y = 0.f;
|
||||
}
|
||||
|
||||
bool requires_processing = surface_width != internal_width || surface_height != internal_height;
|
||||
bool requires_processing = surface_width > internal_width || surface_height > internal_height;
|
||||
if (!requires_processing)
|
||||
{
|
||||
//NOTE: The scale also accounts for sampling outside the RTT region, e.g render to one quadrant but send whole texture for sampling
|
||||
//In these cases, internal dimensions will exceed available surface dimensions. Account for the missing information using scaling (missing data will result in border color)
|
||||
//TODO: Proper gather and stitching without performance loss
|
||||
if (internal_width > surface_width)
|
||||
scale_x *= ((f32)internal_width / surface_width);
|
||||
|
||||
if (internal_height > surface_height)
|
||||
scale_y *= ((f32)internal_height / surface_height);
|
||||
|
||||
if (!is_depth)
|
||||
{
|
||||
for (const auto& tex : m_rtts.m_bound_render_targets)
|
||||
|
|
|
|||
Loading…
Reference in a new issue