1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

rsx: Implement texture border color decode to remapped rgba

This commit is contained in:
kd-11 2024-10-03 03:22:26 +03:00 committed by kd-11
parent 826f805902
commit d1d04b1b32
5 changed files with 36 additions and 4 deletions

View File

@ -295,6 +295,16 @@ namespace rsx
return registers[NV4097_SET_TEXTURE_BORDER_COLOR + (m_index * 8)];
}
color4f fragment_texture::remapped_border_color() const
{
color4f base_color = rsx::decode_border_color(border_color());
if (remap() == RSX_TEXTURE_REMAP_IDENTITY)
{
return base_color;
}
return decoded_remap().remap(base_color);
}
u16 fragment_texture::depth() const
{
return dimension() == rsx::texture_dimension::dimension3d ? (registers[NV4097_SET_TEXTURE_CONTROL3 + m_index] >> 20) : 1;
@ -367,7 +377,7 @@ namespace rsx
u32 vertex_texture::remap() const
{
// disabled
return 0xAAE4;
return RSX_TEXTURE_REMAP_IDENTITY;
}
bool vertex_texture::enabled() const
@ -431,6 +441,11 @@ namespace rsx
return registers[NV4097_SET_VERTEX_TEXTURE_BORDER_COLOR + (m_index * 8)];
}
color4f vertex_texture::remapped_border_color() const
{
return rsx::decode_border_color(border_color());
}
u16 vertex_texture::depth() const
{
return dimension() == rsx::texture_dimension::dimension3d ? (registers[NV4097_SET_VERTEX_TEXTURE_CONTROL3 + (m_index * 8)] >> 20) : 1;

View File

@ -78,6 +78,8 @@ namespace rsx
// Border Color
u32 border_color() const;
color4f remapped_border_color() const;
u16 depth() const;
u32 pitch() const;
};
@ -132,6 +134,8 @@ namespace rsx
// Border Color
u32 border_color() const;
color4f remapped_border_color() const;
u16 depth() const;
u32 pitch() const;

View File

@ -421,7 +421,7 @@ namespace vk
native_component_map.g == VK_COMPONENT_SWIZZLE_G &&
native_component_map.b == VK_COMPONENT_SWIZZLE_B)
{
remap_encoding = 0xAAE4;
remap_encoding = RSX_TEXTURE_REMAP_IDENTITY;
}
}
@ -439,7 +439,7 @@ namespace vk
case VK_REMAP_IDENTITY:
real_mapping = { VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY };
break;
case 0xAAE4:
case RSX_TEXTURE_REMAP_IDENTITY:
real_mapping = native_component_map;
break;
default:

View File

@ -43,6 +43,14 @@ namespace rsx
return remap(components, static_cast<T>(0), static_cast<T>(1));
}
template <typename T>
color4_base<T> remap(const color4_base<T>& components)
{
const std::array<T, 4> values = { components.a, components.r, components.g, components.b };
const auto shuffled = remap(values, T{ 0 }, T{ 1 });
return color4_base<T>(shuffled[1], shuffled[2], shuffled[3], shuffled[0]);
}
template <typename T>
requires std::is_integral_v<T> || std::is_enum_v<T>
texture_channel_remap_t with_encoding(T encoding) const
@ -55,7 +63,7 @@ namespace rsx
static const texture_channel_remap_t default_remap_vector =
{
.encoded = 0xAAE4,
.encoded = RSX_TEXTURE_REMAP_IDENTITY,
.control_map = { CELL_GCM_TEXTURE_REMAP_REMAP, CELL_GCM_TEXTURE_REMAP_REMAP, CELL_GCM_TEXTURE_REMAP_REMAP, CELL_GCM_TEXTURE_REMAP_REMAP },
.channel_map = { CELL_GCM_TEXTURE_REMAP_FROM_A, CELL_GCM_TEXTURE_REMAP_FROM_R, CELL_GCM_TEXTURE_REMAP_FROM_G, CELL_GCM_TEXTURE_REMAP_FROM_B }
};

View File

@ -419,6 +419,11 @@ namespace gcm
CELL_GCM_FALSE = 0,
};
enum
{
RSX_TEXTURE_REMAP_IDENTITY = 0xAAE4,
};
enum
{
CELL_GCM_POINT_SPRITE_RMODE_ZERO = 0,