yuzu-emu
/
yuzu
Archived
1
0
Fork 0

vk_texture_cache: Address feedback

This commit is contained in:
ReinUsesLisp 2020-01-16 18:23:10 -03:00
parent 82e1285c1e
commit f09cd52980
2 changed files with 8 additions and 22 deletions

View File

@ -242,10 +242,8 @@ View CachedSurface::CreateView(const ViewParams& params) {
} }
View CachedSurface::CreateViewInner(const ViewParams& params, bool is_proxy) { View CachedSurface::CreateViewInner(const ViewParams& params, bool is_proxy) {
auto view = std::make_shared<CachedSurfaceView>(device, *this, params, is_proxy);
views[params] = view;
// TODO(Rodrigo): Add name decorations // TODO(Rodrigo): Add name decorations
return view; return views[params] = std::make_shared<CachedSurfaceView>(device, *this, params, is_proxy);
} }
void CachedSurface::UploadBuffer(const std::vector<u8>& staging_buffer) { void CachedSurface::UploadBuffer(const std::vector<u8>& staging_buffer) {
@ -320,11 +318,8 @@ CachedSurfaceView::CachedSurfaceView(const VKDevice& device, CachedSurface& surf
image{surface.GetImageHandle()}, buffer_view{surface.GetBufferViewHandle()}, image{surface.GetImageHandle()}, buffer_view{surface.GetBufferViewHandle()},
aspect_mask{surface.GetAspectMask()}, device{device}, surface{surface}, aspect_mask{surface.GetAspectMask()}, device{device}, surface{surface},
base_layer{params.base_layer}, num_layers{params.num_layers}, base_level{params.base_level}, base_layer{params.base_layer}, num_layers{params.num_layers}, base_level{params.base_level},
num_levels{params.num_levels} { num_levels{params.num_levels}, image_view_type{image ? GetImageViewType(params.target)
if (image) { : vk::ImageViewType{}} {}
image_view_type = GetImageViewType(params.target);
}
}
CachedSurfaceView::~CachedSurfaceView() = default; CachedSurfaceView::~CachedSurfaceView() = default;
@ -388,11 +383,6 @@ vk::ImageView CachedSurfaceView::GetHandle(SwizzleSource x_source, SwizzleSource
return last_image_view = *image_view; 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, VKTextureCache::VKTextureCache(Core::System& system, VideoCore::RasterizerInterface& rasterizer,
const VKDevice& device, VKResourceManager& resource_manager, const VKDevice& device, VKResourceManager& resource_manager,
VKMemoryManager& memory_manager, VKScheduler& scheduler, 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) { void VKTextureCache::BufferCopy(Surface& src_surface, Surface& dst_surface) {
// Currently unimplemented. PBO copies should be dropped and we should use a render pass to // Currently unimplemented. PBO copies should be dropped and we should use a render pass to
// convert from color to depth and viceversa. // convert from color to depth and viceversa.
LOG_WARNING(Render_Vulkan, "Unimplemented");
} }
} // namespace Vulkan } // namespace Vulkan

View File

@ -5,15 +5,10 @@
#pragma once #pragma once
#include <memory> #include <memory>
#include <tuple>
#include <unordered_map> #include <unordered_map>
#include <boost/functional/hash.hpp>
#include <boost/icl/interval_map.hpp>
#include "common/assert.h" #include "common/assert.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/hash.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/math_util.h" #include "common/math_util.h"
#include "video_core/gpu.h" #include "video_core/gpu.h"
@ -22,11 +17,9 @@
#include "video_core/renderer_vulkan/vk_image.h" #include "video_core/renderer_vulkan/vk_image.h"
#include "video_core/renderer_vulkan/vk_memory_manager.h" #include "video_core/renderer_vulkan/vk_memory_manager.h"
#include "video_core/renderer_vulkan/vk_scheduler.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/surface_base.h"
#include "video_core/texture_cache/texture_cache.h" #include "video_core/texture_cache/texture_cache.h"
#include "video_core/textures/decoders.h" #include "video_core/textures/decoders.h"
#include "video_core/textures/texture.h"
namespace Core { namespace Core {
class System; class System;
@ -141,7 +134,9 @@ public:
Tegra::Texture::SwizzleSource z_source, Tegra::Texture::SwizzleSource z_source,
Tegra::Texture::SwizzleSource w_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() { vk::ImageView GetHandle() {
return GetHandle(Tegra::Texture::SwizzleSource::R, Tegra::Texture::SwizzleSource::G, return GetHandle(Tegra::Texture::SwizzleSource::R, Tegra::Texture::SwizzleSource::G,
@ -207,7 +202,7 @@ private:
const u32 num_layers; const u32 num_layers;
const u32 base_level; const u32 base_level;
const u32 num_levels; const u32 num_levels;
vk::ImageViewType image_view_type{}; const vk::ImageViewType image_view_type;
vk::ImageView last_image_view; vk::ImageView last_image_view;
u32 last_swizzle{}; u32 last_swizzle{};