diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/texture_cache/surface_base.h | 4 | ||||
| -rw-r--r-- | src/video_core/texture_cache/surface_params.cpp | 9 | ||||
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 17 |
3 files changed, 17 insertions, 13 deletions
diff --git a/src/video_core/texture_cache/surface_base.h b/src/video_core/texture_cache/surface_base.h index fb6378bc7..bcce8d863 100644 --- a/src/video_core/texture_cache/surface_base.h +++ b/src/video_core/texture_cache/surface_base.h | |||
| @@ -312,11 +312,13 @@ private: | |||
| 312 | return view; | 312 | return view; |
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | static constexpr u32 NO_RT = 0xFFFFFFFF; | ||
| 316 | |||
| 315 | bool is_modified{}; | 317 | bool is_modified{}; |
| 316 | bool is_target{}; | 318 | bool is_target{}; |
| 317 | bool is_registered{}; | 319 | bool is_registered{}; |
| 318 | bool is_picked{}; | 320 | bool is_picked{}; |
| 319 | u32 index{0xFFFFFFFF}; | 321 | u32 index{NO_RT}; |
| 320 | u64 modification_tick{}; | 322 | u64 modification_tick{}; |
| 321 | }; | 323 | }; |
| 322 | 324 | ||
diff --git a/src/video_core/texture_cache/surface_params.cpp b/src/video_core/texture_cache/surface_params.cpp index 33c94daa8..fd5472451 100644 --- a/src/video_core/texture_cache/surface_params.cpp +++ b/src/video_core/texture_cache/surface_params.cpp | |||
| @@ -297,12 +297,11 @@ std::size_t SurfaceParams::GetInnerMipmapMemorySize(u32 level, bool as_host_size | |||
| 297 | return Tegra::Texture::CalculateSize(!as_host_size, GetBytesPerPixel(), width, height, | 297 | return Tegra::Texture::CalculateSize(!as_host_size, GetBytesPerPixel(), width, height, |
| 298 | depth, GetMipBlockHeight(level), | 298 | depth, GetMipBlockHeight(level), |
| 299 | GetMipBlockDepth(level)); | 299 | GetMipBlockDepth(level)); |
| 300 | } else if (as_host_size || IsBuffer()) { | ||
| 301 | return GetBytesPerPixel() * width * height * depth; | ||
| 300 | } else { | 302 | } else { |
| 301 | if (as_host_size || IsBuffer()) { | 303 | // Linear Texture Case |
| 302 | return GetBytesPerPixel() * width * height * depth; | 304 | return pitch * height * depth; |
| 303 | } else { | ||
| 304 | return pitch * height * depth; | ||
| 305 | } | ||
| 306 | } | 305 | } |
| 307 | } | 306 | } |
| 308 | 307 | ||
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 6d3d2da7d..7f9623c62 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -133,11 +133,11 @@ public: | |||
| 133 | regs.zeta.memory_layout.block_depth, regs.zeta.memory_layout.type)}; | 133 | regs.zeta.memory_layout.block_depth, regs.zeta.memory_layout.type)}; |
| 134 | auto surface_view = GetSurface(gpu_addr, depth_params, preserve_contents, true); | 134 | auto surface_view = GetSurface(gpu_addr, depth_params, preserve_contents, true); |
| 135 | if (depth_buffer.target) | 135 | if (depth_buffer.target) |
| 136 | depth_buffer.target->MarkAsRenderTarget(false, -1); | 136 | depth_buffer.target->MarkAsRenderTarget(false, NO_RT); |
| 137 | depth_buffer.target = surface_view.first; | 137 | depth_buffer.target = surface_view.first; |
| 138 | depth_buffer.view = surface_view.second; | 138 | depth_buffer.view = surface_view.second; |
| 139 | if (depth_buffer.target) | 139 | if (depth_buffer.target) |
| 140 | depth_buffer.target->MarkAsRenderTarget(true, 8); | 140 | depth_buffer.target->MarkAsRenderTarget(true, DEPTH_RT); |
| 141 | return surface_view.second; | 141 | return surface_view.second; |
| 142 | } | 142 | } |
| 143 | 143 | ||
| @@ -167,7 +167,7 @@ public: | |||
| 167 | auto surface_view = GetSurface(gpu_addr, SurfaceParams::CreateForFramebuffer(system, index), | 167 | auto surface_view = GetSurface(gpu_addr, SurfaceParams::CreateForFramebuffer(system, index), |
| 168 | preserve_contents, true); | 168 | preserve_contents, true); |
| 169 | if (render_targets[index].target) | 169 | if (render_targets[index].target) |
| 170 | render_targets[index].target->MarkAsRenderTarget(false, -1); | 170 | render_targets[index].target->MarkAsRenderTarget(false, NO_RT); |
| 171 | render_targets[index].target = surface_view.first; | 171 | render_targets[index].target = surface_view.first; |
| 172 | render_targets[index].view = surface_view.second; | 172 | render_targets[index].view = surface_view.second; |
| 173 | if (render_targets[index].target) | 173 | if (render_targets[index].target) |
| @@ -191,7 +191,7 @@ public: | |||
| 191 | if (depth_buffer.target == nullptr) { | 191 | if (depth_buffer.target == nullptr) { |
| 192 | return; | 192 | return; |
| 193 | } | 193 | } |
| 194 | depth_buffer.target->MarkAsRenderTarget(false, -1); | 194 | depth_buffer.target->MarkAsRenderTarget(false, NO_RT); |
| 195 | depth_buffer.target = nullptr; | 195 | depth_buffer.target = nullptr; |
| 196 | depth_buffer.view = nullptr; | 196 | depth_buffer.view = nullptr; |
| 197 | } | 197 | } |
| @@ -200,7 +200,7 @@ public: | |||
| 200 | if (render_targets[index].target == nullptr) { | 200 | if (render_targets[index].target == nullptr) { |
| 201 | return; | 201 | return; |
| 202 | } | 202 | } |
| 203 | render_targets[index].target->MarkAsRenderTarget(false, -1); | 203 | render_targets[index].target->MarkAsRenderTarget(false, NO_RT); |
| 204 | render_targets[index].target = nullptr; | 204 | render_targets[index].target = nullptr; |
| 205 | render_targets[index].view = nullptr; | 205 | render_targets[index].view = nullptr; |
| 206 | } | 206 | } |
| @@ -272,8 +272,8 @@ protected: | |||
| 272 | 272 | ||
| 273 | void ManageRenderTargetUnregister(TSurface& surface) { | 273 | void ManageRenderTargetUnregister(TSurface& surface) { |
| 274 | auto& maxwell3d = system.GPU().Maxwell3D(); | 274 | auto& maxwell3d = system.GPU().Maxwell3D(); |
| 275 | u32 index = surface->GetRenderTarget(); | 275 | const u32 index = surface->GetRenderTarget(); |
| 276 | if (index == 8) { | 276 | if (index == DEPTH_RT) { |
| 277 | maxwell3d.dirty_flags.zeta_buffer = true; | 277 | maxwell3d.dirty_flags.zeta_buffer = true; |
| 278 | } else { | 278 | } else { |
| 279 | maxwell3d.dirty_flags.color_buffer.set(index, true); | 279 | maxwell3d.dirty_flags.color_buffer.set(index, true); |
| @@ -797,6 +797,9 @@ private: | |||
| 797 | static constexpr u64 registry_page_size{1 << registry_page_bits}; | 797 | static constexpr u64 registry_page_size{1 << registry_page_bits}; |
| 798 | std::unordered_map<CacheAddr, std::vector<TSurface>> registry; | 798 | std::unordered_map<CacheAddr, std::vector<TSurface>> registry; |
| 799 | 799 | ||
| 800 | static constexpr u32 DEPTH_RT = 8; | ||
| 801 | static constexpr u32 NO_RT = 0xFFFFFFFF; | ||
| 802 | |||
| 800 | // The L1 Cache is used for fast texture lookup before checking the overlaps | 803 | // The L1 Cache is used for fast texture lookup before checking the overlaps |
| 801 | // This avoids calculating size and other stuffs. | 804 | // This avoids calculating size and other stuffs. |
| 802 | std::unordered_map<CacheAddr, TSurface> l1_cache; | 805 | std::unordered_map<CacheAddr, TSurface> l1_cache; |