Wgpu debugging help

(I'm also using iced_wgpu).

Once again, I am baffled by how to read/debug this. Here is the error msg:

init: got size: PhysicalSize { width: 800, height: 600 }
[2023-04-13T20:49:14Z ERROR wgpu_hal::vulkan::instance] VALIDATION [VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 (0x7cd0911d)]
    	Validation Error: [ VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 ] Object 0: handle = 0x55d96719d980, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x7cd0911d | vkCreateSwapchainKHR() called with imageExtent = (800,600), which is outside the bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): currentExtent = (3834,2119), minImageExtent = (3834,2119), maxImageExtent = (3834,2119). The Vulkan spec states: imageExtent must be between minImageExtent and maxImageExtent, inclusive, where minImageExtent and maxImageExtent are members of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkSwapchainCreateInfoKHR-imageExtent-01274)
[2023-04-13T20:49:14Z ERROR wgpu_hal::vulkan::instance] 	objects: (type: DEVICE, hndl: 0x55d96719d980, name: ?)
window size: PhysicalSize { width: 800, height: 600 }
*** resize: PhysicalSize { width: 800, height: 600 }
*** resize: PhysicalSize { width: 800, height: 600 }
*** resize: PhysicalSize { width: 3834, height: 2119 }
[2023-04-13T20:49:14Z ERROR wgpu::backend::direct] Handling wgpu errors as fatal by default
thread 'main' panicked at 'wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `<CommandBuffer-(7, 1, Vulkan)>`
    In a pass parameter
      note: command buffer = `<CommandBuffer-(7, 1, Vulkan)>`
    attachments have differing sizes: ("color", Extent3d { width: 3834, height: 2119, depth_or_array_layers: 1 }) is followed by ("resolve", Extent3d { width: 800, height: 600, depth_or_array_layers: 1 })

My screen size is not 800x600, it's 3840 x 2160, and apparently after accounting for decorationns, becomes 3834 x 2119.

Here is everything I don't understand:

Question 1

What is triggering

[2023-04-13T20:49:14Z ERROR wgpu_hal::vulkan::instance] VALIDATION [VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 (0x7cd0911d)]
    	Validation Error: [ VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 ] Object 0: handle = 0x55d96719d980, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x7cd0911d | vkCreateSwapchainKHR() called with imageExtent = (800,600), which is outside the bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): currentExtent = (3834,2119), minImageExtent = (3834,2119), maxImageExtent = (3834,2119). The Vulkan spec states: imageExtent must be between minImageExtent and maxImageExtent, inclusive, where minImageExtent and maxImageExtent are members of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkSwapchainCreateInfoKHR-imageExtent-01274)

It seems like we are already off to a bad start. How can I get a stack trace for that? Even if it's non-fatal (as in program continues running), I want to fix it anyway.

Question 2

*** resize: PhysicalSize { width: 800, height: 600 }
*** resize: PhysicalSize { width: 3834, height: 2119 }
[2023-04-13T20:49:14Z ERROR wgpu::backend::direct] Handling wgpu errors as fatal by default
thread 'main' panicked at 'wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `<CommandBuffer-(7, 1, Vulkan)>`
    In a pass parameter
      note: command buffer = `<CommandBuffer-(7, 1, Vulkan)>`
    attachments have differing sizes: ("color", Extent3d { width: 3834, height: 2119, depth_or_array_layers: 1 }) is followed by ("resolve", Extent3d { width: 800, height: 600, depth_or_array_layers: 1 })

It app;ears, during this process, after a resize from 800x600 to 3834 to 2119, some attachments are correctly resized; others are not. I am tryin gto figure out where this happens: I grepped for '"color"' and '"resolve"' -- does not show up in my codebase, I'm trying to figure out where (rust lineof code) these attachments are defined.

Question 3

How to figure out which Rust lines of code corresponds to:

    In a RenderPass
      note: encoder = `<CommandBuffer-(7, 1, Vulkan)>`
    In a pass parameter
      note: command buffer = `<CommandBuffer-(7, 1, Vulkan)>`

Thanks!

The method generating the error appears to be RenderPassInfo::start, and it appears to be called when RenderPass (The type returned by begin_render_pass) is dropped. You can search for AttachmentsDimensionMismatch to find where the error is created in RenderPassInfo::start

Are you trying to render full screen? It looks to me like you're getting a default (small) window size and something else is trying to scale that up to more or less full screen, possibly incorrectly

Sharing the backtrace would probably help with troubleshooting.

I also went through some of the iced_wgpu code and the only thing that stood out as unusual was the way it handles MSAA. Do you have antialiasing enabled in your iced settings, and does it help if it's disabled? For instance, the clock example enables it: iced/main.rs at master ยท iced-rs/iced (github.com)

Good call. I can't share this right now (due to more code changes), but will keep this in mind for the future.

I am running xmonad. I think it auto "fullscreens" windows (or atleast to "fll" whatever predefined space).

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.