summaryrefslogtreecommitdiffstats
path: root/src/video_core/texture_cache
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-12-29 01:45:56 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-02-28 21:56:41 +0100
commitdacf83ac0257727a48c971ca1cfcd220976c461f (patch)
treed511c48c449859ef44884c8d6c6b4c5a84b740f2 /src/video_core/texture_cache
parentmaxwell_3d: Flatten cull and front face registers (diff)
downloadyuzu-dacf83ac0257727a48c971ca1cfcd220976c461f.tar
yuzu-dacf83ac0257727a48c971ca1cfcd220976c461f.tar.gz
yuzu-dacf83ac0257727a48c971ca1cfcd220976c461f.tar.bz2
yuzu-dacf83ac0257727a48c971ca1cfcd220976c461f.tar.lz
yuzu-dacf83ac0257727a48c971ca1cfcd220976c461f.tar.xz
yuzu-dacf83ac0257727a48c971ca1cfcd220976c461f.tar.zst
yuzu-dacf83ac0257727a48c971ca1cfcd220976c461f.zip
Diffstat (limited to 'src/video_core/texture_cache')
-rw-r--r--src/video_core/texture_cache/texture_cache.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index ec6dfa49e..51373b687 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -22,6 +22,7 @@
#include "core/core.h"
#include "core/memory.h"
#include "core/settings.h"
+#include "video_core/dirty_flags.h"
#include "video_core/engines/fermi_2d.h"
#include "video_core/engines/maxwell_3d.h"
#include "video_core/gpu.h"
@@ -142,6 +143,10 @@ public:
TView GetDepthBufferSurface(bool preserve_contents) {
std::lock_guard lock{mutex};
auto& maxwell3d = system.GPU().Maxwell3D();
+ if (!maxwell3d.dirty.flags[VideoCommon::Dirty::ZetaBuffer]) {
+ return depth_buffer.view;
+ }
+ maxwell3d.dirty.flags[VideoCommon::Dirty::ZetaBuffer] = false;
const auto& regs{maxwell3d.regs};
const auto gpu_addr{regs.zeta.Address()};
@@ -170,6 +175,10 @@ public:
std::lock_guard lock{mutex};
ASSERT(index < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets);
auto& maxwell3d = system.GPU().Maxwell3D();
+ if (!maxwell3d.dirty.flags[VideoCommon::Dirty::ColorBuffer0 + index]) {
+ return render_targets[index].view;
+ }
+ maxwell3d.dirty.flags[VideoCommon::Dirty::ColorBuffer0 + index] = false;
const auto& regs{maxwell3d.regs};
if (index >= regs.rt_control.count || regs.rt[index].Address() == 0 ||
@@ -310,7 +319,16 @@ protected:
// and reading it from a separate buffer.
virtual void BufferCopy(TSurface& src_surface, TSurface& dst_surface) = 0;
- void ManageRenderTargetUnregister([[maybe_unused]] TSurface& surface) {}
+ void ManageRenderTargetUnregister(TSurface& surface) {
+ auto& dirty = system.GPU().Maxwell3D().dirty;
+ const u32 index = surface->GetRenderTarget();
+ if (index == DEPTH_RT) {
+ dirty.flags[VideoCommon::Dirty::ZetaBuffer] = true;
+ } else {
+ dirty.flags[VideoCommon::Dirty::ColorBuffer0 + index] = true;
+ }
+ dirty.flags[VideoCommon::Dirty::RenderTargets] = true;
+ }
void Register(TSurface surface) {
const GPUVAddr gpu_addr = surface->GetGpuAddr();