diff options
| author | 2023-06-17 23:26:39 +0800 | |
|---|---|---|
| committer | 2023-06-17 23:48:51 +0800 | |
| commit | 76a676883a17523fb12eeac6f2b9702e4916b2c2 (patch) | |
| tree | 8e4682f4c4081ffce647c54323904c9b4f19ac60 | |
| parent | Merge pull request #10783 from liamwhite/memory (diff) | |
| download | yuzu-76a676883a17523fb12eeac6f2b9702e4916b2c2.tar.gz yuzu-76a676883a17523fb12eeac6f2b9702e4916b2c2.tar.xz yuzu-76a676883a17523fb12eeac6f2b9702e4916b2c2.zip | |
video_core: add samples check when find render target
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 22 | ||||
| -rw-r--r-- | src/video_core/texture_cache/texture_cache_base.h | 10 |
2 files changed, 14 insertions, 18 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index c7f7448e9..f11998e20 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -280,7 +280,7 @@ void TextureCache<P>::SynchronizeComputeDescriptors() { | |||
| 280 | } | 280 | } |
| 281 | 281 | ||
| 282 | template <class P> | 282 | template <class P> |
| 283 | bool TextureCache<P>::RescaleRenderTargets(bool is_clear) { | 283 | bool TextureCache<P>::RescaleRenderTargets() { |
| 284 | auto& flags = maxwell3d->dirty.flags; | 284 | auto& flags = maxwell3d->dirty.flags; |
| 285 | u32 scale_rating = 0; | 285 | u32 scale_rating = 0; |
| 286 | bool rescaled = false; | 286 | bool rescaled = false; |
| @@ -318,13 +318,13 @@ bool TextureCache<P>::RescaleRenderTargets(bool is_clear) { | |||
| 318 | ImageViewId& color_buffer_id = render_targets.color_buffer_ids[index]; | 318 | ImageViewId& color_buffer_id = render_targets.color_buffer_ids[index]; |
| 319 | if (flags[Dirty::ColorBuffer0 + index] || force) { | 319 | if (flags[Dirty::ColorBuffer0 + index] || force) { |
| 320 | flags[Dirty::ColorBuffer0 + index] = false; | 320 | flags[Dirty::ColorBuffer0 + index] = false; |
| 321 | BindRenderTarget(&color_buffer_id, FindColorBuffer(index, is_clear)); | 321 | BindRenderTarget(&color_buffer_id, FindColorBuffer(index)); |
| 322 | } | 322 | } |
| 323 | check_rescale(color_buffer_id, tmp_color_images[index]); | 323 | check_rescale(color_buffer_id, tmp_color_images[index]); |
| 324 | } | 324 | } |
| 325 | if (flags[Dirty::ZetaBuffer] || force) { | 325 | if (flags[Dirty::ZetaBuffer] || force) { |
| 326 | flags[Dirty::ZetaBuffer] = false; | 326 | flags[Dirty::ZetaBuffer] = false; |
| 327 | BindRenderTarget(&render_targets.depth_buffer_id, FindDepthBuffer(is_clear)); | 327 | BindRenderTarget(&render_targets.depth_buffer_id, FindDepthBuffer()); |
| 328 | } | 328 | } |
| 329 | check_rescale(render_targets.depth_buffer_id, tmp_depth_image); | 329 | check_rescale(render_targets.depth_buffer_id, tmp_depth_image); |
| 330 | 330 | ||
| @@ -389,7 +389,7 @@ void TextureCache<P>::UpdateRenderTargets(bool is_clear) { | |||
| 389 | return; | 389 | return; |
| 390 | } | 390 | } |
| 391 | 391 | ||
| 392 | const bool rescaled = RescaleRenderTargets(is_clear); | 392 | const bool rescaled = RescaleRenderTargets(); |
| 393 | if (is_rescaling != rescaled) { | 393 | if (is_rescaling != rescaled) { |
| 394 | flags[Dirty::RescaleViewports] = true; | 394 | flags[Dirty::RescaleViewports] = true; |
| 395 | flags[Dirty::RescaleScissors] = true; | 395 | flags[Dirty::RescaleScissors] = true; |
| @@ -1658,7 +1658,7 @@ SamplerId TextureCache<P>::FindSampler(const TSCEntry& config) { | |||
| 1658 | } | 1658 | } |
| 1659 | 1659 | ||
| 1660 | template <class P> | 1660 | template <class P> |
| 1661 | ImageViewId TextureCache<P>::FindColorBuffer(size_t index, bool is_clear) { | 1661 | ImageViewId TextureCache<P>::FindColorBuffer(size_t index) { |
| 1662 | const auto& regs = maxwell3d->regs; | 1662 | const auto& regs = maxwell3d->regs; |
| 1663 | if (index >= regs.rt_control.count) { | 1663 | if (index >= regs.rt_control.count) { |
| 1664 | return ImageViewId{}; | 1664 | return ImageViewId{}; |
| @@ -1672,11 +1672,11 @@ ImageViewId TextureCache<P>::FindColorBuffer(size_t index, bool is_clear) { | |||
| 1672 | return ImageViewId{}; | 1672 | return ImageViewId{}; |
| 1673 | } | 1673 | } |
| 1674 | const ImageInfo info(regs.rt[index], regs.anti_alias_samples_mode); | 1674 | const ImageInfo info(regs.rt[index], regs.anti_alias_samples_mode); |
| 1675 | return FindRenderTargetView(info, gpu_addr, is_clear); | 1675 | return FindRenderTargetView(info, gpu_addr); |
| 1676 | } | 1676 | } |
| 1677 | 1677 | ||
| 1678 | template <class P> | 1678 | template <class P> |
| 1679 | ImageViewId TextureCache<P>::FindDepthBuffer(bool is_clear) { | 1679 | ImageViewId TextureCache<P>::FindDepthBuffer() { |
| 1680 | const auto& regs = maxwell3d->regs; | 1680 | const auto& regs = maxwell3d->regs; |
| 1681 | if (!regs.zeta_enable) { | 1681 | if (!regs.zeta_enable) { |
| 1682 | return ImageViewId{}; | 1682 | return ImageViewId{}; |
| @@ -1686,18 +1686,16 @@ ImageViewId TextureCache<P>::FindDepthBuffer(bool is_clear) { | |||
| 1686 | return ImageViewId{}; | 1686 | return ImageViewId{}; |
| 1687 | } | 1687 | } |
| 1688 | const ImageInfo info(regs.zeta, regs.zeta_size, regs.anti_alias_samples_mode); | 1688 | const ImageInfo info(regs.zeta, regs.zeta_size, regs.anti_alias_samples_mode); |
| 1689 | return FindRenderTargetView(info, gpu_addr, is_clear); | 1689 | return FindRenderTargetView(info, gpu_addr); |
| 1690 | } | 1690 | } |
| 1691 | 1691 | ||
| 1692 | template <class P> | 1692 | template <class P> |
| 1693 | ImageViewId TextureCache<P>::FindRenderTargetView(const ImageInfo& info, GPUVAddr gpu_addr, | 1693 | ImageViewId TextureCache<P>::FindRenderTargetView(const ImageInfo& info, GPUVAddr gpu_addr) { |
| 1694 | bool is_clear) { | ||
| 1695 | const auto options = is_clear ? RelaxedOptions::Samples : RelaxedOptions{}; | ||
| 1696 | ImageId image_id{}; | 1694 | ImageId image_id{}; |
| 1697 | bool delete_state = has_deleted_images; | 1695 | bool delete_state = has_deleted_images; |
| 1698 | do { | 1696 | do { |
| 1699 | has_deleted_images = false; | 1697 | has_deleted_images = false; |
| 1700 | image_id = FindOrInsertImage(info, gpu_addr, options); | 1698 | image_id = FindOrInsertImage(info, gpu_addr); |
| 1701 | delete_state |= has_deleted_images; | 1699 | delete_state |= has_deleted_images; |
| 1702 | } while (has_deleted_images); | 1700 | } while (has_deleted_images); |
| 1703 | has_deleted_images = delete_state; | 1701 | has_deleted_images = delete_state; |
diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h index 3bfa92154..c347eccd6 100644 --- a/src/video_core/texture_cache/texture_cache_base.h +++ b/src/video_core/texture_cache/texture_cache_base.h | |||
| @@ -166,9 +166,8 @@ public: | |||
| 166 | void SynchronizeComputeDescriptors(); | 166 | void SynchronizeComputeDescriptors(); |
| 167 | 167 | ||
| 168 | /// Updates the Render Targets if they can be rescaled | 168 | /// Updates the Render Targets if they can be rescaled |
| 169 | /// @param is_clear True when the render targets are being used for clears | ||
| 170 | /// @retval True if the Render Targets have been rescaled. | 169 | /// @retval True if the Render Targets have been rescaled. |
| 171 | bool RescaleRenderTargets(bool is_clear); | 170 | bool RescaleRenderTargets(); |
| 172 | 171 | ||
| 173 | /// Update bound render targets and upload memory if necessary | 172 | /// Update bound render targets and upload memory if necessary |
| 174 | /// @param is_clear True when the render targets are being used for clears | 173 | /// @param is_clear True when the render targets are being used for clears |
| @@ -324,14 +323,13 @@ private: | |||
| 324 | [[nodiscard]] SamplerId FindSampler(const TSCEntry& config); | 323 | [[nodiscard]] SamplerId FindSampler(const TSCEntry& config); |
| 325 | 324 | ||
| 326 | /// Find or create an image view for the given color buffer index | 325 | /// Find or create an image view for the given color buffer index |
| 327 | [[nodiscard]] ImageViewId FindColorBuffer(size_t index, bool is_clear); | 326 | [[nodiscard]] ImageViewId FindColorBuffer(size_t index); |
| 328 | 327 | ||
| 329 | /// Find or create an image view for the depth buffer | 328 | /// Find or create an image view for the depth buffer |
| 330 | [[nodiscard]] ImageViewId FindDepthBuffer(bool is_clear); | 329 | [[nodiscard]] ImageViewId FindDepthBuffer(); |
| 331 | 330 | ||
| 332 | /// Find or create a view for a render target with the given image parameters | 331 | /// Find or create a view for a render target with the given image parameters |
| 333 | [[nodiscard]] ImageViewId FindRenderTargetView(const ImageInfo& info, GPUVAddr gpu_addr, | 332 | [[nodiscard]] ImageViewId FindRenderTargetView(const ImageInfo& info, GPUVAddr gpu_addr); |
| 334 | bool is_clear); | ||
| 335 | 333 | ||
| 336 | /// Iterates over all the images in a region calling func | 334 | /// Iterates over all the images in a region calling func |
| 337 | template <typename Func> | 335 | template <typename Func> |