early-access version 2889

This commit is contained in:
pineappleEA 2022-08-04 21:03:34 +02:00
parent 4d812d4e3b
commit 5105aef684
7 changed files with 205 additions and 273 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 2888. This is the source code for early-access 2889.
## Legal Notice ## Legal Notice

View file

@ -737,8 +737,7 @@ Image::Image(TextureCacheRuntime& runtime_, const VideoCommon::ImageInfo& info_,
} }
} }
Image::Image(TextureCacheRuntime&, const VideoCommon::NullImageParams& params) Image::Image(const VideoCommon::NullImageParams& params) : VideoCommon::ImageBase{params} {}
: VideoCommon::ImageBase{params} {}
Image::~Image() = default; Image::~Image() = default;
@ -1079,7 +1078,7 @@ bool Image::ScaleDown(bool ignore) {
} }
ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewInfo& info, ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewInfo& info,
ImageId image_id_, Image& image) ImageId image_id_, Image& image, const SlotVector<Image>&)
: VideoCommon::ImageViewBase{info, image.info, image_id_}, views{runtime.null_image_views} { : VideoCommon::ImageViewBase{info, image.info, image_id_}, views{runtime.null_image_views} {
const Device& device = runtime.device; const Device& device = runtime.device;
if (True(image.flags & ImageFlagBits::Converted)) { if (True(image.flags & ImageFlagBits::Converted)) {

View file

@ -189,7 +189,7 @@ class Image : public VideoCommon::ImageBase {
public: public:
explicit Image(TextureCacheRuntime&, const VideoCommon::ImageInfo& info, GPUVAddr gpu_addr, explicit Image(TextureCacheRuntime&, const VideoCommon::ImageInfo& info, GPUVAddr gpu_addr,
VAddr cpu_addr); VAddr cpu_addr);
explicit Image(TextureCacheRuntime&, const VideoCommon::NullImageParams&); explicit Image(const VideoCommon::NullImageParams&);
~Image(); ~Image();
@ -244,7 +244,8 @@ class ImageView : public VideoCommon::ImageViewBase {
friend Image; friend Image;
public: public:
explicit ImageView(TextureCacheRuntime&, const VideoCommon::ImageViewInfo&, ImageId, Image&); explicit ImageView(TextureCacheRuntime&, const VideoCommon::ImageViewInfo&, ImageId, Image&,
const SlotVector<Image>&);
explicit ImageView(TextureCacheRuntime&, const VideoCommon::ImageInfo&, explicit ImageView(TextureCacheRuntime&, const VideoCommon::ImageInfo&,
const VideoCommon::ImageViewInfo&, GPUVAddr); const VideoCommon::ImageViewInfo&, GPUVAddr);
explicit ImageView(TextureCacheRuntime&, const VideoCommon::ImageInfo& info, explicit ImageView(TextureCacheRuntime&, const VideoCommon::ImageInfo& info,

View file

@ -319,38 +319,28 @@ VkPrimitiveTopology PrimitiveTopology([[maybe_unused]] const Device& device,
VkFormat VertexFormat(const Device& device, Maxwell::VertexAttribute::Type type, VkFormat VertexFormat(const Device& device, Maxwell::VertexAttribute::Type type,
Maxwell::VertexAttribute::Size size) { Maxwell::VertexAttribute::Size size) {
auto format = VK_FORMAT_UNDEFINED; const VkFormat format{([&]() {
switch (type) { switch (type) {
case Maxwell::VertexAttribute::Type::UnsignedNorm: case Maxwell::VertexAttribute::Type::UnsignedNorm:
switch (size) { switch (size) {
case Maxwell::VertexAttribute::Size::Size_8: case Maxwell::VertexAttribute::Size::Size_8:
format = VK_FORMAT_R8_UNORM; return VK_FORMAT_R8_UNORM;
break;
case Maxwell::VertexAttribute::Size::Size_8_8: case Maxwell::VertexAttribute::Size::Size_8_8:
format = VK_FORMAT_R8G8_UNORM; return VK_FORMAT_R8G8_UNORM;
break;
case Maxwell::VertexAttribute::Size::Size_8_8_8: case Maxwell::VertexAttribute::Size::Size_8_8_8:
format = VK_FORMAT_R8G8B8_UNORM; return VK_FORMAT_R8G8B8_UNORM;
break;
case Maxwell::VertexAttribute::Size::Size_8_8_8_8: case Maxwell::VertexAttribute::Size::Size_8_8_8_8:
format = VK_FORMAT_R8G8B8A8_UNORM; return VK_FORMAT_R8G8B8A8_UNORM;
break;
case Maxwell::VertexAttribute::Size::Size_16: case Maxwell::VertexAttribute::Size::Size_16:
format = VK_FORMAT_R16_UNORM; return VK_FORMAT_R16_UNORM;
break;
case Maxwell::VertexAttribute::Size::Size_16_16: case Maxwell::VertexAttribute::Size::Size_16_16:
format = VK_FORMAT_R16G16_UNORM; return VK_FORMAT_R16G16_UNORM;
break;
case Maxwell::VertexAttribute::Size::Size_16_16_16: case Maxwell::VertexAttribute::Size::Size_16_16_16:
format = VK_FORMAT_R16G16B16_UNORM; return VK_FORMAT_R16G16B16_UNORM;
break;
case Maxwell::VertexAttribute::Size::Size_16_16_16_16: case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
format = VK_FORMAT_R16G16B16A16_UNORM; return VK_FORMAT_R16G16B16A16_UNORM;
break;
case Maxwell::VertexAttribute::Size::Size_10_10_10_2: case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
format = VK_FORMAT_A2B10G10R10_UNORM_PACK32; return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
break;
default: default:
break; break;
} }
@ -358,32 +348,23 @@ VkFormat VertexFormat(const Device& device, Maxwell::VertexAttribute::Type type,
case Maxwell::VertexAttribute::Type::SignedNorm: case Maxwell::VertexAttribute::Type::SignedNorm:
switch (size) { switch (size) {
case Maxwell::VertexAttribute::Size::Size_8: case Maxwell::VertexAttribute::Size::Size_8:
format = VK_FORMAT_R8_SNORM; return VK_FORMAT_R8_SNORM;
break;
case Maxwell::VertexAttribute::Size::Size_8_8: case Maxwell::VertexAttribute::Size::Size_8_8:
format = VK_FORMAT_R8G8_SNORM; return VK_FORMAT_R8G8_SNORM;
break;
case Maxwell::VertexAttribute::Size::Size_8_8_8: case Maxwell::VertexAttribute::Size::Size_8_8_8:
format = VK_FORMAT_R8G8B8_SNORM; return VK_FORMAT_R8G8B8_SNORM;
break;
case Maxwell::VertexAttribute::Size::Size_8_8_8_8: case Maxwell::VertexAttribute::Size::Size_8_8_8_8:
format = VK_FORMAT_R8G8B8A8_SNORM; return VK_FORMAT_R8G8B8A8_SNORM;
break;
case Maxwell::VertexAttribute::Size::Size_16: case Maxwell::VertexAttribute::Size::Size_16:
format = VK_FORMAT_R16_SNORM; return VK_FORMAT_R16_SNORM;
break;
case Maxwell::VertexAttribute::Size::Size_16_16: case Maxwell::VertexAttribute::Size::Size_16_16:
format = VK_FORMAT_R16G16_SNORM; return VK_FORMAT_R16G16_SNORM;
break;
case Maxwell::VertexAttribute::Size::Size_16_16_16: case Maxwell::VertexAttribute::Size::Size_16_16_16:
format = VK_FORMAT_R16G16B16_SNORM; return VK_FORMAT_R16G16B16_SNORM;
break;
case Maxwell::VertexAttribute::Size::Size_16_16_16_16: case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
format = VK_FORMAT_R16G16B16A16_SNORM; return VK_FORMAT_R16G16B16A16_SNORM;
break;
case Maxwell::VertexAttribute::Size::Size_10_10_10_2: case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
format = VK_FORMAT_A2B10G10R10_SNORM_PACK32; return VK_FORMAT_A2B10G10R10_SNORM_PACK32;
break;
default: default:
break; break;
} }
@ -391,32 +372,23 @@ VkFormat VertexFormat(const Device& device, Maxwell::VertexAttribute::Type type,
case Maxwell::VertexAttribute::Type::UnsignedScaled: case Maxwell::VertexAttribute::Type::UnsignedScaled:
switch (size) { switch (size) {
case Maxwell::VertexAttribute::Size::Size_8: case Maxwell::VertexAttribute::Size::Size_8:
format = VK_FORMAT_R8_USCALED; return VK_FORMAT_R8_USCALED;
break;
case Maxwell::VertexAttribute::Size::Size_8_8: case Maxwell::VertexAttribute::Size::Size_8_8:
format = VK_FORMAT_R8G8_USCALED; return VK_FORMAT_R8G8_USCALED;
break;
case Maxwell::VertexAttribute::Size::Size_8_8_8: case Maxwell::VertexAttribute::Size::Size_8_8_8:
format = VK_FORMAT_R8G8B8_USCALED; return VK_FORMAT_R8G8B8_USCALED;
break;
case Maxwell::VertexAttribute::Size::Size_8_8_8_8: case Maxwell::VertexAttribute::Size::Size_8_8_8_8:
format = VK_FORMAT_R8G8B8A8_USCALED; return VK_FORMAT_R8G8B8A8_USCALED;
break;
case Maxwell::VertexAttribute::Size::Size_16: case Maxwell::VertexAttribute::Size::Size_16:
format = VK_FORMAT_R16_USCALED; return VK_FORMAT_R16_USCALED;
break;
case Maxwell::VertexAttribute::Size::Size_16_16: case Maxwell::VertexAttribute::Size::Size_16_16:
format = VK_FORMAT_R16G16_USCALED; return VK_FORMAT_R16G16_USCALED;
break;
case Maxwell::VertexAttribute::Size::Size_16_16_16: case Maxwell::VertexAttribute::Size::Size_16_16_16:
format = VK_FORMAT_R16G16B16_USCALED; return VK_FORMAT_R16G16B16_USCALED;
break;
case Maxwell::VertexAttribute::Size::Size_16_16_16_16: case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
format = VK_FORMAT_R16G16B16A16_USCALED; return VK_FORMAT_R16G16B16A16_USCALED;
break;
case Maxwell::VertexAttribute::Size::Size_10_10_10_2: case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
format = VK_FORMAT_A2B10G10R10_USCALED_PACK32; return VK_FORMAT_A2B10G10R10_USCALED_PACK32;
break;
default: default:
break; break;
} }
@ -424,32 +396,23 @@ VkFormat VertexFormat(const Device& device, Maxwell::VertexAttribute::Type type,
case Maxwell::VertexAttribute::Type::SignedScaled: case Maxwell::VertexAttribute::Type::SignedScaled:
switch (size) { switch (size) {
case Maxwell::VertexAttribute::Size::Size_8: case Maxwell::VertexAttribute::Size::Size_8:
format = VK_FORMAT_R8_SSCALED; return VK_FORMAT_R8_SSCALED;
break;
case Maxwell::VertexAttribute::Size::Size_8_8: case Maxwell::VertexAttribute::Size::Size_8_8:
format = VK_FORMAT_R8G8_SSCALED; return VK_FORMAT_R8G8_SSCALED;
break;
case Maxwell::VertexAttribute::Size::Size_8_8_8: case Maxwell::VertexAttribute::Size::Size_8_8_8:
format = VK_FORMAT_R8G8B8_SSCALED; return VK_FORMAT_R8G8B8_SSCALED;
break;
case Maxwell::VertexAttribute::Size::Size_8_8_8_8: case Maxwell::VertexAttribute::Size::Size_8_8_8_8:
format = VK_FORMAT_R8G8B8A8_SSCALED; return VK_FORMAT_R8G8B8A8_SSCALED;
break;
case Maxwell::VertexAttribute::Size::Size_16: case Maxwell::VertexAttribute::Size::Size_16:
format = VK_FORMAT_R16_SSCALED; return VK_FORMAT_R16_SSCALED;
break;
case Maxwell::VertexAttribute::Size::Size_16_16: case Maxwell::VertexAttribute::Size::Size_16_16:
format = VK_FORMAT_R16G16_SSCALED; return VK_FORMAT_R16G16_SSCALED;
break;
case Maxwell::VertexAttribute::Size::Size_16_16_16: case Maxwell::VertexAttribute::Size::Size_16_16_16:
format = VK_FORMAT_R16G16B16_SSCALED; return VK_FORMAT_R16G16B16_SSCALED;
break;
case Maxwell::VertexAttribute::Size::Size_16_16_16_16: case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
format = VK_FORMAT_R16G16B16A16_SSCALED; return VK_FORMAT_R16G16B16A16_SSCALED;
break;
case Maxwell::VertexAttribute::Size::Size_10_10_10_2: case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
format = VK_FORMAT_A2B10G10R10_SSCALED_PACK32; return VK_FORMAT_A2B10G10R10_SSCALED_PACK32;
break;
default: default:
break; break;
} }
@ -457,44 +420,31 @@ VkFormat VertexFormat(const Device& device, Maxwell::VertexAttribute::Type type,
case Maxwell::VertexAttribute::Type::UnsignedInt: case Maxwell::VertexAttribute::Type::UnsignedInt:
switch (size) { switch (size) {
case Maxwell::VertexAttribute::Size::Size_8: case Maxwell::VertexAttribute::Size::Size_8:
format = VK_FORMAT_R8_UINT; return VK_FORMAT_R8_UINT;
break;
case Maxwell::VertexAttribute::Size::Size_8_8: case Maxwell::VertexAttribute::Size::Size_8_8:
format = VK_FORMAT_R8G8_UINT; return VK_FORMAT_R8G8_UINT;
break;
case Maxwell::VertexAttribute::Size::Size_8_8_8: case Maxwell::VertexAttribute::Size::Size_8_8_8:
format = VK_FORMAT_R8G8B8_UINT; return VK_FORMAT_R8G8B8_UINT;
break;
case Maxwell::VertexAttribute::Size::Size_8_8_8_8: case Maxwell::VertexAttribute::Size::Size_8_8_8_8:
format = VK_FORMAT_R8G8B8A8_UINT; return VK_FORMAT_R8G8B8A8_UINT;
break;
case Maxwell::VertexAttribute::Size::Size_16: case Maxwell::VertexAttribute::Size::Size_16:
format = VK_FORMAT_R16_UINT; return VK_FORMAT_R16_UINT;
break;
case Maxwell::VertexAttribute::Size::Size_16_16: case Maxwell::VertexAttribute::Size::Size_16_16:
format = VK_FORMAT_R16G16_UINT; return VK_FORMAT_R16G16_UINT;
break;
case Maxwell::VertexAttribute::Size::Size_16_16_16: case Maxwell::VertexAttribute::Size::Size_16_16_16:
format = VK_FORMAT_R16G16B16_UINT; return VK_FORMAT_R16G16B16_UINT;
break;
case Maxwell::VertexAttribute::Size::Size_16_16_16_16: case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
format = VK_FORMAT_R16G16B16A16_UINT; return VK_FORMAT_R16G16B16A16_UINT;
break;
case Maxwell::VertexAttribute::Size::Size_32: case Maxwell::VertexAttribute::Size::Size_32:
format = VK_FORMAT_R32_UINT; return VK_FORMAT_R32_UINT;
break;
case Maxwell::VertexAttribute::Size::Size_32_32: case Maxwell::VertexAttribute::Size::Size_32_32:
format = VK_FORMAT_R32G32_UINT; return VK_FORMAT_R32G32_UINT;
break;
case Maxwell::VertexAttribute::Size::Size_32_32_32: case Maxwell::VertexAttribute::Size::Size_32_32_32:
format = VK_FORMAT_R32G32B32_UINT; return VK_FORMAT_R32G32B32_UINT;
break;
case Maxwell::VertexAttribute::Size::Size_32_32_32_32: case Maxwell::VertexAttribute::Size::Size_32_32_32_32:
format = VK_FORMAT_R32G32B32A32_UINT; return VK_FORMAT_R32G32B32A32_UINT;
break;
case Maxwell::VertexAttribute::Size::Size_10_10_10_2: case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
format = VK_FORMAT_A2B10G10R10_UINT_PACK32; return VK_FORMAT_A2B10G10R10_UINT_PACK32;
break;
default: default:
break; break;
} }
@ -502,44 +452,31 @@ VkFormat VertexFormat(const Device& device, Maxwell::VertexAttribute::Type type,
case Maxwell::VertexAttribute::Type::SignedInt: case Maxwell::VertexAttribute::Type::SignedInt:
switch (size) { switch (size) {
case Maxwell::VertexAttribute::Size::Size_8: case Maxwell::VertexAttribute::Size::Size_8:
format = VK_FORMAT_R8_SINT; return VK_FORMAT_R8_SINT;
break;
case Maxwell::VertexAttribute::Size::Size_8_8: case Maxwell::VertexAttribute::Size::Size_8_8:
format = VK_FORMAT_R8G8_SINT; return VK_FORMAT_R8G8_SINT;
break;
case Maxwell::VertexAttribute::Size::Size_8_8_8: case Maxwell::VertexAttribute::Size::Size_8_8_8:
format = VK_FORMAT_R8G8B8_SINT; return VK_FORMAT_R8G8B8_SINT;
break;
case Maxwell::VertexAttribute::Size::Size_8_8_8_8: case Maxwell::VertexAttribute::Size::Size_8_8_8_8:
format = VK_FORMAT_R8G8B8A8_SINT; return VK_FORMAT_R8G8B8A8_SINT;
break;
case Maxwell::VertexAttribute::Size::Size_16: case Maxwell::VertexAttribute::Size::Size_16:
format = VK_FORMAT_R16_SINT; return VK_FORMAT_R16_SINT;
break;
case Maxwell::VertexAttribute::Size::Size_16_16: case Maxwell::VertexAttribute::Size::Size_16_16:
format = VK_FORMAT_R16G16_SINT; return VK_FORMAT_R16G16_SINT;
break;
case Maxwell::VertexAttribute::Size::Size_16_16_16: case Maxwell::VertexAttribute::Size::Size_16_16_16:
format = VK_FORMAT_R16G16B16_SINT; return VK_FORMAT_R16G16B16_SINT;
break;
case Maxwell::VertexAttribute::Size::Size_16_16_16_16: case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
format = VK_FORMAT_R16G16B16A16_SINT; return VK_FORMAT_R16G16B16A16_SINT;
break;
case Maxwell::VertexAttribute::Size::Size_32: case Maxwell::VertexAttribute::Size::Size_32:
format = VK_FORMAT_R32_SINT; return VK_FORMAT_R32_SINT;
break;
case Maxwell::VertexAttribute::Size::Size_32_32: case Maxwell::VertexAttribute::Size::Size_32_32:
format = VK_FORMAT_R32G32_SINT; return VK_FORMAT_R32G32_SINT;
break;
case Maxwell::VertexAttribute::Size::Size_32_32_32: case Maxwell::VertexAttribute::Size::Size_32_32_32:
format = VK_FORMAT_R32G32B32_SINT; return VK_FORMAT_R32G32B32_SINT;
break;
case Maxwell::VertexAttribute::Size::Size_32_32_32_32: case Maxwell::VertexAttribute::Size::Size_32_32_32_32:
format = VK_FORMAT_R32G32B32A32_SINT; return VK_FORMAT_R32G32B32A32_SINT;
break;
case Maxwell::VertexAttribute::Size::Size_10_10_10_2: case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
format = VK_FORMAT_A2B10G10R10_SINT_PACK32; return VK_FORMAT_A2B10G10R10_SINT_PACK32;
break;
default: default:
break; break;
} }
@ -547,37 +484,30 @@ VkFormat VertexFormat(const Device& device, Maxwell::VertexAttribute::Type type,
case Maxwell::VertexAttribute::Type::Float: case Maxwell::VertexAttribute::Type::Float:
switch (size) { switch (size) {
case Maxwell::VertexAttribute::Size::Size_16: case Maxwell::VertexAttribute::Size::Size_16:
format = VK_FORMAT_R16_SFLOAT; return VK_FORMAT_R16_SFLOAT;
break;
case Maxwell::VertexAttribute::Size::Size_16_16: case Maxwell::VertexAttribute::Size::Size_16_16:
format = VK_FORMAT_R16G16_SFLOAT; return VK_FORMAT_R16G16_SFLOAT;
break;
case Maxwell::VertexAttribute::Size::Size_16_16_16: case Maxwell::VertexAttribute::Size::Size_16_16_16:
format = VK_FORMAT_R16G16B16_SFLOAT; return VK_FORMAT_R16G16B16_SFLOAT;
break;
case Maxwell::VertexAttribute::Size::Size_16_16_16_16: case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
format = VK_FORMAT_R16G16B16A16_SFLOAT; return VK_FORMAT_R16G16B16A16_SFLOAT;
break;
case Maxwell::VertexAttribute::Size::Size_32: case Maxwell::VertexAttribute::Size::Size_32:
format = VK_FORMAT_R32_SFLOAT; return VK_FORMAT_R32_SFLOAT;
break;
case Maxwell::VertexAttribute::Size::Size_32_32: case Maxwell::VertexAttribute::Size::Size_32_32:
format = VK_FORMAT_R32G32_SFLOAT; return VK_FORMAT_R32G32_SFLOAT;
break;
case Maxwell::VertexAttribute::Size::Size_32_32_32: case Maxwell::VertexAttribute::Size::Size_32_32_32:
format = VK_FORMAT_R32G32B32_SFLOAT; return VK_FORMAT_R32G32B32_SFLOAT;
break;
case Maxwell::VertexAttribute::Size::Size_32_32_32_32: case Maxwell::VertexAttribute::Size::Size_32_32_32_32:
format = VK_FORMAT_R32G32B32A32_SFLOAT; return VK_FORMAT_R32G32B32A32_SFLOAT;
break;
case Maxwell::VertexAttribute::Size::Size_11_11_10: case Maxwell::VertexAttribute::Size::Size_11_11_10:
format = VK_FORMAT_B10G11R11_UFLOAT_PACK32; return VK_FORMAT_B10G11R11_UFLOAT_PACK32;
break;
default: default:
break; break;
} }
break; break;
} }
return VK_FORMAT_UNDEFINED;
})()};
if (format == VK_FORMAT_UNDEFINED) { if (format == VK_FORMAT_UNDEFINED) {
UNIMPLEMENTED_MSG("Unimplemented vertex format of type={} and size={}", type, size); UNIMPLEMENTED_MSG("Unimplemented vertex format of type={} and size={}", type, size);

View file

@ -1287,17 +1287,7 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu
} }
} }
Image::Image(TextureCacheRuntime& runtime_, const VideoCommon::NullImageParams& params) Image::Image(const VideoCommon::NullImageParams& params) : VideoCommon::ImageBase{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() = default; Image::~Image() = default;
@ -1630,6 +1620,9 @@ ImageView::ImageView(TextureCacheRuntime&, const VideoCommon::NullImageViewParam
ImageView::~ImageView() = default; ImageView::~ImageView() = default;
VkImageView ImageView::DepthView() { VkImageView ImageView::DepthView() {
if (!image_handle) {
return VK_NULL_HANDLE;
}
if (depth_view) { if (depth_view) {
return *depth_view; return *depth_view;
} }
@ -1639,6 +1632,9 @@ VkImageView ImageView::DepthView() {
} }
VkImageView ImageView::StencilView() { VkImageView ImageView::StencilView() {
if (!image_handle) {
return VK_NULL_HANDLE;
}
if (stencil_view) { if (stencil_view) {
return *stencil_view; return *stencil_view;
} }
@ -1648,6 +1644,9 @@ VkImageView ImageView::StencilView() {
} }
VkImageView ImageView::ColorView() { VkImageView ImageView::ColorView() {
if (!image_handle) {
return VK_NULL_HANDLE;
}
if (color_view) { if (color_view) {
return *color_view; return *color_view;
} }
@ -1657,6 +1656,9 @@ VkImageView ImageView::ColorView() {
VkImageView ImageView::StorageView(Shader::TextureType texture_type, VkImageView ImageView::StorageView(Shader::TextureType texture_type,
Shader::ImageFormat image_format) { Shader::ImageFormat image_format) {
if (!image_handle) {
return VK_NULL_HANDLE;
}
if (image_format == Shader::ImageFormat::Typeless) { if (image_format == Shader::ImageFormat::Typeless) {
return Handle(texture_type); return Handle(texture_type);
} }

View file

@ -110,7 +110,7 @@ class Image : public VideoCommon::ImageBase {
public: public:
explicit Image(TextureCacheRuntime&, const VideoCommon::ImageInfo& info, GPUVAddr gpu_addr, explicit Image(TextureCacheRuntime&, const VideoCommon::ImageInfo& info, GPUVAddr gpu_addr,
VAddr cpu_addr); VAddr cpu_addr);
explicit Image(TextureCacheRuntime&, const VideoCommon::NullImageParams&); explicit Image(const VideoCommon::NullImageParams&);
~Image(); ~Image();

View file

@ -41,9 +41,8 @@ TextureCache<P>::TextureCache(Runtime& runtime_, VideoCore::RasterizerInterface&
// Make sure the first index is reserved for the null resources // Make sure the first index is reserved for the null resources
// This way the null resource becomes a compile time constant // This way the null resource becomes a compile time constant
void(slot_images.insert(runtime, NullImageParams{})); void(slot_images.insert(NullImageParams{}));
void(slot_image_views.insert(runtime, ImageViewInfo{}, NULL_IMAGE_ID, void(slot_image_views.insert(runtime, NullImageViewParams{}));
slot_images[NULL_IMAGE_ID]));
void(slot_samplers.insert(runtime, sampler_descriptor)); void(slot_samplers.insert(runtime, sampler_descriptor));
if constexpr (HAS_DEVICE_MEMORY_INFO) { if constexpr (HAS_DEVICE_MEMORY_INFO) {
@ -1444,7 +1443,8 @@ ImageViewId TextureCache<P>::FindOrEmplaceImageView(ImageId image_id, const Imag
if (const ImageViewId image_view_id = image.FindView(info); image_view_id) { if (const ImageViewId image_view_id = image.FindView(info); image_view_id) {
return 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); image.InsertView(info, image_view_id);
return image_view_id; return image_view_id;
} }