mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 12:32:43 +00:00
gl/vk: Quickly ignore access violations outside cache range
This commit is contained in:
parent
ea528a1ced
commit
40a598b0ab
@ -62,6 +62,8 @@ namespace gl
|
||||
std::vector<gl_cached_texture> texture_cache;
|
||||
std::vector<cached_rtt> rtt_cache;
|
||||
u32 frame_ctr;
|
||||
std::pair<u64, u64> texture_cache_range = std::make_pair(0xFFFFFFFF, 0);
|
||||
u32 max_tex_address = 0;
|
||||
|
||||
bool lock_memory_region(u32 start, u32 size)
|
||||
{
|
||||
@ -69,6 +71,12 @@ namespace gl
|
||||
start = start & ~(memory_page_size - 1);
|
||||
size = (u32)align(size, memory_page_size);
|
||||
|
||||
if (start < texture_cache_range.first)
|
||||
texture_cache_range = std::make_pair(start, texture_cache_range.second);
|
||||
|
||||
if ((start+size) > texture_cache_range.second)
|
||||
texture_cache_range = std::make_pair(texture_cache_range.first, (start+size));
|
||||
|
||||
return vm::page_protect(start, size, 0, 0, vm::page_writable);
|
||||
}
|
||||
|
||||
@ -500,6 +508,10 @@ namespace gl
|
||||
|
||||
bool mark_as_dirty(u32 address)
|
||||
{
|
||||
if (address < texture_cache_range.first ||
|
||||
address > texture_cache_range.second)
|
||||
return false;
|
||||
|
||||
bool response = false;
|
||||
|
||||
for (gl_cached_texture &tex: texture_cache)
|
||||
|
@ -30,7 +30,7 @@ namespace vk
|
||||
{
|
||||
private:
|
||||
std::vector<cached_texture_object> m_cache;
|
||||
|
||||
std::pair<u64, u64> texture_cache_range = std::make_pair(0xFFFFFFFF, 0);
|
||||
std::vector<std::unique_ptr<vk::image_view> > m_temporary_image_view;
|
||||
|
||||
bool lock_memory_region(u32 start, u32 size)
|
||||
@ -120,6 +120,12 @@ namespace vk
|
||||
obj.protected_rgn_end += obj.protected_rgn_start;
|
||||
|
||||
lock_memory_region(static_cast<u32>(obj.protected_rgn_start), static_cast<u32>(obj.native_rsx_size));
|
||||
|
||||
if (obj.protected_rgn_start < texture_cache_range.first)
|
||||
texture_cache_range = std::make_pair(obj.protected_rgn_start, texture_cache_range.second);
|
||||
|
||||
if (obj.protected_rgn_end > texture_cache_range.second)
|
||||
texture_cache_range = std::make_pair(texture_cache_range.first, obj.protected_rgn_end);
|
||||
}
|
||||
|
||||
void unlock_object(cached_texture_object &obj)
|
||||
@ -254,6 +260,10 @@ namespace vk
|
||||
|
||||
bool invalidate_address(u32 rsx_address)
|
||||
{
|
||||
if (rsx_address < texture_cache_range.first ||
|
||||
rsx_address > texture_cache_range.second)
|
||||
return false;
|
||||
|
||||
for (cached_texture_object &tex : m_cache)
|
||||
{
|
||||
if (tex.dirty) continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user