diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-07-31 22:42:37 +0200 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-11-16 22:11:29 +0100 |
commit | c7a1cbad44487b2c5f9da31ce6d3c76b7dec4f05 (patch) | |
tree | de6a0d7767ce12ee65846c53a18c2744ca636ec1 /src/video_core | |
parent | vk_rasterizer: Minor style change (diff) | |
download | yuzu-c7a1cbad44487b2c5f9da31ce6d3c76b7dec4f05.tar yuzu-c7a1cbad44487b2c5f9da31ce6d3c76b7dec4f05.tar.gz yuzu-c7a1cbad44487b2c5f9da31ce6d3c76b7dec4f05.tar.bz2 yuzu-c7a1cbad44487b2c5f9da31ce6d3c76b7dec4f05.tar.lz yuzu-c7a1cbad44487b2c5f9da31ce6d3c76b7dec4f05.tar.xz yuzu-c7a1cbad44487b2c5f9da31ce6d3c76b7dec4f05.tar.zst yuzu-c7a1cbad44487b2c5f9da31ce6d3c76b7dec4f05.zip |
Diffstat (limited to 'src/video_core')
5 files changed, 12 insertions, 22 deletions
diff --git a/src/video_core/renderer_opengl/gl_compute_pipeline.cpp b/src/video_core/renderer_opengl/gl_compute_pipeline.cpp index 12093c3c4..02853b078 100644 --- a/src/video_core/renderer_opengl/gl_compute_pipeline.cpp +++ b/src/video_core/renderer_opengl/gl_compute_pipeline.cpp @@ -186,8 +186,7 @@ void ComputePipeline::Configure() { for (u32 index = 0; index < desc.count; ++index) { ImageView& image_view{texture_cache.GetImageView((views_it++)->id)}; textures[texture_binding] = image_view.Handle(desc.type); - if (True(texture_cache.GetImage(image_view.image_id).flags & - VideoCommon::ImageFlagBits::Rescaled)) { + if (texture_cache.IsRescaling(image_view)) { scaling_mask |= 1u << texture_binding; } ++texture_binding; diff --git a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp index 01aa2897a..c3d549a6e 100644 --- a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp +++ b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp @@ -472,8 +472,7 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) { for (u32 index = 0; index < desc.count; ++index) { ImageView& image_view{texture_cache.GetImageView((views_it++)->id)}; textures[texture_binding] = image_view.Handle(desc.type); - if (True(texture_cache.GetImage(image_view.image_id).flags & - VideoCommon::ImageFlagBits::Rescaled)) { + if (texture_cache.IsRescaling(image_view)) { scaling_mask |= 1u << stage_texture_binding; } ++texture_binding; diff --git a/src/video_core/renderer_vulkan/pipeline_helper.h b/src/video_core/renderer_vulkan/pipeline_helper.h index bf18b34d1..bce4220c6 100644 --- a/src/video_core/renderer_vulkan/pipeline_helper.h +++ b/src/video_core/renderer_vulkan/pipeline_helper.h @@ -168,10 +168,9 @@ inline void PushImageDescriptors(TextureCache& texture_cache, const VideoCommon::ImageViewId image_view_id{(views++)->id}; const VkSampler sampler{*(samplers++)}; ImageView& image_view{texture_cache.GetImageView(image_view_id)}; - const Image& image{texture_cache.GetImage(image_view.image_id)}; const VkImageView vk_image_view{image_view.Handle(desc.type)}; update_descriptor_queue.AddSampledImage(vk_image_view, sampler); - rescaling.PushTexture(True(image.flags & VideoCommon::ImageFlagBits::Rescaled)); + rescaling.PushTexture(texture_cache.IsRescaling(image_view)); } } for (const auto& desc : info.image_descriptors) { diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 4dbded635..0e70c4db2 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -120,16 +120,6 @@ typename P::ImageView& TextureCache<P>::GetImageView(ImageViewId id) noexcept { } template <class P> -const typename P::Image& TextureCache<P>::GetImage(ImageId id) const noexcept { - return slot_images[id]; -} - -template <class P> -typename P::Image& TextureCache<P>::GetImage(ImageId id) noexcept { - return slot_images[id]; -} - -template <class P> void TextureCache<P>::MarkModification(ImageId id) noexcept { MarkModification(slot_images[id]); } @@ -635,6 +625,12 @@ bool TextureCache<P>::IsRescaling() const noexcept { } template <class P> +bool TextureCache<P>::IsRescaling(const ImageViewBase& image_view) const noexcept { + const ImageBase& image = slot_images[image_view.image_id]; + return True(image.flags & ImageFlagBits::Rescaled); +} + +template <class P> bool TextureCache<P>::IsRegionGpuModified(VAddr addr, size_t size) { bool is_modified = false; ForEachImageInRegion(addr, size, [&is_modified](ImageId, ImageBase& image) { diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h index b6cc09682..8b417b611 100644 --- a/src/video_core/texture_cache/texture_cache_base.h +++ b/src/video_core/texture_cache/texture_cache_base.h @@ -21,6 +21,7 @@ #include "video_core/texture_cache/descriptor_table.h" #include "video_core/texture_cache/image_base.h" #include "video_core/texture_cache/image_info.h" +#include "video_core/texture_cache/image_view_base.h" #include "video_core/texture_cache/image_view_info.h" #include "video_core/texture_cache/render_targets.h" #include "video_core/texture_cache/slot_vector.h" @@ -100,12 +101,6 @@ public: /// Return a reference to the given image view id [[nodiscard]] ImageView& GetImageView(ImageViewId id) noexcept; - /// Return a constant reference to the given image id - [[nodiscard]] const Image& GetImage(ImageId id) const noexcept; - - /// Return a reference to the given image id - [[nodiscard]] Image& GetImage(ImageId id) noexcept; - /// Mark an image as modified from the GPU void MarkModification(ImageId id) noexcept; @@ -181,6 +176,8 @@ public: [[nodiscard]] bool IsRescaling() const noexcept; + [[nodiscard]] bool IsRescaling(const ImageViewBase& image_view) const noexcept; + [[nodiscard]] bool BlackListImage(ImageId image_id); std::mutex mutex; |