rsx: Avoid the complex remapper checks if the texture isn't in the XINT8 group

This commit is contained in:
kd-11 2024-06-09 18:16:45 +03:00 committed by kd-11
parent bee14cad16
commit 2647a09790
4 changed files with 68 additions and 64 deletions

View file

@ -1134,6 +1134,29 @@ namespace rsx
fmt::throw_exception("Unknown format 0x%x", texture_format); fmt::throw_exception("Unknown format 0x%x", texture_format);
} }
bool is_int8_remapped_format(u32 format)
{
switch (format)
{
case CELL_GCM_TEXTURE_DEPTH24_D8:
case CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT:
case CELL_GCM_TEXTURE_DEPTH16:
case CELL_GCM_TEXTURE_DEPTH16_FLOAT:
case CELL_GCM_TEXTURE_X16:
case CELL_GCM_TEXTURE_Y16_X16:
case CELL_GCM_TEXTURE_COMPRESSED_HILO8:
case CELL_GCM_TEXTURE_COMPRESSED_HILO_S8:
case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT:
case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT:
case CELL_GCM_TEXTURE_X32_FLOAT:
case CELL_GCM_TEXTURE_Y16_X16_FLOAT:
// NOTE: Special data formats (XY, HILO, DEPTH) are not RGB formats
return false;
default:
return true;
}
}
/** /**
* A texture is stored as an array of blocks, where a block is a pixel for standard texture * A texture is stored as an array of blocks, where a block is a pixel for standard texture
* but is a structure containing several pixels for compressed format * but is a structure containing several pixels for compressed format

View file

@ -255,6 +255,7 @@ namespace rsx
u8 get_format_sample_count(rsx::surface_antialiasing antialias); u8 get_format_sample_count(rsx::surface_antialiasing antialias);
u32 get_max_depth_value(rsx::surface_depth_format2 format); u32 get_max_depth_value(rsx::surface_depth_format2 format);
bool is_depth_stencil_format(rsx::surface_depth_format2 format); bool is_depth_stencil_format(rsx::surface_depth_format2 format);
bool is_int8_remapped_format(u32 format); // Returns true if the format is treated as INT8 by the RSX remapper.
/** /**
* Returns number of texel rows encoded in one pitch-length line of bytes * Returns number of texel rows encoded in one pitch-length line of bytes

View file

@ -172,7 +172,7 @@ vec4 _texcoord_xform_shadow(const in vec4 coord4, const in sampler_info params)
vec4 _sext_unorm8x4(const in vec4 x) vec4 _sext_unorm8x4(const in vec4 x)
{ {
// TODO: Handle clamped sign-extension // TODO: Handle clamped sign-extension
const vec4 bits = floor(fma(x, vec4(255.), vec4(0.5f))); const vec4 bits = floor(fma(x, vec4(255.f), vec4(0.5f)));
const bvec4 sign_check = lessThan(bits, vec4(128.f)); const bvec4 sign_check = lessThan(bits, vec4(128.f));
const vec4 ret = _select(bits - 256.f, bits, sign_check); const vec4 ret = _select(bits - 256.f, bits, sign_check);
return ret / 127.f; return ret / 127.f;

View file

@ -2599,6 +2599,8 @@ namespace rsx
} }
} }
if (rsx::is_int8_remapped_format(format))
{
// Special operations applied to 8-bit formats such as gamma correction and sign conversion // Special operations applied to 8-bit formats such as gamma correction and sign conversion
// NOTE: The unsigned_remap=bias flag being set flags the texture as being compressed normal (2n-1 / BX2) (UE3) // NOTE: The unsigned_remap=bias flag being set flags the texture as being compressed normal (2n-1 / BX2) (UE3)
// NOTE: The ARGB8_signed flag means to reinterpret the raw bytes as signed. This is different than unsigned_remap=bias which does range decompression. // NOTE: The ARGB8_signed flag means to reinterpret the raw bytes as signed. This is different than unsigned_remap=bias which does range decompression.
@ -2645,29 +2647,7 @@ namespace rsx
apply_sign_convert_mask(unsigned_remap, texture_control_bits::EXPAND_OFFSET); apply_sign_convert_mask(unsigned_remap, texture_control_bits::EXPAND_OFFSET);
} }
if (argb8_convert)
{
switch (format)
{
case CELL_GCM_TEXTURE_DEPTH24_D8:
case CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT:
case CELL_GCM_TEXTURE_DEPTH16:
case CELL_GCM_TEXTURE_DEPTH16_FLOAT:
case CELL_GCM_TEXTURE_X16:
case CELL_GCM_TEXTURE_Y16_X16:
case CELL_GCM_TEXTURE_COMPRESSED_HILO8:
case CELL_GCM_TEXTURE_COMPRESSED_HILO_S8:
case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT:
case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT:
case CELL_GCM_TEXTURE_X32_FLOAT:
case CELL_GCM_TEXTURE_Y16_X16_FLOAT:
// Special data formats (XY, HILO, DEPTH) are not RGB formats
// Ignore gamma flags
break;
default:
texture_control |= argb8_convert; texture_control |= argb8_convert;
break;
}
} }
current_fragment_program.texture_params[i].control = texture_control; current_fragment_program.texture_params[i].control = texture_control;