mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-11-23 17:13:20 +00:00
texture_cache: correct mutex locks
This commit is contained in:
parent
b7de31ac97
commit
561ce29c98
|
@ -90,6 +90,7 @@ public:
|
||||||
|
|
||||||
TView GetTextureSurface(const Tegra::Texture::FullTextureInfo& config,
|
TView GetTextureSurface(const Tegra::Texture::FullTextureInfo& config,
|
||||||
const VideoCommon::Shader::Sampler& entry) {
|
const VideoCommon::Shader::Sampler& entry) {
|
||||||
|
std::lock_guard lock{mutex};
|
||||||
const auto gpu_addr{config.tic.Address()};
|
const auto gpu_addr{config.tic.Address()};
|
||||||
if (!gpu_addr) {
|
if (!gpu_addr) {
|
||||||
return {};
|
return {};
|
||||||
|
@ -99,6 +100,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
TView GetDepthBufferSurface(bool preserve_contents) {
|
TView GetDepthBufferSurface(bool preserve_contents) {
|
||||||
|
std::lock_guard lock{mutex};
|
||||||
auto& maxwell3d = system.GPU().Maxwell3D();
|
auto& maxwell3d = system.GPU().Maxwell3D();
|
||||||
|
|
||||||
if (!maxwell3d.dirty_flags.zeta_buffer) {
|
if (!maxwell3d.dirty_flags.zeta_buffer) {
|
||||||
|
@ -127,6 +129,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
TView GetColorBufferSurface(std::size_t index, bool preserve_contents) {
|
TView GetColorBufferSurface(std::size_t index, bool preserve_contents) {
|
||||||
|
std::lock_guard lock{mutex};
|
||||||
ASSERT(index < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets);
|
ASSERT(index < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets);
|
||||||
auto& maxwell3d = system.GPU().Maxwell3D();
|
auto& maxwell3d = system.GPU().Maxwell3D();
|
||||||
if (!maxwell3d.dirty_flags.color_buffer[index]) {
|
if (!maxwell3d.dirty_flags.color_buffer[index]) {
|
||||||
|
@ -188,6 +191,7 @@ public:
|
||||||
void DoFermiCopy(const Tegra::Engines::Fermi2D::Regs::Surface& src_config,
|
void DoFermiCopy(const Tegra::Engines::Fermi2D::Regs::Surface& src_config,
|
||||||
const Tegra::Engines::Fermi2D::Regs::Surface& dst_config,
|
const Tegra::Engines::Fermi2D::Regs::Surface& dst_config,
|
||||||
const Tegra::Engines::Fermi2D::Config& copy_config) {
|
const Tegra::Engines::Fermi2D::Config& copy_config) {
|
||||||
|
std::lock_guard lock{mutex};
|
||||||
std::pair<TSurface, TView> dst_surface = GetFermiSurface(dst_config);
|
std::pair<TSurface, TView> dst_surface = GetFermiSurface(dst_config);
|
||||||
std::pair<TSurface, TView> src_surface = GetFermiSurface(src_config);
|
std::pair<TSurface, TView> src_surface = GetFermiSurface(src_config);
|
||||||
ImageBlit(src_surface.second, dst_surface.second, copy_config);
|
ImageBlit(src_surface.second, dst_surface.second, copy_config);
|
||||||
|
@ -245,8 +249,6 @@ protected:
|
||||||
virtual void BufferCopy(TSurface& src_surface, TSurface& dst_surface) = 0;
|
virtual void BufferCopy(TSurface& src_surface, TSurface& dst_surface) = 0;
|
||||||
|
|
||||||
void Register(TSurface surface) {
|
void Register(TSurface surface) {
|
||||||
std::lock_guard lock{mutex};
|
|
||||||
|
|
||||||
const GPUVAddr gpu_addr = surface->GetGpuAddr();
|
const GPUVAddr gpu_addr = surface->GetGpuAddr();
|
||||||
const CacheAddr cache_ptr = ToCacheAddr(memory_manager->GetPointer(gpu_addr));
|
const CacheAddr cache_ptr = ToCacheAddr(memory_manager->GetPointer(gpu_addr));
|
||||||
const std::size_t size = surface->GetSizeInBytes();
|
const std::size_t size = surface->GetSizeInBytes();
|
||||||
|
@ -266,8 +268,6 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unregister(TSurface surface) {
|
void Unregister(TSurface surface) {
|
||||||
std::lock_guard lock{mutex};
|
|
||||||
|
|
||||||
if (guard_cache && surface->IsProtected()) {
|
if (guard_cache && surface->IsProtected()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue