mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-08-23 01:00:41 +02:00
rasterizer_cache: Protect inherited caches from submission level
This commit is contained in:
parent
221996a194
commit
4705d1b523
@ -169,6 +169,8 @@ protected:
|
|||||||
object->MarkAsModified(false, *this);
|
object->MarkAsModified(false, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::recursive_mutex mutex;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Returns a list of cached objects from the specified memory region, ordered by access time
|
/// Returns a list of cached objects from the specified memory region, ordered by access time
|
||||||
std::vector<T> GetSortedObjectsFromRegion(CacheAddr addr, u64 size) {
|
std::vector<T> GetSortedObjectsFromRegion(CacheAddr addr, u64 size) {
|
||||||
@ -208,5 +210,4 @@ private:
|
|||||||
IntervalCache interval_cache; ///< Cache of objects
|
IntervalCache interval_cache; ///< Cache of objects
|
||||||
u64 modified_ticks{}; ///< Counter of cache state ticks, used for in-order flushing
|
u64 modified_ticks{}; ///< Counter of cache state ticks, used for in-order flushing
|
||||||
VideoCore::RasterizerInterface& rasterizer;
|
VideoCore::RasterizerInterface& rasterizer;
|
||||||
std::recursive_mutex mutex;
|
|
||||||
};
|
};
|
||||||
|
@ -23,6 +23,7 @@ OGLBufferCache::OGLBufferCache(RasterizerOpenGL& rasterizer, std::size_t size)
|
|||||||
|
|
||||||
GLintptr OGLBufferCache::UploadMemory(GPUVAddr gpu_addr, std::size_t size, std::size_t alignment,
|
GLintptr OGLBufferCache::UploadMemory(GPUVAddr gpu_addr, std::size_t size, std::size_t alignment,
|
||||||
bool cache) {
|
bool cache) {
|
||||||
|
std::lock_guard lock{mutex};
|
||||||
auto& memory_manager = Core::System::GetInstance().GPU().MemoryManager();
|
auto& memory_manager = Core::System::GetInstance().GPU().MemoryManager();
|
||||||
|
|
||||||
// Cache management is a big overhead, so only cache entries with a given size.
|
// Cache management is a big overhead, so only cache entries with a given size.
|
||||||
@ -62,6 +63,7 @@ GLintptr OGLBufferCache::UploadMemory(GPUVAddr gpu_addr, std::size_t size, std::
|
|||||||
|
|
||||||
GLintptr OGLBufferCache::UploadHostMemory(const void* raw_pointer, std::size_t size,
|
GLintptr OGLBufferCache::UploadHostMemory(const void* raw_pointer, std::size_t size,
|
||||||
std::size_t alignment) {
|
std::size_t alignment) {
|
||||||
|
std::lock_guard lock{mutex};
|
||||||
AlignBuffer(alignment);
|
AlignBuffer(alignment);
|
||||||
std::memcpy(buffer_ptr, raw_pointer, size);
|
std::memcpy(buffer_ptr, raw_pointer, size);
|
||||||
const GLintptr uploaded_offset = buffer_offset;
|
const GLintptr uploaded_offset = buffer_offset;
|
||||||
|
@ -76,6 +76,7 @@ GlobalRegionCacheOpenGL::GlobalRegionCacheOpenGL(RasterizerOpenGL& rasterizer)
|
|||||||
GlobalRegion GlobalRegionCacheOpenGL::GetGlobalRegion(
|
GlobalRegion GlobalRegionCacheOpenGL::GetGlobalRegion(
|
||||||
const GLShader::GlobalMemoryEntry& global_region,
|
const GLShader::GlobalMemoryEntry& global_region,
|
||||||
Tegra::Engines::Maxwell3D::Regs::ShaderStage stage) {
|
Tegra::Engines::Maxwell3D::Regs::ShaderStage stage) {
|
||||||
|
std::lock_guard lock{mutex};
|
||||||
|
|
||||||
auto& gpu{Core::System::GetInstance().GPU()};
|
auto& gpu{Core::System::GetInstance().GPU()};
|
||||||
auto& memory_manager{gpu.MemoryManager()};
|
auto& memory_manager{gpu.MemoryManager()};
|
||||||
|
Loading…
Reference in New Issue
Block a user