diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-07-28 07:47:06 +0200 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-11-16 22:11:28 +0100 |
commit | 56ccda1d9952368d0c1e29d7c4b486c547de9549 (patch) | |
tree | b2064ced92ef5ee0f4a67169df10462414664db9 /src/video_core/texture_cache/texture_cache.h | |
parent | Vulkan: Fix downscaling Blit. (diff) | |
download | yuzu-56ccda1d9952368d0c1e29d7c4b486c547de9549.tar yuzu-56ccda1d9952368d0c1e29d7c4b486c547de9549.tar.gz yuzu-56ccda1d9952368d0c1e29d7c4b486c547de9549.tar.bz2 yuzu-56ccda1d9952368d0c1e29d7c4b486c547de9549.tar.lz yuzu-56ccda1d9952368d0c1e29d7c4b486c547de9549.tar.xz yuzu-56ccda1d9952368d0c1e29d7c4b486c547de9549.tar.zst yuzu-56ccda1d9952368d0c1e29d7c4b486c547de9549.zip |
Diffstat (limited to 'src/video_core/texture_cache/texture_cache.h')
-rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index be40f6b88..4e97a9e6a 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -36,7 +36,6 @@ TextureCache<P>::TextureCache(Runtime& runtime_, VideoCore::RasterizerInterface& Tegra::MemoryManager& gpu_memory_) : runtime{runtime_}, rasterizer{rasterizer_}, maxwell3d{maxwell3d_}, kepler_compute{kepler_compute_}, gpu_memory{gpu_memory_} { - runtime.Init(); // Configure null sampler TSCEntry sampler_descriptor{}; sampler_descriptor.min_filter.Assign(Tegra::Texture::TextureFilter::Linear); @@ -46,7 +45,8 @@ TextureCache<P>::TextureCache(Runtime& runtime_, VideoCore::RasterizerInterface& // Make sure the first index is reserved for the null resources // This way the null resource becomes a compile time constant - void(slot_image_views.insert(runtime, NullImageParams{})); + void(slot_images.insert(NullImageParams{})); + void(slot_image_views.insert(runtime, NullImageViewParams{})); void(slot_samplers.insert(runtime, sampler_descriptor)); if constexpr (HAS_DEVICE_MEMORY_INFO) { @@ -57,7 +57,7 @@ TextureCache<P>::TextureCache(Runtime& runtime_, VideoCore::RasterizerInterface& critical_memory = std::max(possible_critical_memory, DEFAULT_CRITICAL_MEMORY); minimum_memory = 0; } else { - // on OGL we can be more conservatives as the driver takes care. + // On OpenGL we can be more conservatives as the driver takes care. expected_memory = DEFAULT_EXPECTED_MEMORY + 512_MiB; critical_memory = DEFAULT_CRITICAL_MEMORY + 1_GiB; minimum_memory = expected_memory; @@ -135,15 +135,14 @@ void TextureCache<P>::MarkModification(ImageId id) noexcept { } template <class P> -void TextureCache<P>::FillGraphicsImageViews(std::span<const u32> indices, - std::span<ImageViewId> image_view_ids) { - FillImageViews(graphics_image_table, graphics_image_view_ids, indices, image_view_ids); +template <bool has_blacklists> +void TextureCache<P>::FillGraphicsImageViews(std::span<ImageViewInOut> views) { + FillImageViews<has_blacklists>(graphics_image_table, graphics_image_view_ids, views); } template <class P> -void TextureCache<P>::FillComputeImageViews(std::span<const u32> indices, - std::span<ImageViewId> image_view_ids) { - FillImageViews(compute_image_table, compute_image_view_ids, indices, image_view_ids); +void TextureCache<P>::FillComputeImageViews(std::span<ImageViewInOut> views) { + FillImageViews<false>(compute_image_table, compute_image_view_ids, views); } template <class P> @@ -346,17 +345,26 @@ typename P::Framebuffer* TextureCache<P>::GetFramebuffer() { } template <class P> +template <bool has_blacklists> void TextureCache<P>::FillImageViews(DescriptorTable<TICEntry>& table, std::span<ImageViewId> cached_image_view_ids, - std::span<const u32> indices, - std::span<ImageViewId> image_view_ids) { - ASSERT(indices.size() <= image_view_ids.size()); + std::span<ImageViewInOut> views) { + bool has_blacklisted; do { has_deleted_images = false; - std::ranges::transform(indices, image_view_ids.begin(), [&](u32 index) { - return VisitImageView(table, cached_image_view_ids, index); - }); - } while (has_deleted_images); + if constexpr (has_blacklists) { + has_blacklisted = false; + } + for (ImageViewInOut& view : views) { + view.id = VisitImageView(table, cached_image_view_ids, view.index); + if constexpr (has_blacklists) { + if (view.blacklist && view.id != NULL_IMAGE_VIEW_ID) { + const ImageViewBase& image_view{slot_image_views[view.id]}; + has_blacklisted |= BlackListImage(image_view.image_id); + } + } + } + } while (has_deleted_images || (has_blacklists && has_blacklisted)); } template <class P> @@ -622,7 +630,7 @@ void TextureCache<P>::PopAsyncFlushes() { } template <class P> -bool TextureCache<P>::IsRescaling() { +bool TextureCache<P>::IsRescaling() const noexcept { return is_rescaling; } @@ -775,12 +783,11 @@ bool TextureCache<P>::BlackListImage(ImageId image_id) { } template <class P> -bool TextureCache<P>::ImageCanRescale(Image& image) { +bool TextureCache<P>::ImageCanRescale(ImageBase& image) { if (True(image.flags & ImageFlagBits::Blacklisted)) { return false; } - if (True(image.flags & ImageFlagBits::Rescaled) || - True(image.flags & ImageFlagBits::RescaleChecked)) { + if (True(image.flags & (ImageFlagBits::Rescaled | ImageFlagBits::RescaleChecked))) { return true; } if (!image.info.rescaleable) { |