mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 11:36:13 +00:00
rsx: Fix some texture cache problems
- gl/vk: Properly handle remapping temporary resources
This commit is contained in:
parent
9fce5b0f7a
commit
887ea43e39
5 changed files with 20 additions and 6 deletions
|
@ -64,7 +64,7 @@ namespace rsx
|
|||
GcmTileInfo *tile = nullptr;
|
||||
rsx::surface_antialiasing aa_mode = rsx::surface_antialiasing::center_1_sample;
|
||||
|
||||
virtual image_storage_type get_surface() const = 0;
|
||||
virtual image_storage_type get_surface() = 0;
|
||||
virtual u16 get_surface_width() const = 0;
|
||||
virtual u16 get_surface_height() const = 0;
|
||||
virtual u16 get_rsx_pitch() const = 0;
|
||||
|
|
|
@ -113,9 +113,9 @@ namespace gl
|
|||
return surface_height;
|
||||
}
|
||||
|
||||
u32 get_surface() const override
|
||||
u32 get_surface() override
|
||||
{
|
||||
return id();
|
||||
return get_view(0xAAE4, rsx::default_remap_vector);
|
||||
}
|
||||
|
||||
u32 get_view(u32 remap_encoding, const std::pair<std::array<u8, 4>, std::array<u8, 4>>& remap)
|
||||
|
|
|
@ -706,12 +706,26 @@ namespace gl
|
|||
}
|
||||
}
|
||||
|
||||
//TODO: Native texture views are needed here. It works because this routine is only called with rendertarget data
|
||||
if (ifmt != sized_internal_fmt)
|
||||
{
|
||||
err_once("GL format mismatch (data cast?). Sized ifmt=0x%X vs Src ifmt=0x%X", sized_internal_fmt, ifmt);
|
||||
//Apply base component map onto the new texture if a data cast has been done
|
||||
apply_component_mapping_flags(dst_type, gcm_format, rsx::texture_create_flags::default_component_order);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Inherit the parent's default mapping. The caller should ensure the native order is set beforehand
|
||||
GLint src_remap[4];
|
||||
glBindTexture(GL_TEXTURE_2D, src_id);
|
||||
glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, (GLint*)&src_remap[0]);
|
||||
glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, (GLint*)&src_remap[1]);
|
||||
glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, (GLint*)&src_remap[2]);
|
||||
glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, (GLint*)&src_remap[3]);
|
||||
|
||||
glBindTexture(dst_type, dst_id);
|
||||
glTexParameteriv(dst_type, GL_TEXTURE_SWIZZLE_RGBA, src_remap);
|
||||
}
|
||||
|
||||
if (memcmp(remap.first.data(), rsx::default_remap_vector.first.data(), 4) ||
|
||||
memcmp(remap.second.data(), rsx::default_remap_vector.second.data(), 4))
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace vk
|
|||
return result;
|
||||
}
|
||||
|
||||
vk::image* get_surface() const override
|
||||
vk::image* get_surface() override
|
||||
{
|
||||
return (vk::image*)this;
|
||||
}
|
||||
|
|
|
@ -706,10 +706,10 @@ namespace vk
|
|||
}
|
||||
|
||||
vk::image_view* generate_atlas_from_images(vk::command_buffer& cmd, u32 gcm_format, u16 width, u16 height,
|
||||
const std::vector<copy_region_descriptor>& sections_to_copy, const texture_channel_remap_t& /*remap_vector*/) override
|
||||
const std::vector<copy_region_descriptor>& sections_to_copy, const texture_channel_remap_t& remap_vector) override
|
||||
{
|
||||
auto result = create_temporary_subresource_view_impl(cmd, sections_to_copy.front().src, VK_IMAGE_TYPE_2D,
|
||||
VK_IMAGE_VIEW_TYPE_2D, gcm_format, 0, 0, width, height, rsx::default_remap_vector, false);
|
||||
VK_IMAGE_VIEW_TYPE_2D, gcm_format, 0, 0, width, height, remap_vector, false);
|
||||
|
||||
VkImage dst = result->info.image;
|
||||
VkImageAspectFlags aspect = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
|
|
Loading…
Add table
Reference in a new issue