mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
rsx: invalidate surface store address when tile is unbound
This commit is contained in:
parent
494cbac78b
commit
e0d1ac676e
10 changed files with 53 additions and 1 deletions
|
@ -323,6 +323,12 @@ s32 sys_rsx_context_attribute(s32 context_id, u32 package_id, u64 a3, u64 a4, u6
|
|||
//a5 low bits = ret.format = base | ((base + ((size - 1) / 0x10000)) << 13) | (comp << 26) | (1 << 30);
|
||||
|
||||
auto& tile = render->tiles[a3];
|
||||
|
||||
// When tile is going to be unbinded, we can use it as a hint that the address will no longer be used as a surface and can be removed/invalidated
|
||||
// Todo: There may be more checks such as format/size/width can could be done
|
||||
if (tile.binded && a5 == 0)
|
||||
render->notify_tile_unbound(a3);
|
||||
|
||||
tile.location = ((a4 >> 32) & 0xF) - 1;
|
||||
tile.offset = ((((a4 >> 32) & 0xFFFFFFFF) >> 16) * 0x10000);
|
||||
tile.size = ((((a4 & 0x7FFFFFFF) >> 16) + 1) * 0x10000) - tile.offset;
|
||||
|
|
|
@ -517,6 +517,31 @@ namespace rsx
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidates surface that exists at an address
|
||||
*/
|
||||
void invalidate_surface_address(u32 addr, bool depth)
|
||||
{
|
||||
if (!depth)
|
||||
{
|
||||
auto It = m_render_targets_storage.find(addr);
|
||||
if (It != m_render_targets_storage.end())
|
||||
{
|
||||
invalidated_resources.push_back(std::move(It->second));
|
||||
m_render_targets_storage.erase(It);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto It = m_depth_stencil_storage.find(addr);
|
||||
if (It != m_depth_stencil_storage.end())
|
||||
{
|
||||
invalidated_resources.push_back(std::move(It->second));
|
||||
m_depth_stencil_storage.erase(It);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clipping and fitting lookup funcrions
|
||||
* surface_overlaps - returns true if surface overlaps a given surface address and returns the relative x and y position of the surface address within the surface
|
||||
|
|
|
@ -183,4 +183,5 @@ protected:
|
|||
virtual std::array<std::vector<gsl::byte>, 4> copy_render_targets_to_memory() override;
|
||||
virtual std::array<std::vector<gsl::byte>, 2> copy_depth_stencil_buffer_to_memory() override;
|
||||
virtual std::pair<std::string, std::string> get_programs() const override;
|
||||
virtual void notify_tile_unbound(u32 tile) override;
|
||||
};
|
||||
|
|
|
@ -316,4 +316,10 @@ std::pair<std::string, std::string> D3D12GSRender::get_programs() const
|
|||
{
|
||||
return std::make_pair(m_pso_cache.get_transform_program(current_vertex_program).content, m_pso_cache.get_shader_program(current_fragment_program).content);
|
||||
}
|
||||
|
||||
void D3D12GSRender::notify_tile_unbound(u32 tile)
|
||||
{
|
||||
u32 addr = rsx::get_address(tiles[tile].offset, tiles[tile].location);
|
||||
m_rtts.invalidate_surface_address(addr, false);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1286,6 +1286,12 @@ bool GLGSRender::scaled_image_from_memory(rsx::blit_src_info& src, rsx::blit_dst
|
|||
return m_gl_texture_cache.blit(src, dst, interpolate, m_rtts);
|
||||
}
|
||||
|
||||
void GLGSRender::notify_tile_unbound(u32 tile)
|
||||
{
|
||||
u32 addr = rsx::get_address(tiles[tile].offset, tiles[tile].location);
|
||||
m_rtts.invalidate_surface_address(addr, false);
|
||||
}
|
||||
|
||||
void GLGSRender::check_zcull_status(bool framebuffer_swap, bool force_read)
|
||||
{
|
||||
if (g_cfg.video.disable_zcull_queries)
|
||||
|
|
|
@ -453,6 +453,7 @@ protected:
|
|||
|
||||
bool on_access_violation(u32 address, bool is_writing) override;
|
||||
void on_notify_memory_unmapped(u32 address_base, u32 size) override;
|
||||
void notify_tile_unbound(u32 tile) override;
|
||||
|
||||
virtual std::array<std::vector<gsl::byte>, 4> copy_render_targets_to_memory() override;
|
||||
virtual std::array<std::vector<gsl::byte>, 2> copy_depth_stencil_buffer_to_memory() override;
|
||||
|
|
|
@ -706,7 +706,6 @@ namespace rsx
|
|||
if (invalid_command_interrupt_raised)
|
||||
{
|
||||
//Skip the rest of this command
|
||||
internal_get = put;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -258,6 +258,7 @@ namespace rsx
|
|||
virtual u64 timestamp() const;
|
||||
virtual bool on_access_violation(u32 /*address*/, bool /*is_writing*/) { return false; }
|
||||
virtual void on_notify_memory_unmapped(u32 /*address_base*/, u32 /*size*/) {}
|
||||
virtual void notify_tile_unbound(u32 tile) {}
|
||||
|
||||
//zcull
|
||||
virtual void notify_zcull_info_changed() {}
|
||||
|
|
|
@ -2685,3 +2685,9 @@ bool VKGSRender::scaled_image_from_memory(rsx::blit_src_info& src, rsx::blit_dst
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
void VKGSRender::notify_tile_unbound(u32 tile)
|
||||
{
|
||||
u32 addr = rsx::get_address(tiles[tile].offset, tiles[tile].location);
|
||||
m_rtts.invalidate_surface_address(addr, false);
|
||||
}
|
|
@ -316,6 +316,7 @@ protected:
|
|||
|
||||
void do_local_task() override;
|
||||
bool scaled_image_from_memory(rsx::blit_src_info& src, rsx::blit_dst_info& dst, bool interpolate) override;
|
||||
void notify_tile_unbound(u32 tile) override;
|
||||
|
||||
bool on_access_violation(u32 address, bool is_writing) override;
|
||||
void on_notify_memory_unmapped(u32 address_base, u32 size) override;
|
||||
|
|
Loading…
Add table
Reference in a new issue