diff --git a/rpcs3/Emu/RSX/RSXTexture.cpp b/rpcs3/Emu/RSX/RSXTexture.cpp index 2e309b0eb9..5951f368e9 100644 --- a/rpcs3/Emu/RSX/RSXTexture.cpp +++ b/rpcs3/Emu/RSX/RSXTexture.cpp @@ -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; diff --git a/rpcs3/Emu/RSX/RSXTexture.h b/rpcs3/Emu/RSX/RSXTexture.h index 1f536a29e6..a7d94db658 100644 --- a/rpcs3/Emu/RSX/RSXTexture.h +++ b/rpcs3/Emu/RSX/RSXTexture.h @@ -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; diff --git a/rpcs3/Emu/RSX/VK/vkutils/image.cpp b/rpcs3/Emu/RSX/VK/vkutils/image.cpp index 56b5fc083a..cd6a916214 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/image.cpp +++ b/rpcs3/Emu/RSX/VK/vkutils/image.cpp @@ -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: diff --git a/rpcs3/Emu/RSX/color_utils.h b/rpcs3/Emu/RSX/color_utils.h index f40d29c224..c052c2aacc 100644 --- a/rpcs3/Emu/RSX/color_utils.h +++ b/rpcs3/Emu/RSX/color_utils.h @@ -43,6 +43,14 @@ namespace rsx return remap(components, static_cast(0), static_cast(1)); } + template + color4_base remap(const color4_base& components) + { + const std::array values = { components.a, components.r, components.g, components.b }; + const auto shuffled = remap(values, T{ 0 }, T{ 1 }); + return color4_base(shuffled[1], shuffled[2], shuffled[3], shuffled[0]); + } + template requires std::is_integral_v || std::is_enum_v 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 } }; diff --git a/rpcs3/Emu/RSX/gcm_enums.h b/rpcs3/Emu/RSX/gcm_enums.h index 99684510fd..816aec77c0 100644 --- a/rpcs3/Emu/RSX/gcm_enums.h +++ b/rpcs3/Emu/RSX/gcm_enums.h @@ -419,6 +419,11 @@ namespace gcm CELL_GCM_FALSE = 0, }; + enum + { + RSX_TEXTURE_REMAP_IDENTITY = 0xAAE4, + }; + enum { CELL_GCM_POINT_SPRITE_RMODE_ZERO = 0,