diff --git a/src/dawn/native/vulkan/TextureVk.cpp b/src/dawn/native/vulkan/TextureVk.cpp index a2ae53cc41..7943082943 100644 --- a/src/dawn/native/vulkan/TextureVk.cpp +++ b/src/dawn/native/vulkan/TextureVk.cpp @@ -32,6 +32,7 @@ #include "dawn/common/Assert.h" #include "dawn/common/DynamicLib.h" +#include "dawn/common/Log.h" #include "dawn/common/Math.h" #include "dawn/native/ChainUtils.h" #include "dawn/native/DynamicUploader.h" @@ -713,6 +714,21 @@ VkImageLayout VulkanImageLayout(const Format& format, wgpu::TextureUsage usage) } else if (IsSubset(kDepthWritableStencilReadOnlyAttachment, usage)) { return VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL; } else { + // POC instrumentation: this branch unconditionally returns a + // depth/stencil layout. If we get here for a *color* format, the + // multi-bit usage was not one of the expected depth/stencil + // combinations (e.g. TextureBinding | kReadOnlyStorageTexture). + // In release builds the DAWN_ASSERT below is just + // __builtin_assume(), so log + hard-CHECK to make it observable. + if (!format.HasDepthOrStencil()) { + dawn::ErrorLog() + << "POC-HIT VulkanImageLayout: returning " + "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL for " + "color format, usage=0x" + << std::hex + << static_cast(usage); + } + DAWN_CHECK(format.HasDepthOrStencil()); DAWN_ASSERT( IsSubset(usage, kReadOnlyRenderAttachment | wgpu::TextureUsage::TextureBinding)); return VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL;