From 45d506545e83ae0bc3ed4159a79984524a1134ba Mon Sep 17 00:00:00 2001 From: BZLZHH Date: Fri, 31 Jul 2026 16:35:03 -0400 Subject: [PATCH] [Fix] (MG_Util, DirectVulkan): tolerate storage-less attachments in component-size queries GetComponentSizesForInternalFormat asserted on TextureInternalFormat::Unknown, which framebuffer-parameter queries legitimately reach for attachments that have no storage yet (KHR-GL33.packed_depth_stencil.validate_errors.initial_state aborted there). Answer with all-zero sizes and keep a warning for genuinely unhandled formats. Also include the image dimensions in the texture vmaCreateImage failure report. --- .../MG_Backend/DirectVulkan/Renderer/VkTextureManager.cpp | 5 ++++- MobileGL/MG_Util/Metrics/TextureMetrics.cpp | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.cpp b/MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.cpp index da5bd7bf..07182761 100644 --- a/MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.cpp +++ b/MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.cpp @@ -1694,7 +1694,10 @@ namespace MobileGL::MG_Backend::DirectVulkan { allocationInfo.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE; allocationInfo.requiredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; VK_VERIFY(vmaCreateImage(m_allocator, &imageInfo, &allocationInfo, &resource.image, &resource.allocation, nullptr), - "vmaCreateImage(texture)"); + "vmaCreateImage(texture) textureId=%d extent=%ux%u depth=%u layers=%u mips=%u samples=%d format=%d", + texture.GetExternalIndex(), imageInfo.extent.width, imageInfo.extent.height, + imageInfo.extent.depth, imageInfo.arrayLayers, imageInfo.mipLevels, + static_cast(imageInfo.samples), static_cast(imageInfo.format)); ++m_textureImageEpoch; // a new attachment image invalidates cached render passes resource.layout = VK_IMAGE_LAYOUT_UNDEFINED; diff --git a/MobileGL/MG_Util/Metrics/TextureMetrics.cpp b/MobileGL/MG_Util/Metrics/TextureMetrics.cpp index 2075cf08..f89281e1 100644 --- a/MobileGL/MG_Util/Metrics/TextureMetrics.cpp +++ b/MobileGL/MG_Util/Metrics/TextureMetrics.cpp @@ -503,9 +503,13 @@ namespace MobileGL { s.Depth = 32; s.Stencil = 8; break; + case TextureInternalFormat::Unknown: + // Queried for attachments that have no storage yet (e.g. framebuffer + // parameter queries on the initial state); every size stays 0. + break; default: - MOBILEGL_ASSERT(false, "Unimplemented internal format in GetComponentSizesForInternalFormat: %d", - static_cast(internal)); + MGLOG_W("Unimplemented internal format in GetComponentSizesForInternalFormat: %d", + static_cast(internal)); break; }