mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-28 22:09:01 +02:00
Vulkan validation error fix.
Different image usage flags between image creation and image view creation.
This commit is contained in:
parent
5af02a5cea
commit
492d3856e8
4 changed files with 30 additions and 16 deletions
|
|
@ -1396,7 +1396,7 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu
|
|||
if (runtime->device.HasDebuggingToolAttached()) {
|
||||
original_image.SetObjectNameEXT(VideoCommon::Name(*this).c_str());
|
||||
}
|
||||
current_image = *original_image;
|
||||
current_image = &Image::original_image;
|
||||
storage_image_views.resize(info.resources.levels);
|
||||
if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported() &&
|
||||
Settings::values.astc_recompression.GetValue() ==
|
||||
|
|
@ -1540,8 +1540,8 @@ VkImageView Image::StorageImageView(s32 level) noexcept {
|
|||
if (!view) {
|
||||
const auto format_info =
|
||||
MaxwellToVK::SurfaceFormat(runtime->device, FormatType::Optimal, true, info.format);
|
||||
view =
|
||||
MakeStorageView(runtime->device.GetLogical(), level, current_image, format_info.format);
|
||||
view = MakeStorageView(runtime->device.GetLogical(), level, *(this->*current_image),
|
||||
format_info.format);
|
||||
}
|
||||
return *view;
|
||||
}
|
||||
|
|
@ -1572,7 +1572,7 @@ bool Image::ScaleUp(bool ignore) {
|
|||
runtime->ViewFormats(info.format));
|
||||
ignore = false;
|
||||
}
|
||||
current_image = *scaled_image;
|
||||
current_image = &Image::scaled_image;
|
||||
if (ignore) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1597,7 +1597,7 @@ bool Image::ScaleDown(bool ignore) {
|
|||
}
|
||||
ASSERT(info.type != ImageType::Linear);
|
||||
flags &= ~ImageFlagBits::Rescaled;
|
||||
current_image = *original_image;
|
||||
current_image = &Image::original_image;
|
||||
if (ignore) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1716,7 +1716,7 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI
|
|||
const VkImageViewUsageCreateInfo image_view_usage{
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.usage = ImageUsageFlags(format_info, format),
|
||||
.usage = image.UsageFlags(),
|
||||
};
|
||||
const VkImageViewCreateInfo create_info{
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ using Common::SlotVector;
|
|||
using VideoCommon::ImageId;
|
||||
using VideoCommon::NUM_RT;
|
||||
using VideoCommon::Region2D;
|
||||
using VideoCommon::RenderTargets;
|
||||
using VideoCore::Surface::PixelFormat;
|
||||
|
||||
class BlitImageHelper;
|
||||
|
|
@ -157,13 +156,17 @@ public:
|
|||
std::span<const VideoCommon::BufferImageCopy> copies);
|
||||
|
||||
[[nodiscard]] VkImage Handle() const noexcept {
|
||||
return current_image;
|
||||
return *(this->*current_image);
|
||||
}
|
||||
|
||||
[[nodiscard]] VkImageAspectFlags AspectMask() const noexcept {
|
||||
return aspect_mask;
|
||||
}
|
||||
|
||||
[[nodiscard]] VkImageUsageFlags UsageFlags() const noexcept {
|
||||
return (this->*current_image).UsageFlags();
|
||||
}
|
||||
|
||||
/// Returns true when the image is already initialized and mark it as initialized
|
||||
[[nodiscard]] bool ExchangeInitialization() noexcept {
|
||||
return std::exchange(initialized, true);
|
||||
|
|
@ -186,11 +189,15 @@ private:
|
|||
TextureCacheRuntime* runtime{};
|
||||
|
||||
vk::Image original_image;
|
||||
vk::Image scaled_image;
|
||||
|
||||
// Use a pointer to field because it is relative, so that the object can be
|
||||
// moved without breaking the reference.
|
||||
vk::Image Image::*current_image{};
|
||||
|
||||
std::vector<vk::ImageView> storage_image_views;
|
||||
VkImageAspectFlags aspect_mask = 0;
|
||||
bool initialized = false;
|
||||
vk::Image scaled_image{};
|
||||
VkImage current_image{};
|
||||
|
||||
std::unique_ptr<Framebuffer> scale_framebuffer;
|
||||
std::unique_ptr<ImageView> scale_view;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue