[vk] TextureType extended

This commit is contained in:
CamilleLaVey 2025-11-29 18:35:29 -04:00 committed by Caio Oliveira
parent 54b186ef34
commit 993a34273f
No known key found for this signature in database
GPG Key ID: AAAE6C7FD4186B0C
2 changed files with 11 additions and 3 deletions

View File

@ -2279,14 +2279,21 @@ VkImageView ImageView::StorageView(Shader::TextureType texture_type,
if (!image_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 ||
image_format == Shader::ImageFormat::R16_SINT};
if (!storage_views) {
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& view{views[static_cast<size_t>(texture_type)]};
if (view) {

View File

@ -274,6 +274,7 @@ private:
struct StorageViews {
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> typeless;
};
[[nodiscard]] Shader::TextureType BaseTextureType() const noexcept;