CamilleLaVey
3 weeks ago
committed by
Caio Oliveira
No known key found for this signature in database
GPG Key ID: AAAE6C7FD4186B0C
2 changed files with
11 additions and
3 deletions
-
src/video_core/renderer_vulkan/vk_texture_cache.cpp
-
src/video_core/renderer_vulkan/vk_texture_cache.h
|
|
@ -2279,14 +2279,21 @@ VkImageView ImageView::StorageView(Shader::TextureType texture_type, |
|
|
if (!image_handle) { |
|
|
if (!image_handle) { |
|
|
return VK_NULL_HANDLE; |
|
|
return VK_NULL_HANDLE; |
|
|
} |
|
|
} |
|
|
if (image_format == Shader::ImageFormat::Typeless) { |
|
|
|
|
|
return Handle(texture_type); |
|
|
|
|
|
} |
|
|
|
|
|
const bool is_signed{image_format == Shader::ImageFormat::R8_SINT || |
|
|
const bool is_signed{image_format == Shader::ImageFormat::R8_SINT || |
|
|
image_format == Shader::ImageFormat::R16_SINT}; |
|
|
image_format == Shader::ImageFormat::R16_SINT}; |
|
|
if (!storage_views) { |
|
|
if (!storage_views) { |
|
|
storage_views = std::make_unique<StorageViews>(); |
|
|
storage_views = std::make_unique<StorageViews>(); |
|
|
} |
|
|
} |
|
|
|
|
|
if (image_format == Shader::ImageFormat::Typeless) { |
|
|
|
|
|
auto& view = storage_views->typeless[static_cast<size_t>(texture_type)]; |
|
|
|
|
|
if (view) { |
|
|
|
|
|
return *view; |
|
|
|
|
|
} |
|
|
|
|
|
const auto& format_info = |
|
|
|
|
|
MaxwellToVK::SurfaceFormat(*device, FormatType::Optimal, true, format); |
|
|
|
|
|
view = MakeView(format_info.format, VK_IMAGE_ASPECT_COLOR_BIT, texture_type); |
|
|
|
|
|
return *view; |
|
|
|
|
|
} |
|
|
auto& views{is_signed ? storage_views->signeds : storage_views->unsigneds}; |
|
|
auto& views{is_signed ? storage_views->signeds : storage_views->unsigneds}; |
|
|
auto& view{views[static_cast<size_t>(texture_type)]}; |
|
|
auto& view{views[static_cast<size_t>(texture_type)]}; |
|
|
if (view) { |
|
|
if (view) { |
|
|
|
|
|
@ -274,6 +274,7 @@ private: |
|
|
struct StorageViews { |
|
|
struct StorageViews { |
|
|
std::array<vk::ImageView, Shader::NUM_TEXTURE_TYPES> signeds; |
|
|
std::array<vk::ImageView, Shader::NUM_TEXTURE_TYPES> signeds; |
|
|
std::array<vk::ImageView, Shader::NUM_TEXTURE_TYPES> unsigneds; |
|
|
std::array<vk::ImageView, Shader::NUM_TEXTURE_TYPES> unsigneds; |
|
|
|
|
|
std::array<vk::ImageView, Shader::NUM_TEXTURE_TYPES> typeless; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
[[nodiscard]] Shader::TextureType BaseTextureType() const noexcept; |
|
|
[[nodiscard]] Shader::TextureType BaseTextureType() const noexcept; |
|
|
|