From 5105aef6846812e6390649353c54261304677190 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Thu, 4 Aug 2022 21:03:34 +0200 Subject: [PATCH] early-access version 2889 --- README.md | 2 +- .../renderer_opengl/gl_texture_cache.cpp | 5 +- .../renderer_opengl/gl_texture_cache.h | 5 +- .../renderer_vulkan/maxwell_to_vk.cpp | 432 ++++++++---------- .../renderer_vulkan/vk_texture_cache.cpp | 24 +- .../renderer_vulkan/vk_texture_cache.h | 2 +- src/video_core/texture_cache/texture_cache.h | 8 +- 7 files changed, 205 insertions(+), 273 deletions(-) diff --git a/README.md b/README.md index 0e9fa40b6..c549d9496 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 2888. +This is the source code for early-access 2889. ## Legal Notice diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 59c328cbc..8c0fffc67 100755 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -737,8 +737,7 @@ Image::Image(TextureCacheRuntime& runtime_, const VideoCommon::ImageInfo& info_, } } -Image::Image(TextureCacheRuntime&, const VideoCommon::NullImageParams& params) - : VideoCommon::ImageBase{params} {} +Image::Image(const VideoCommon::NullImageParams& params) : VideoCommon::ImageBase{params} {} Image::~Image() = default; @@ -1079,7 +1078,7 @@ bool Image::ScaleDown(bool ignore) { } ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewInfo& info, - ImageId image_id_, Image& image) + ImageId image_id_, Image& image, const SlotVector&) : VideoCommon::ImageViewBase{info, image.info, image_id_}, views{runtime.null_image_views} { const Device& device = runtime.device; if (True(image.flags & ImageFlagBits::Converted)) { diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h index 55db2d5a0..113528e9b 100755 --- a/src/video_core/renderer_opengl/gl_texture_cache.h +++ b/src/video_core/renderer_opengl/gl_texture_cache.h @@ -189,7 +189,7 @@ class Image : public VideoCommon::ImageBase { public: explicit Image(TextureCacheRuntime&, const VideoCommon::ImageInfo& info, GPUVAddr gpu_addr, VAddr cpu_addr); - explicit Image(TextureCacheRuntime&, const VideoCommon::NullImageParams&); + explicit Image(const VideoCommon::NullImageParams&); ~Image(); @@ -244,7 +244,8 @@ class ImageView : public VideoCommon::ImageViewBase { friend Image; public: - explicit ImageView(TextureCacheRuntime&, const VideoCommon::ImageViewInfo&, ImageId, Image&); + explicit ImageView(TextureCacheRuntime&, const VideoCommon::ImageViewInfo&, ImageId, Image&, + const SlotVector&); explicit ImageView(TextureCacheRuntime&, const VideoCommon::ImageInfo&, const VideoCommon::ImageViewInfo&, GPUVAddr); explicit ImageView(TextureCacheRuntime&, const VideoCommon::ImageInfo& info, diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp index 317f40d7c..3086a5b9b 100755 --- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp +++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp @@ -319,265 +319,195 @@ VkPrimitiveTopology PrimitiveTopology([[maybe_unused]] const Device& device, VkFormat VertexFormat(const Device& device, Maxwell::VertexAttribute::Type type, Maxwell::VertexAttribute::Size size) { - auto format = VK_FORMAT_UNDEFINED; - - switch (type) { - case Maxwell::VertexAttribute::Type::UnsignedNorm: - switch (size) { - case Maxwell::VertexAttribute::Size::Size_8: - format = VK_FORMAT_R8_UNORM; + const VkFormat format{([&]() { + switch (type) { + case Maxwell::VertexAttribute::Type::UnsignedNorm: + switch (size) { + case Maxwell::VertexAttribute::Size::Size_8: + return VK_FORMAT_R8_UNORM; + case Maxwell::VertexAttribute::Size::Size_8_8: + return VK_FORMAT_R8G8_UNORM; + case Maxwell::VertexAttribute::Size::Size_8_8_8: + return VK_FORMAT_R8G8B8_UNORM; + case Maxwell::VertexAttribute::Size::Size_8_8_8_8: + return VK_FORMAT_R8G8B8A8_UNORM; + case Maxwell::VertexAttribute::Size::Size_16: + return VK_FORMAT_R16_UNORM; + case Maxwell::VertexAttribute::Size::Size_16_16: + return VK_FORMAT_R16G16_UNORM; + case Maxwell::VertexAttribute::Size::Size_16_16_16: + return VK_FORMAT_R16G16B16_UNORM; + case Maxwell::VertexAttribute::Size::Size_16_16_16_16: + return VK_FORMAT_R16G16B16A16_UNORM; + case Maxwell::VertexAttribute::Size::Size_10_10_10_2: + return VK_FORMAT_A2B10G10R10_UNORM_PACK32; + default: + break; + } break; - case Maxwell::VertexAttribute::Size::Size_8_8: - format = VK_FORMAT_R8G8_UNORM; + case Maxwell::VertexAttribute::Type::SignedNorm: + switch (size) { + case Maxwell::VertexAttribute::Size::Size_8: + return VK_FORMAT_R8_SNORM; + case Maxwell::VertexAttribute::Size::Size_8_8: + return VK_FORMAT_R8G8_SNORM; + case Maxwell::VertexAttribute::Size::Size_8_8_8: + return VK_FORMAT_R8G8B8_SNORM; + case Maxwell::VertexAttribute::Size::Size_8_8_8_8: + return VK_FORMAT_R8G8B8A8_SNORM; + case Maxwell::VertexAttribute::Size::Size_16: + return VK_FORMAT_R16_SNORM; + case Maxwell::VertexAttribute::Size::Size_16_16: + return VK_FORMAT_R16G16_SNORM; + case Maxwell::VertexAttribute::Size::Size_16_16_16: + return VK_FORMAT_R16G16B16_SNORM; + case Maxwell::VertexAttribute::Size::Size_16_16_16_16: + return VK_FORMAT_R16G16B16A16_SNORM; + case Maxwell::VertexAttribute::Size::Size_10_10_10_2: + return VK_FORMAT_A2B10G10R10_SNORM_PACK32; + default: + break; + } break; - case Maxwell::VertexAttribute::Size::Size_8_8_8: - format = VK_FORMAT_R8G8B8_UNORM; + case Maxwell::VertexAttribute::Type::UnsignedScaled: + switch (size) { + case Maxwell::VertexAttribute::Size::Size_8: + return VK_FORMAT_R8_USCALED; + case Maxwell::VertexAttribute::Size::Size_8_8: + return VK_FORMAT_R8G8_USCALED; + case Maxwell::VertexAttribute::Size::Size_8_8_8: + return VK_FORMAT_R8G8B8_USCALED; + case Maxwell::VertexAttribute::Size::Size_8_8_8_8: + return VK_FORMAT_R8G8B8A8_USCALED; + case Maxwell::VertexAttribute::Size::Size_16: + return VK_FORMAT_R16_USCALED; + case Maxwell::VertexAttribute::Size::Size_16_16: + return VK_FORMAT_R16G16_USCALED; + case Maxwell::VertexAttribute::Size::Size_16_16_16: + return VK_FORMAT_R16G16B16_USCALED; + case Maxwell::VertexAttribute::Size::Size_16_16_16_16: + return VK_FORMAT_R16G16B16A16_USCALED; + case Maxwell::VertexAttribute::Size::Size_10_10_10_2: + return VK_FORMAT_A2B10G10R10_USCALED_PACK32; + default: + break; + } break; - case Maxwell::VertexAttribute::Size::Size_8_8_8_8: - format = VK_FORMAT_R8G8B8A8_UNORM; + case Maxwell::VertexAttribute::Type::SignedScaled: + switch (size) { + case Maxwell::VertexAttribute::Size::Size_8: + return VK_FORMAT_R8_SSCALED; + case Maxwell::VertexAttribute::Size::Size_8_8: + return VK_FORMAT_R8G8_SSCALED; + case Maxwell::VertexAttribute::Size::Size_8_8_8: + return VK_FORMAT_R8G8B8_SSCALED; + case Maxwell::VertexAttribute::Size::Size_8_8_8_8: + return VK_FORMAT_R8G8B8A8_SSCALED; + case Maxwell::VertexAttribute::Size::Size_16: + return VK_FORMAT_R16_SSCALED; + case Maxwell::VertexAttribute::Size::Size_16_16: + return VK_FORMAT_R16G16_SSCALED; + case Maxwell::VertexAttribute::Size::Size_16_16_16: + return VK_FORMAT_R16G16B16_SSCALED; + case Maxwell::VertexAttribute::Size::Size_16_16_16_16: + return VK_FORMAT_R16G16B16A16_SSCALED; + case Maxwell::VertexAttribute::Size::Size_10_10_10_2: + return VK_FORMAT_A2B10G10R10_SSCALED_PACK32; + default: + break; + } break; - case Maxwell::VertexAttribute::Size::Size_16: - format = VK_FORMAT_R16_UNORM; + case Maxwell::VertexAttribute::Type::UnsignedInt: + switch (size) { + case Maxwell::VertexAttribute::Size::Size_8: + return VK_FORMAT_R8_UINT; + case Maxwell::VertexAttribute::Size::Size_8_8: + return VK_FORMAT_R8G8_UINT; + case Maxwell::VertexAttribute::Size::Size_8_8_8: + return VK_FORMAT_R8G8B8_UINT; + case Maxwell::VertexAttribute::Size::Size_8_8_8_8: + return VK_FORMAT_R8G8B8A8_UINT; + case Maxwell::VertexAttribute::Size::Size_16: + return VK_FORMAT_R16_UINT; + case Maxwell::VertexAttribute::Size::Size_16_16: + return VK_FORMAT_R16G16_UINT; + case Maxwell::VertexAttribute::Size::Size_16_16_16: + return VK_FORMAT_R16G16B16_UINT; + case Maxwell::VertexAttribute::Size::Size_16_16_16_16: + return VK_FORMAT_R16G16B16A16_UINT; + case Maxwell::VertexAttribute::Size::Size_32: + return VK_FORMAT_R32_UINT; + case Maxwell::VertexAttribute::Size::Size_32_32: + return VK_FORMAT_R32G32_UINT; + case Maxwell::VertexAttribute::Size::Size_32_32_32: + return VK_FORMAT_R32G32B32_UINT; + case Maxwell::VertexAttribute::Size::Size_32_32_32_32: + return VK_FORMAT_R32G32B32A32_UINT; + case Maxwell::VertexAttribute::Size::Size_10_10_10_2: + return VK_FORMAT_A2B10G10R10_UINT_PACK32; + default: + break; + } break; - case Maxwell::VertexAttribute::Size::Size_16_16: - format = VK_FORMAT_R16G16_UNORM; + case Maxwell::VertexAttribute::Type::SignedInt: + switch (size) { + case Maxwell::VertexAttribute::Size::Size_8: + return VK_FORMAT_R8_SINT; + case Maxwell::VertexAttribute::Size::Size_8_8: + return VK_FORMAT_R8G8_SINT; + case Maxwell::VertexAttribute::Size::Size_8_8_8: + return VK_FORMAT_R8G8B8_SINT; + case Maxwell::VertexAttribute::Size::Size_8_8_8_8: + return VK_FORMAT_R8G8B8A8_SINT; + case Maxwell::VertexAttribute::Size::Size_16: + return VK_FORMAT_R16_SINT; + case Maxwell::VertexAttribute::Size::Size_16_16: + return VK_FORMAT_R16G16_SINT; + case Maxwell::VertexAttribute::Size::Size_16_16_16: + return VK_FORMAT_R16G16B16_SINT; + case Maxwell::VertexAttribute::Size::Size_16_16_16_16: + return VK_FORMAT_R16G16B16A16_SINT; + case Maxwell::VertexAttribute::Size::Size_32: + return VK_FORMAT_R32_SINT; + case Maxwell::VertexAttribute::Size::Size_32_32: + return VK_FORMAT_R32G32_SINT; + case Maxwell::VertexAttribute::Size::Size_32_32_32: + return VK_FORMAT_R32G32B32_SINT; + case Maxwell::VertexAttribute::Size::Size_32_32_32_32: + return VK_FORMAT_R32G32B32A32_SINT; + case Maxwell::VertexAttribute::Size::Size_10_10_10_2: + return VK_FORMAT_A2B10G10R10_SINT_PACK32; + default: + break; + } break; - case Maxwell::VertexAttribute::Size::Size_16_16_16: - format = VK_FORMAT_R16G16B16_UNORM; - break; - case Maxwell::VertexAttribute::Size::Size_16_16_16_16: - format = VK_FORMAT_R16G16B16A16_UNORM; - break; - case Maxwell::VertexAttribute::Size::Size_10_10_10_2: - format = VK_FORMAT_A2B10G10R10_UNORM_PACK32; - break; - default: + case Maxwell::VertexAttribute::Type::Float: + switch (size) { + case Maxwell::VertexAttribute::Size::Size_16: + return VK_FORMAT_R16_SFLOAT; + case Maxwell::VertexAttribute::Size::Size_16_16: + return VK_FORMAT_R16G16_SFLOAT; + case Maxwell::VertexAttribute::Size::Size_16_16_16: + return VK_FORMAT_R16G16B16_SFLOAT; + case Maxwell::VertexAttribute::Size::Size_16_16_16_16: + return VK_FORMAT_R16G16B16A16_SFLOAT; + case Maxwell::VertexAttribute::Size::Size_32: + return VK_FORMAT_R32_SFLOAT; + case Maxwell::VertexAttribute::Size::Size_32_32: + return VK_FORMAT_R32G32_SFLOAT; + case Maxwell::VertexAttribute::Size::Size_32_32_32: + return VK_FORMAT_R32G32B32_SFLOAT; + case Maxwell::VertexAttribute::Size::Size_32_32_32_32: + return VK_FORMAT_R32G32B32A32_SFLOAT; + case Maxwell::VertexAttribute::Size::Size_11_11_10: + return VK_FORMAT_B10G11R11_UFLOAT_PACK32; + default: + break; + } break; } - break; - case Maxwell::VertexAttribute::Type::SignedNorm: - switch (size) { - case Maxwell::VertexAttribute::Size::Size_8: - format = VK_FORMAT_R8_SNORM; - break; - case Maxwell::VertexAttribute::Size::Size_8_8: - format = VK_FORMAT_R8G8_SNORM; - break; - case Maxwell::VertexAttribute::Size::Size_8_8_8: - format = VK_FORMAT_R8G8B8_SNORM; - break; - case Maxwell::VertexAttribute::Size::Size_8_8_8_8: - format = VK_FORMAT_R8G8B8A8_SNORM; - break; - case Maxwell::VertexAttribute::Size::Size_16: - format = VK_FORMAT_R16_SNORM; - break; - case Maxwell::VertexAttribute::Size::Size_16_16: - format = VK_FORMAT_R16G16_SNORM; - break; - case Maxwell::VertexAttribute::Size::Size_16_16_16: - format = VK_FORMAT_R16G16B16_SNORM; - break; - case Maxwell::VertexAttribute::Size::Size_16_16_16_16: - format = VK_FORMAT_R16G16B16A16_SNORM; - break; - case Maxwell::VertexAttribute::Size::Size_10_10_10_2: - format = VK_FORMAT_A2B10G10R10_SNORM_PACK32; - break; - default: - break; - } - break; - case Maxwell::VertexAttribute::Type::UnsignedScaled: - switch (size) { - case Maxwell::VertexAttribute::Size::Size_8: - format = VK_FORMAT_R8_USCALED; - break; - case Maxwell::VertexAttribute::Size::Size_8_8: - format = VK_FORMAT_R8G8_USCALED; - break; - case Maxwell::VertexAttribute::Size::Size_8_8_8: - format = VK_FORMAT_R8G8B8_USCALED; - break; - case Maxwell::VertexAttribute::Size::Size_8_8_8_8: - format = VK_FORMAT_R8G8B8A8_USCALED; - break; - case Maxwell::VertexAttribute::Size::Size_16: - format = VK_FORMAT_R16_USCALED; - break; - case Maxwell::VertexAttribute::Size::Size_16_16: - format = VK_FORMAT_R16G16_USCALED; - break; - case Maxwell::VertexAttribute::Size::Size_16_16_16: - format = VK_FORMAT_R16G16B16_USCALED; - break; - case Maxwell::VertexAttribute::Size::Size_16_16_16_16: - format = VK_FORMAT_R16G16B16A16_USCALED; - break; - case Maxwell::VertexAttribute::Size::Size_10_10_10_2: - format = VK_FORMAT_A2B10G10R10_USCALED_PACK32; - break; - default: - break; - } - break; - case Maxwell::VertexAttribute::Type::SignedScaled: - switch (size) { - case Maxwell::VertexAttribute::Size::Size_8: - format = VK_FORMAT_R8_SSCALED; - break; - case Maxwell::VertexAttribute::Size::Size_8_8: - format = VK_FORMAT_R8G8_SSCALED; - break; - case Maxwell::VertexAttribute::Size::Size_8_8_8: - format = VK_FORMAT_R8G8B8_SSCALED; - break; - case Maxwell::VertexAttribute::Size::Size_8_8_8_8: - format = VK_FORMAT_R8G8B8A8_SSCALED; - break; - case Maxwell::VertexAttribute::Size::Size_16: - format = VK_FORMAT_R16_SSCALED; - break; - case Maxwell::VertexAttribute::Size::Size_16_16: - format = VK_FORMAT_R16G16_SSCALED; - break; - case Maxwell::VertexAttribute::Size::Size_16_16_16: - format = VK_FORMAT_R16G16B16_SSCALED; - break; - case Maxwell::VertexAttribute::Size::Size_16_16_16_16: - format = VK_FORMAT_R16G16B16A16_SSCALED; - break; - case Maxwell::VertexAttribute::Size::Size_10_10_10_2: - format = VK_FORMAT_A2B10G10R10_SSCALED_PACK32; - break; - default: - break; - } - break; - case Maxwell::VertexAttribute::Type::UnsignedInt: - switch (size) { - case Maxwell::VertexAttribute::Size::Size_8: - format = VK_FORMAT_R8_UINT; - break; - case Maxwell::VertexAttribute::Size::Size_8_8: - format = VK_FORMAT_R8G8_UINT; - break; - case Maxwell::VertexAttribute::Size::Size_8_8_8: - format = VK_FORMAT_R8G8B8_UINT; - break; - case Maxwell::VertexAttribute::Size::Size_8_8_8_8: - format = VK_FORMAT_R8G8B8A8_UINT; - break; - case Maxwell::VertexAttribute::Size::Size_16: - format = VK_FORMAT_R16_UINT; - break; - case Maxwell::VertexAttribute::Size::Size_16_16: - format = VK_FORMAT_R16G16_UINT; - break; - case Maxwell::VertexAttribute::Size::Size_16_16_16: - format = VK_FORMAT_R16G16B16_UINT; - break; - case Maxwell::VertexAttribute::Size::Size_16_16_16_16: - format = VK_FORMAT_R16G16B16A16_UINT; - break; - case Maxwell::VertexAttribute::Size::Size_32: - format = VK_FORMAT_R32_UINT; - break; - case Maxwell::VertexAttribute::Size::Size_32_32: - format = VK_FORMAT_R32G32_UINT; - break; - case Maxwell::VertexAttribute::Size::Size_32_32_32: - format = VK_FORMAT_R32G32B32_UINT; - break; - case Maxwell::VertexAttribute::Size::Size_32_32_32_32: - format = VK_FORMAT_R32G32B32A32_UINT; - break; - case Maxwell::VertexAttribute::Size::Size_10_10_10_2: - format = VK_FORMAT_A2B10G10R10_UINT_PACK32; - break; - default: - break; - } - break; - case Maxwell::VertexAttribute::Type::SignedInt: - switch (size) { - case Maxwell::VertexAttribute::Size::Size_8: - format = VK_FORMAT_R8_SINT; - break; - case Maxwell::VertexAttribute::Size::Size_8_8: - format = VK_FORMAT_R8G8_SINT; - break; - case Maxwell::VertexAttribute::Size::Size_8_8_8: - format = VK_FORMAT_R8G8B8_SINT; - break; - case Maxwell::VertexAttribute::Size::Size_8_8_8_8: - format = VK_FORMAT_R8G8B8A8_SINT; - break; - case Maxwell::VertexAttribute::Size::Size_16: - format = VK_FORMAT_R16_SINT; - break; - case Maxwell::VertexAttribute::Size::Size_16_16: - format = VK_FORMAT_R16G16_SINT; - break; - case Maxwell::VertexAttribute::Size::Size_16_16_16: - format = VK_FORMAT_R16G16B16_SINT; - break; - case Maxwell::VertexAttribute::Size::Size_16_16_16_16: - format = VK_FORMAT_R16G16B16A16_SINT; - break; - case Maxwell::VertexAttribute::Size::Size_32: - format = VK_FORMAT_R32_SINT; - break; - case Maxwell::VertexAttribute::Size::Size_32_32: - format = VK_FORMAT_R32G32_SINT; - break; - case Maxwell::VertexAttribute::Size::Size_32_32_32: - format = VK_FORMAT_R32G32B32_SINT; - break; - case Maxwell::VertexAttribute::Size::Size_32_32_32_32: - format = VK_FORMAT_R32G32B32A32_SINT; - break; - case Maxwell::VertexAttribute::Size::Size_10_10_10_2: - format = VK_FORMAT_A2B10G10R10_SINT_PACK32; - break; - default: - break; - } - break; - case Maxwell::VertexAttribute::Type::Float: - switch (size) { - case Maxwell::VertexAttribute::Size::Size_16: - format = VK_FORMAT_R16_SFLOAT; - break; - case Maxwell::VertexAttribute::Size::Size_16_16: - format = VK_FORMAT_R16G16_SFLOAT; - break; - case Maxwell::VertexAttribute::Size::Size_16_16_16: - format = VK_FORMAT_R16G16B16_SFLOAT; - break; - case Maxwell::VertexAttribute::Size::Size_16_16_16_16: - format = VK_FORMAT_R16G16B16A16_SFLOAT; - break; - case Maxwell::VertexAttribute::Size::Size_32: - format = VK_FORMAT_R32_SFLOAT; - break; - case Maxwell::VertexAttribute::Size::Size_32_32: - format = VK_FORMAT_R32G32_SFLOAT; - break; - case Maxwell::VertexAttribute::Size::Size_32_32_32: - format = VK_FORMAT_R32G32B32_SFLOAT; - break; - case Maxwell::VertexAttribute::Size::Size_32_32_32_32: - format = VK_FORMAT_R32G32B32A32_SFLOAT; - break; - case Maxwell::VertexAttribute::Size::Size_11_11_10: - format = VK_FORMAT_B10G11R11_UFLOAT_PACK32; - break; - default: - break; - } - break; - } + return VK_FORMAT_UNDEFINED; + })()}; if (format == VK_FORMAT_UNDEFINED) { UNIMPLEMENTED_MSG("Unimplemented vertex format of type={} and size={}", type, size); diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 87f29ee88..3b1ad1932 100755 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -1287,17 +1287,7 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu } } -Image::Image(TextureCacheRuntime& runtime_, const VideoCommon::NullImageParams& params) - : VideoCommon::ImageBase(params), scheduler{&runtime_.scheduler}, runtime{&runtime_} { - info.format = PixelFormat::A8B8G8R8_UNORM; - original_image = MakeImage(runtime_.device, info); - aspect_mask = ImageAspectMask(info.format); - commit = runtime_.memory_allocator.Commit(original_image, MemoryUsage::DeviceLocal); - if (runtime->device.HasDebuggingToolAttached()) { - original_image.SetObjectNameEXT("NullImage"); - } - current_image = *original_image; -} +Image::Image(const VideoCommon::NullImageParams& params) : VideoCommon::ImageBase{params} {} Image::~Image() = default; @@ -1630,6 +1620,9 @@ ImageView::ImageView(TextureCacheRuntime&, const VideoCommon::NullImageViewParam ImageView::~ImageView() = default; VkImageView ImageView::DepthView() { + if (!image_handle) { + return VK_NULL_HANDLE; + } if (depth_view) { return *depth_view; } @@ -1639,6 +1632,9 @@ VkImageView ImageView::DepthView() { } VkImageView ImageView::StencilView() { + if (!image_handle) { + return VK_NULL_HANDLE; + } if (stencil_view) { return *stencil_view; } @@ -1648,6 +1644,9 @@ VkImageView ImageView::StencilView() { } VkImageView ImageView::ColorView() { + if (!image_handle) { + return VK_NULL_HANDLE; + } if (color_view) { return *color_view; } @@ -1657,6 +1656,9 @@ VkImageView ImageView::ColorView() { VkImageView ImageView::StorageView(Shader::TextureType texture_type, Shader::ImageFormat image_format) { + if (!image_handle) { + return VK_NULL_HANDLE; + } if (image_format == Shader::ImageFormat::Typeless) { return Handle(texture_type); } diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index 320a053f3..0b7ac0df1 100755 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h @@ -110,7 +110,7 @@ class Image : public VideoCommon::ImageBase { public: explicit Image(TextureCacheRuntime&, const VideoCommon::ImageInfo& info, GPUVAddr gpu_addr, VAddr cpu_addr); - explicit Image(TextureCacheRuntime&, const VideoCommon::NullImageParams&); + explicit Image(const VideoCommon::NullImageParams&); ~Image(); diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 9d4b7c411..c85869dd0 100755 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -41,9 +41,8 @@ TextureCache

::TextureCache(Runtime& runtime_, VideoCore::RasterizerInterface& // Make sure the first index is reserved for the null resources // This way the null resource becomes a compile time constant - void(slot_images.insert(runtime, NullImageParams{})); - void(slot_image_views.insert(runtime, ImageViewInfo{}, NULL_IMAGE_ID, - slot_images[NULL_IMAGE_ID])); + void(slot_images.insert(NullImageParams{})); + void(slot_image_views.insert(runtime, NullImageViewParams{})); void(slot_samplers.insert(runtime, sampler_descriptor)); if constexpr (HAS_DEVICE_MEMORY_INFO) { @@ -1444,7 +1443,8 @@ ImageViewId TextureCache

::FindOrEmplaceImageView(ImageId image_id, const Imag if (const ImageViewId image_view_id = image.FindView(info); image_view_id) { return image_view_id; } - const ImageViewId image_view_id = slot_image_views.insert(runtime, info, image_id, image); + const ImageViewId image_view_id = + slot_image_views.insert(runtime, info, image_id, image, slot_images); image.InsertView(info, image_view_id); return image_view_id; }