summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-12-28 09:46:37 +0100
committerGitHub <noreply@github.com>2021-12-28 09:46:37 +0100
commitf67605e6aa5ec3a5e7a7e44ab30a24991bac6e6d (patch)
treea14f73749158e0ad38e99d0c222d401441376911 /src/video_core/renderer_vulkan
parentMerge pull request #7621 from bunnei/set-mem-perm (diff)
parentvk_texture_cache: Fix invalidated pointer access (diff)
downloadyuzu-f67605e6aa5ec3a5e7a7e44ab30a24991bac6e6d.tar
yuzu-f67605e6aa5ec3a5e7a7e44ab30a24991bac6e6d.tar.gz
yuzu-f67605e6aa5ec3a5e7a7e44ab30a24991bac6e6d.tar.bz2
yuzu-f67605e6aa5ec3a5e7a7e44ab30a24991bac6e6d.tar.lz
yuzu-f67605e6aa5ec3a5e7a7e44ab30a24991bac6e6d.tar.xz
yuzu-f67605e6aa5ec3a5e7a7e44ab30a24991bac6e6d.tar.zst
yuzu-f67605e6aa5ec3a5e7a7e44ab30a24991bac6e6d.zip
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/vk_texture_cache.cpp15
-rw-r--r--src/video_core/renderer_vulkan/vk_texture_cache.h5
2 files changed, 15 insertions, 5 deletions
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
index 1941170cb..c3050887c 100644
--- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
@@ -1473,8 +1473,7 @@ bool Image::BlitScaleHelper(bool scale_up) {
ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewInfo& info,
ImageId image_id_, Image& image)
: VideoCommon::ImageViewBase{info, image.info, image_id_}, device{&runtime.device},
- src_image{&image}, image_handle{image.Handle()},
- samples(ConvertSampleCount(image.info.num_samples)) {
+ image_handle{image.Handle()}, samples(ConvertSampleCount(image.info.num_samples)) {
using Shader::TextureType;
const VkImageAspectFlags aspect_mask = ImageViewAspectMask(info);
@@ -1557,6 +1556,12 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI
}
}
+ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewInfo& info,
+ ImageId image_id_, Image& image, const SlotVector<Image>& slot_imgs)
+ : ImageView{runtime, info, image_id_, image} {
+ slot_images = &slot_imgs;
+}
+
ImageView::ImageView(TextureCacheRuntime&, const VideoCommon::ImageInfo& info,
const VideoCommon::ImageViewInfo& view_info, GPUVAddr gpu_addr_)
: VideoCommon::ImageViewBase{info, view_info}, gpu_addr{gpu_addr_},
@@ -1613,10 +1618,12 @@ VkImageView ImageView::StorageView(Shader::TextureType texture_type,
}
bool ImageView::IsRescaled() const noexcept {
- if (!src_image) {
+ if (!slot_images) {
return false;
}
- return src_image->IsRescaled();
+ const auto& slots = *slot_images;
+ const auto& src_image = slots[image_id];
+ return src_image.IsRescaled();
}
vk::ImageView ImageView::MakeView(VkFormat vk_format, VkImageAspectFlags aspect_mask) {
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h
index c592f2666..2f12be78b 100644
--- a/src/video_core/renderer_vulkan/vk_texture_cache.h
+++ b/src/video_core/renderer_vulkan/vk_texture_cache.h
@@ -23,6 +23,7 @@ using VideoCommon::ImageId;
using VideoCommon::NUM_RT;
using VideoCommon::Region2D;
using VideoCommon::RenderTargets;
+using VideoCommon::SlotVector;
using VideoCore::Surface::PixelFormat;
class ASTCDecoderPass;
@@ -170,6 +171,8 @@ private:
class ImageView : public VideoCommon::ImageViewBase {
public:
explicit ImageView(TextureCacheRuntime&, const VideoCommon::ImageViewInfo&, ImageId, Image&);
+ explicit ImageView(TextureCacheRuntime&, const VideoCommon::ImageViewInfo&, ImageId, Image&,
+ const SlotVector<Image>&);
explicit ImageView(TextureCacheRuntime&, const VideoCommon::ImageInfo&,
const VideoCommon::ImageViewInfo&, GPUVAddr);
explicit ImageView(TextureCacheRuntime&, const VideoCommon::NullImageViewParams&);
@@ -226,7 +229,7 @@ private:
[[nodiscard]] vk::ImageView MakeView(VkFormat vk_format, VkImageAspectFlags aspect_mask);
const Device* device = nullptr;
- const Image* src_image{};
+ const SlotVector<Image>* slot_images = nullptr;
std::array<vk::ImageView, Shader::NUM_TEXTURE_TYPES> image_views;
std::unique_ptr<StorageViews> storage_views;