diff options
| author | 2019-05-10 23:42:08 -0400 | |
|---|---|---|
| committer | 2019-06-20 21:36:12 -0300 | |
| commit | 1bbc9debfbcbd960874e2f877604506d174f613c (patch) | |
| tree | a5977d5db90882e0eb5240af45d42aad4a3dd266 /src/video_core/texture_cache | |
| parent | texture_cache: Implement GPU Dirty Flags (diff) | |
| download | yuzu-1bbc9debfbcbd960874e2f877604506d174f613c.tar.gz yuzu-1bbc9debfbcbd960874e2f877604506d174f613c.tar.xz yuzu-1bbc9debfbcbd960874e2f877604506d174f613c.zip | |
Remove Framebuffer reconfiguration and restrict rendertarget protection
Diffstat (limited to 'src/video_core/texture_cache')
| -rw-r--r-- | src/video_core/texture_cache/surface_base.h | 15 | ||||
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 30 |
2 files changed, 19 insertions, 26 deletions
diff --git a/src/video_core/texture_cache/surface_base.h b/src/video_core/texture_cache/surface_base.h index 095deb602..78db2d665 100644 --- a/src/video_core/texture_cache/surface_base.h +++ b/src/video_core/texture_cache/surface_base.h | |||
| @@ -218,12 +218,12 @@ public: | |||
| 218 | virtual void DownloadTexture(std::vector<u8>& staging_buffer) = 0; | 218 | virtual void DownloadTexture(std::vector<u8>& staging_buffer) = 0; |
| 219 | 219 | ||
| 220 | void MarkAsModified(const bool is_modified_, const u64 tick) { | 220 | void MarkAsModified(const bool is_modified_, const u64 tick) { |
| 221 | is_modified = is_modified_ || is_protected; | 221 | is_modified = is_modified_ || is_target; |
| 222 | modification_tick = tick; | 222 | modification_tick = tick; |
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | void MarkAsProtected(const bool is_protected) { | 225 | void MarkAsRenderTarget(const bool is_target) { |
| 226 | this->is_protected = is_protected; | 226 | this->is_target = is_target; |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | void MarkAsPicked(const bool is_picked) { | 229 | void MarkAsPicked(const bool is_picked) { |
| @@ -235,7 +235,12 @@ public: | |||
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | bool IsProtected() const { | 237 | bool IsProtected() const { |
| 238 | return is_protected; | 238 | // Only 3D Slices are to be protected |
| 239 | return is_target && params.block_depth > 0; | ||
| 240 | } | ||
| 241 | |||
| 242 | bool IsRenderTarget() const { | ||
| 243 | return is_target; | ||
| 239 | } | 244 | } |
| 240 | 245 | ||
| 241 | bool IsRegistered() const { | 246 | bool IsRegistered() const { |
| @@ -307,7 +312,7 @@ private: | |||
| 307 | } | 312 | } |
| 308 | 313 | ||
| 309 | bool is_modified{}; | 314 | bool is_modified{}; |
| 310 | bool is_protected{}; | 315 | bool is_target{}; |
| 311 | bool is_registered{}; | 316 | bool is_registered{}; |
| 312 | bool is_picked{}; | 317 | bool is_picked{}; |
| 313 | u64 modification_tick{}; | 318 | u64 modification_tick{}; |
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 8aa0d6515..4ac5668c8 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -105,11 +105,11 @@ public: | |||
| 105 | regs.zeta.memory_layout.block_depth, regs.zeta.memory_layout.type)}; | 105 | regs.zeta.memory_layout.block_depth, regs.zeta.memory_layout.type)}; |
| 106 | auto surface_view = GetSurface(gpu_addr, depth_params, preserve_contents); | 106 | auto surface_view = GetSurface(gpu_addr, depth_params, preserve_contents); |
| 107 | if (depth_buffer.target) | 107 | if (depth_buffer.target) |
| 108 | depth_buffer.target->MarkAsProtected(false); | 108 | depth_buffer.target->MarkAsRenderTarget(false); |
| 109 | depth_buffer.target = surface_view.first; | 109 | depth_buffer.target = surface_view.first; |
| 110 | depth_buffer.view = surface_view.second; | 110 | depth_buffer.view = surface_view.second; |
| 111 | if (depth_buffer.target) | 111 | if (depth_buffer.target) |
| 112 | depth_buffer.target->MarkAsProtected(true); | 112 | depth_buffer.target->MarkAsRenderTarget(true); |
| 113 | return surface_view.second; | 113 | return surface_view.second; |
| 114 | } | 114 | } |
| 115 | 115 | ||
| @@ -138,11 +138,11 @@ public: | |||
| 138 | auto surface_view = GetSurface(gpu_addr, SurfaceParams::CreateForFramebuffer(system, index), | 138 | auto surface_view = GetSurface(gpu_addr, SurfaceParams::CreateForFramebuffer(system, index), |
| 139 | preserve_contents); | 139 | preserve_contents); |
| 140 | if (render_targets[index].target) | 140 | if (render_targets[index].target) |
| 141 | render_targets[index].target->MarkAsProtected(false); | 141 | render_targets[index].target->MarkAsRenderTarget(false); |
| 142 | render_targets[index].target = surface_view.first; | 142 | render_targets[index].target = surface_view.first; |
| 143 | render_targets[index].view = surface_view.second; | 143 | render_targets[index].view = surface_view.second; |
| 144 | if (render_targets[index].target) | 144 | if (render_targets[index].target) |
| 145 | render_targets[index].target->MarkAsProtected(true); | 145 | render_targets[index].target->MarkAsRenderTarget(true); |
| 146 | return surface_view.second; | 146 | return surface_view.second; |
| 147 | } | 147 | } |
| 148 | 148 | ||
| @@ -158,7 +158,7 @@ public: | |||
| 158 | 158 | ||
| 159 | void SetEmptyDepthBuffer() { | 159 | void SetEmptyDepthBuffer() { |
| 160 | if (depth_buffer.target != nullptr) { | 160 | if (depth_buffer.target != nullptr) { |
| 161 | depth_buffer.target->MarkAsProtected(false); | 161 | depth_buffer.target->MarkAsRenderTarget(false); |
| 162 | depth_buffer.target = nullptr; | 162 | depth_buffer.target = nullptr; |
| 163 | depth_buffer.view = nullptr; | 163 | depth_buffer.view = nullptr; |
| 164 | } | 164 | } |
| @@ -166,7 +166,7 @@ public: | |||
| 166 | 166 | ||
| 167 | void SetEmptyColorBuffer(std::size_t index) { | 167 | void SetEmptyColorBuffer(std::size_t index) { |
| 168 | if (render_targets[index].target != nullptr) { | 168 | if (render_targets[index].target != nullptr) { |
| 169 | render_targets[index].target->MarkAsProtected(false); | 169 | render_targets[index].target->MarkAsRenderTarget(false); |
| 170 | render_targets[index].target = nullptr; | 170 | render_targets[index].target = nullptr; |
| 171 | render_targets[index].view = nullptr; | 171 | render_targets[index].view = nullptr; |
| 172 | } | 172 | } |
| @@ -200,12 +200,6 @@ public: | |||
| 200 | return ++ticks; | 200 | return ++ticks; |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | bool ConsumeReconfigurationFlag() { | ||
| 204 | const bool result = force_reconfiguration; | ||
| 205 | force_reconfiguration = false; | ||
| 206 | return result; | ||
| 207 | } | ||
| 208 | |||
| 209 | protected: | 203 | protected: |
| 210 | TextureCache(Core::System& system, VideoCore::RasterizerInterface& rasterizer) | 204 | TextureCache(Core::System& system, VideoCore::RasterizerInterface& rasterizer) |
| 211 | : system{system}, rasterizer{rasterizer} { | 205 | : system{system}, rasterizer{rasterizer} { |
| @@ -242,8 +236,8 @@ protected: | |||
| 242 | rasterizer.UpdatePagesCachedCount(*cpu_addr, size, 1); | 236 | rasterizer.UpdatePagesCachedCount(*cpu_addr, size, 1); |
| 243 | } | 237 | } |
| 244 | 238 | ||
| 245 | void Unregister(TSurface surface, const bool force_unregister = false) { | 239 | void Unregister(TSurface surface) { |
| 246 | if (surface->IsProtected() && !force_unregister) { | 240 | if (surface->IsProtected()) { |
| 247 | return; | 241 | return; |
| 248 | } | 242 | } |
| 249 | const GPUVAddr gpu_addr = surface->GetGpuAddr(); | 243 | const GPUVAddr gpu_addr = surface->GetGpuAddr(); |
| @@ -392,10 +386,8 @@ private: | |||
| 392 | std::min(src_params.height, dst_height), 1); | 386 | std::min(src_params.height, dst_height), 1); |
| 393 | ImageCopy(surface, new_surface, copy_params); | 387 | ImageCopy(surface, new_surface, copy_params); |
| 394 | } | 388 | } |
| 395 | force_reconfiguration = false; | ||
| 396 | for (auto surface : overlaps) { | 389 | for (auto surface : overlaps) { |
| 397 | force_reconfiguration |= surface->IsProtected(); | 390 | Unregister(surface); |
| 398 | Unregister(surface, true); | ||
| 399 | } | 391 | } |
| 400 | new_surface->MarkAsModified(modified, Tick()); | 392 | new_surface->MarkAsModified(modified, Tick()); |
| 401 | Register(new_surface); | 393 | Register(new_surface); |
| @@ -567,10 +559,6 @@ private: | |||
| 567 | 559 | ||
| 568 | u64 ticks{}; | 560 | u64 ticks{}; |
| 569 | 561 | ||
| 570 | // Sometimes Setup Textures can hit a surface that's on the render target, when this happens | ||
| 571 | // we force a reconfiguration of the frame buffer after setup. | ||
| 572 | bool force_reconfiguration; | ||
| 573 | |||
| 574 | // The internal Cache is different for the Texture Cache. It's based on buckets | 562 | // The internal Cache is different for the Texture Cache. It's based on buckets |
| 575 | // of 1MB. This fits better for the purpose of this cache as textures are normaly | 563 | // of 1MB. This fits better for the purpose of this cache as textures are normaly |
| 576 | // large in size. | 564 | // large in size. |