1
0
Fork 0
forked from suyu/suyu

Merge pull request #12110 from liamwhite/mali-nullview

vk_texture_cache: add workaround for nullDescriptor on Mali
This commit is contained in:
liamwhite 2023-11-25 10:17:00 -05:00 committed by GitHub
commit 2993d3bb49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View file

@ -1785,8 +1785,22 @@ ImageView::ImageView(TextureCacheRuntime&, const VideoCommon::ImageInfo& info,
: VideoCommon::ImageViewBase{info, view_info, gpu_addr_}, : VideoCommon::ImageViewBase{info, view_info, gpu_addr_},
buffer_size{VideoCommon::CalculateGuestSizeInBytes(info)} {} buffer_size{VideoCommon::CalculateGuestSizeInBytes(info)} {}
ImageView::ImageView(TextureCacheRuntime&, const VideoCommon::NullImageViewParams& params) ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::NullImageViewParams& params)
: VideoCommon::ImageViewBase{params} {} : VideoCommon::ImageViewBase{params}, device{&runtime.device} {
if (device->HasNullDescriptor()) {
return;
}
// Handle fallback for devices without nullDescriptor
ImageInfo info{};
info.format = PixelFormat::A8B8G8R8_UNORM;
null_image = MakeImage(*device, runtime.memory_allocator, info, {});
image_handle = *null_image;
for (u32 i = 0; i < Shader::NUM_TEXTURE_TYPES; i++) {
image_views[i] = MakeView(VK_FORMAT_A8B8G8R8_UNORM_PACK32, VK_IMAGE_ASPECT_COLOR_BIT);
}
}
ImageView::~ImageView() = default; ImageView::~ImageView() = default;

View file

@ -267,6 +267,7 @@ private:
vk::ImageView depth_view; vk::ImageView depth_view;
vk::ImageView stencil_view; vk::ImageView stencil_view;
vk::ImageView color_view; vk::ImageView color_view;
vk::Image null_image;
VkImage image_handle = VK_NULL_HANDLE; VkImage image_handle = VK_NULL_HANDLE;
VkImageView render_target = VK_NULL_HANDLE; VkImageView render_target = VK_NULL_HANDLE;
VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT; VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT;