mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 00:11:24 +12:00
rsx: Texture fixes continued
- Fix buffer invalidate behaviour (wcb) - Disable auto rebuild with only framebuffer storage getting rebuilt - Fix vulkan subresource sampling
This commit is contained in:
parent
5e58cf6079
commit
0de0dded53
4 changed files with 26 additions and 22 deletions
|
@ -18,7 +18,8 @@ namespace rsx
|
||||||
{
|
{
|
||||||
shader_read = 0,
|
shader_read = 0,
|
||||||
blit_engine_src = 1,
|
blit_engine_src = 1,
|
||||||
blit_engine_dst = 2
|
blit_engine_dst = 2,
|
||||||
|
framebuffer_storage = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cached_texture_section : public rsx::buffered_section
|
struct cached_texture_section : public rsx::buffered_section
|
||||||
|
@ -271,12 +272,7 @@ namespace rsx
|
||||||
{
|
{
|
||||||
auto obj = *It;
|
auto obj = *It;
|
||||||
|
|
||||||
if (discard_only)
|
if (obj.first->is_flushable())
|
||||||
obj.first->discard();
|
|
||||||
else
|
|
||||||
obj.first->unprotect();
|
|
||||||
|
|
||||||
if (obj.first->is_flushable() && allow_flush)
|
|
||||||
{
|
{
|
||||||
sections_to_flush.push_back(obj.first);
|
sections_to_flush.push_back(obj.first);
|
||||||
}
|
}
|
||||||
|
@ -286,6 +282,11 @@ namespace rsx
|
||||||
m_unreleased_texture_objects++;
|
m_unreleased_texture_objects++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (discard_only)
|
||||||
|
obj.first->discard();
|
||||||
|
else
|
||||||
|
obj.first->unprotect();
|
||||||
|
|
||||||
obj.second->remove_one();
|
obj.second->remove_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +326,7 @@ namespace rsx
|
||||||
template <typename ...Args>
|
template <typename ...Args>
|
||||||
std::pair<bool, std::vector<section_storage_type*>> invalidate_range_impl(u32 address, u32 range, bool discard, bool allow_flush, Args&... extras)
|
std::pair<bool, std::vector<section_storage_type*>> invalidate_range_impl(u32 address, u32 range, bool discard, bool allow_flush, Args&... extras)
|
||||||
{
|
{
|
||||||
return invalidate_range_impl_base(address, range, discard, true, allow_flush, std::forward<Args>(extras)...);
|
return invalidate_range_impl_base(address, range, discard, false, allow_flush, std::forward<Args>(extras)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_hw_blit_engine_compatible(const u32 format) const
|
bool is_hw_blit_engine_compatible(const u32 format) const
|
||||||
|
@ -406,7 +407,7 @@ namespace rsx
|
||||||
{
|
{
|
||||||
if (!confirm_dimensions || tex.matches(rsx_address, width, height, depth, mipmaps))
|
if (!confirm_dimensions || tex.matches(rsx_address, width, height, depth, mipmaps))
|
||||||
{
|
{
|
||||||
if (!tex.is_locked())
|
if (!tex.is_locked() && tex.get_context() == texture_upload_context::framebuffer_storage)
|
||||||
range_data.notify(rsx_address, rsx_size);
|
range_data.notify(rsx_address, rsx_size);
|
||||||
|
|
||||||
return tex;
|
return tex;
|
||||||
|
@ -475,6 +476,7 @@ namespace rsx
|
||||||
|
|
||||||
region.protect(utils::protection::no);
|
region.protect(utils::protection::no);
|
||||||
region.create(width, height, 1, 1, nullptr, image, pitch, false, std::forward<Args>(extras)...);
|
region.create(width, height, 1, 1, nullptr, image, pitch, false, std::forward<Args>(extras)...);
|
||||||
|
region.set_context(texture_upload_context::framebuffer_storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ...Args>
|
template <typename ...Args>
|
||||||
|
@ -598,9 +600,6 @@ namespace rsx
|
||||||
reader_lock lock(m_cache_mutex);
|
reader_lock lock(m_cache_mutex);
|
||||||
for (const auto &tex: sections_to_flush)
|
for (const auto &tex: sections_to_flush)
|
||||||
{
|
{
|
||||||
if (tex->is_flushed())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!tex->flush(std::forward<Args>(extras)...))
|
if (!tex->flush(std::forward<Args>(extras)...))
|
||||||
{
|
{
|
||||||
//Missed address, note this
|
//Missed address, note this
|
||||||
|
|
|
@ -1204,7 +1204,7 @@ u64 GLGSRender::timestamp() const
|
||||||
|
|
||||||
bool GLGSRender::on_access_violation(u32 address, bool is_writing)
|
bool GLGSRender::on_access_violation(u32 address, bool is_writing)
|
||||||
{
|
{
|
||||||
bool can_flush = (std::this_thread::get_id() != m_thread_id);
|
bool can_flush = (std::this_thread::get_id() == m_thread_id);
|
||||||
auto result = m_gl_texture_cache.invalidate_address(address, can_flush);
|
auto result = m_gl_texture_cache.invalidate_address(address, can_flush);
|
||||||
|
|
||||||
if (!result.first)
|
if (!result.first)
|
||||||
|
@ -1224,7 +1224,7 @@ bool GLGSRender::on_access_violation(u32 address, bool is_writing)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLGSRender::on_notify_memory_unmapped(u32 address_base, u32 size)
|
void GLGSRender::on_notify_memory_unmapped(u32 address_base, u32 size)
|
||||||
|
|
|
@ -443,21 +443,20 @@ namespace gl
|
||||||
{
|
{
|
||||||
//Read-only texture, destroy texture memory
|
//Read-only texture, destroy texture memory
|
||||||
glDeleteTextures(1, &vram_texture);
|
glDeleteTextures(1, &vram_texture);
|
||||||
vram_texture = 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Destroy pbo cache since vram texture is managed elsewhere
|
//Destroy pbo cache since vram texture is managed elsewhere
|
||||||
glDeleteBuffers(1, &pbo_id);
|
glDeleteBuffers(1, &pbo_id);
|
||||||
pbo_id = 0;
|
|
||||||
pbo_size = 0;
|
|
||||||
|
|
||||||
if (scaled_texture)
|
if (scaled_texture)
|
||||||
{
|
|
||||||
glDeleteTextures(1, &scaled_texture);
|
glDeleteTextures(1, &scaled_texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
vram_texture = 0;
|
||||||
scaled_texture = 0;
|
scaled_texture = 0;
|
||||||
}
|
pbo_id = 0;
|
||||||
}
|
pbo_size = 0;
|
||||||
|
|
||||||
if (!m_fence.is_empty())
|
if (!m_fence.is_empty())
|
||||||
m_fence.destroy();
|
m_fence.destroy();
|
||||||
|
|
|
@ -80,6 +80,12 @@ namespace vk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void destroy()
|
||||||
|
{
|
||||||
|
vram_texture = nullptr;
|
||||||
|
release_dma_resources();
|
||||||
|
}
|
||||||
|
|
||||||
bool exists() const
|
bool exists() const
|
||||||
{
|
{
|
||||||
return (vram_texture != nullptr);
|
return (vram_texture != nullptr);
|
||||||
|
@ -355,7 +361,7 @@ namespace vk
|
||||||
void free_texture_section(cached_texture_section& tex) override
|
void free_texture_section(cached_texture_section& tex) override
|
||||||
{
|
{
|
||||||
m_discardable_storage.push_back(tex);
|
m_discardable_storage.push_back(tex);
|
||||||
tex.release_dma_resources();
|
tex.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
vk::image_view* create_temporary_subresource_view(vk::command_buffer& cmd, vk::image* source, u32 /*gcm_format*/, u16 x, u16 y, u16 w, u16 h) override
|
vk::image_view* create_temporary_subresource_view(vk::command_buffer& cmd, vk::image* source, u32 /*gcm_format*/, u16 x, u16 y, u16 w, u16 h) override
|
||||||
|
@ -394,7 +400,7 @@ namespace vk
|
||||||
|
|
||||||
VkImageCopy copy_rgn;
|
VkImageCopy copy_rgn;
|
||||||
copy_rgn.srcOffset = { (s32)x, (s32)y, 0 };
|
copy_rgn.srcOffset = { (s32)x, (s32)y, 0 };
|
||||||
copy_rgn.dstOffset = { (s32)x, (s32)y, 0 };
|
copy_rgn.dstOffset = { (s32)0, (s32)0, 0 };
|
||||||
copy_rgn.dstSubresource = { aspect, 0, 0, 1 };
|
copy_rgn.dstSubresource = { aspect, 0, 0, 1 };
|
||||||
copy_rgn.srcSubresource = { aspect, 0, 0, 1 };
|
copy_rgn.srcSubresource = { aspect, 0, 0, 1 };
|
||||||
copy_rgn.extent = { w, h, 1 };
|
copy_rgn.extent = { w, h, 1 };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue