summaryrefslogtreecommitdiff
path: root/src/video_core/texture_cache
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-12-28 21:45:56 -0300
committerGravatar ReinUsesLisp2020-02-28 17:56:41 -0300
commitdacf83ac0257727a48c971ca1cfcd220976c461f (patch)
treed511c48c449859ef44884c8d6c6b4c5a84b740f2 /src/video_core/texture_cache
parentmaxwell_3d: Flatten cull and front face registers (diff)
downloadyuzu-dacf83ac0257727a48c971ca1cfcd220976c461f.tar.gz
yuzu-dacf83ac0257727a48c971ca1cfcd220976c461f.tar.xz
yuzu-dacf83ac0257727a48c971ca1cfcd220976c461f.zip
renderer_opengl: Reintroduce dirty flags for render targets
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 @@
22#include "core/core.h" 22#include "core/core.h"
23#include "core/memory.h" 23#include "core/memory.h"
24#include "core/settings.h" 24#include "core/settings.h"
25#include "video_core/dirty_flags.h"
25#include "video_core/engines/fermi_2d.h" 26#include "video_core/engines/fermi_2d.h"
26#include "video_core/engines/maxwell_3d.h" 27#include "video_core/engines/maxwell_3d.h"
27#include "video_core/gpu.h" 28#include "video_core/gpu.h"
@@ -142,6 +143,10 @@ public:
142 TView GetDepthBufferSurface(bool preserve_contents) { 143 TView GetDepthBufferSurface(bool preserve_contents) {
143 std::lock_guard lock{mutex}; 144 std::lock_guard lock{mutex};
144 auto& maxwell3d = system.GPU().Maxwell3D(); 145 auto& maxwell3d = system.GPU().Maxwell3D();
146 if (!maxwell3d.dirty.flags[VideoCommon::Dirty::ZetaBuffer]) {
147 return depth_buffer.view;
148 }
149 maxwell3d.dirty.flags[VideoCommon::Dirty::ZetaBuffer] = false;
145 150
146 const auto& regs{maxwell3d.regs}; 151 const auto& regs{maxwell3d.regs};
147 const auto gpu_addr{regs.zeta.Address()}; 152 const auto gpu_addr{regs.zeta.Address()};
@@ -170,6 +175,10 @@ public:
170 std::lock_guard lock{mutex}; 175 std::lock_guard lock{mutex};
171 ASSERT(index < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets); 176 ASSERT(index < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets);
172 auto& maxwell3d = system.GPU().Maxwell3D(); 177 auto& maxwell3d = system.GPU().Maxwell3D();
178 if (!maxwell3d.dirty.flags[VideoCommon::Dirty::ColorBuffer0 + index]) {
179 return render_targets[index].view;
180 }
181 maxwell3d.dirty.flags[VideoCommon::Dirty::ColorBuffer0 + index] = false;
173 182
174 const auto& regs{maxwell3d.regs}; 183 const auto& regs{maxwell3d.regs};
175 if (index >= regs.rt_control.count || regs.rt[index].Address() == 0 || 184 if (index >= regs.rt_control.count || regs.rt[index].Address() == 0 ||
@@ -310,7 +319,16 @@ protected:
310 // and reading it from a separate buffer. 319 // and reading it from a separate buffer.
311 virtual void BufferCopy(TSurface& src_surface, TSurface& dst_surface) = 0; 320 virtual void BufferCopy(TSurface& src_surface, TSurface& dst_surface) = 0;
312 321
313 void ManageRenderTargetUnregister([[maybe_unused]] TSurface& surface) {} 322 void ManageRenderTargetUnregister(TSurface& surface) {
323 auto& dirty = system.GPU().Maxwell3D().dirty;
324 const u32 index = surface->GetRenderTarget();
325 if (index == DEPTH_RT) {
326 dirty.flags[VideoCommon::Dirty::ZetaBuffer] = true;
327 } else {
328 dirty.flags[VideoCommon::Dirty::ColorBuffer0 + index] = true;
329 }
330 dirty.flags[VideoCommon::Dirty::RenderTargets] = true;
331 }
314 332
315 void Register(TSurface surface) { 333 void Register(TSurface surface) {
316 const GPUVAddr gpu_addr = surface->GetGpuAddr(); 334 const GPUVAddr gpu_addr = surface->GetGpuAddr();