From f09cd52980724068a37fb99b1edd50e99d4d8703 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Thu, 16 Jan 2020 18:23:10 -0300 Subject: [PATCH] vk_texture_cache: Address feedback --- .../renderer_vulkan/vk_texture_cache.cpp | 17 ++++------------- .../renderer_vulkan/vk_texture_cache.h | 13 ++++--------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 24defeee9..51b0d38a6 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -242,10 +242,8 @@ View CachedSurface::CreateView(const ViewParams& params) { } View CachedSurface::CreateViewInner(const ViewParams& params, bool is_proxy) { - auto view = std::make_shared(device, *this, params, is_proxy); - views[params] = view; // TODO(Rodrigo): Add name decorations - return view; + return views[params] = std::make_shared(device, *this, params, is_proxy); } void CachedSurface::UploadBuffer(const std::vector& staging_buffer) { @@ -320,11 +318,8 @@ CachedSurfaceView::CachedSurfaceView(const VKDevice& device, CachedSurface& surf image{surface.GetImageHandle()}, buffer_view{surface.GetBufferViewHandle()}, aspect_mask{surface.GetAspectMask()}, device{device}, surface{surface}, base_layer{params.base_layer}, num_layers{params.num_layers}, base_level{params.base_level}, - num_levels{params.num_levels} { - if (image) { - image_view_type = GetImageViewType(params.target); - } -} + num_levels{params.num_levels}, image_view_type{image ? GetImageViewType(params.target) + : vk::ImageViewType{}} {} CachedSurfaceView::~CachedSurfaceView() = default; @@ -388,11 +383,6 @@ vk::ImageView CachedSurfaceView::GetHandle(SwizzleSource x_source, SwizzleSource return last_image_view = *image_view; } -bool CachedSurfaceView::IsOverlapping(const View& rhs) const { - // TODO(Rodrigo): Also test for layer and mip level overlaps. - return &surface == &rhs->surface; -} - VKTextureCache::VKTextureCache(Core::System& system, VideoCore::RasterizerInterface& rasterizer, const VKDevice& device, VKResourceManager& resource_manager, VKMemoryManager& memory_manager, VKScheduler& scheduler, @@ -479,6 +469,7 @@ void VKTextureCache::ImageBlit(View& src_view, View& dst_view, void VKTextureCache::BufferCopy(Surface& src_surface, Surface& dst_surface) { // Currently unimplemented. PBO copies should be dropped and we should use a render pass to // convert from color to depth and viceversa. + LOG_WARNING(Render_Vulkan, "Unimplemented"); } } // namespace Vulkan diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index 4bc330c9f..d3edbe80c 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h @@ -5,15 +5,10 @@ #pragma once #include -#include #include -#include -#include - #include "common/assert.h" #include "common/common_types.h" -#include "common/hash.h" #include "common/logging/log.h" #include "common/math_util.h" #include "video_core/gpu.h" @@ -22,11 +17,9 @@ #include "video_core/renderer_vulkan/vk_image.h" #include "video_core/renderer_vulkan/vk_memory_manager.h" #include "video_core/renderer_vulkan/vk_scheduler.h" -#include "video_core/surface.h" #include "video_core/texture_cache/surface_base.h" #include "video_core/texture_cache/texture_cache.h" #include "video_core/textures/decoders.h" -#include "video_core/textures/texture.h" namespace Core { class System; @@ -141,7 +134,9 @@ public: Tegra::Texture::SwizzleSource z_source, Tegra::Texture::SwizzleSource w_source); - bool IsOverlapping(const View& rhs) const; + bool IsSameSurface(const CachedSurfaceView& rhs) const { + return &surface == &rhs.surface; + } vk::ImageView GetHandle() { return GetHandle(Tegra::Texture::SwizzleSource::R, Tegra::Texture::SwizzleSource::G, @@ -207,7 +202,7 @@ private: const u32 num_layers; const u32 base_level; const u32 num_levels; - vk::ImageViewType image_view_type{}; + const vk::ImageViewType image_view_type; vk::ImageView last_image_view; u32 last_swizzle{};