1
0
Fork 0
forked from suyu/suyu

texture_cache: Add getter to query if image view is rescaled

This commit is contained in:
ReinUsesLisp 2021-07-31 17:42:37 -03:00 committed by Fernando Sahmkow
parent 526e47f148
commit c7a1cbad44
5 changed files with 12 additions and 22 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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) {

View file

@ -119,16 +119,6 @@ typename P::ImageView& TextureCache<P>::GetImageView(ImageViewId id) noexcept {
return slot_image_views[id];
}
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]);
@ -634,6 +624,12 @@ bool TextureCache<P>::IsRescaling() const noexcept {
return is_rescaling;
}
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;

View file

@ -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;