protonscr

Assert in Mesa due to VkImageViewUsageCreateInfo::usage not being a subset of VkImageCreateInfo::usage in some cases

dxvkclosed d3d11
doitsujin/dxvk#3337 · opened 2023-04-06 by werman · updated 2023-04-06 · 5 comments · github
Wwerman 2023-04-06 github

In some games dxvk trips the following assert in Mesa:

../src/vulkan/runtime/vk_image.c:503: vk_image_view_init: Assertion `driver_internal || !(image_view->usage & ~image_usage)' failed.

In other words VkImageViewUsageCreateInfo::usage is not a subset of VkImageCreateInfo::usage flags.

I did a long overdue test run of Turnip with game captures I have and this came up on a few of them.

Software information

System information

  • GPU: Adreno a6xx, any new Radeon
  • Driver: RADV, Turnip - tip-of-main (a17317d2a0222b34a6723b68390eac4c090d31c8)
  • Wine version: 8.5
  • DXVK version: v2.1 or tip-of-master (6d14fff)

Apitrace file(s)

https://cloud.igalia.com/s/krzfAbWktfGGReE (apitrace of renderdoc capture of Disco Elysium)

Log files

Image usages under gdb:

508        assert(driver_internal || !(image_view->usage & ~image_usage));
(gdb) p image_view->usage
$2 = 16
(gdb) p image_usage
$6 = 7

Log of the run with validation layers enabled:
dxvk_with_valid_layers.log

Ddoitsujin maintainer 2023-04-06 github

The game doesn't specify D3D11_BIND_RENDER_TARGET for one of its resolve targets. Not sure if that's even legal in D3D11, but it's very annoying for us. If this is in fact supposed to work, we would either need to create a temporary image and do a copy to perform the resolve, or create every image with a renderable format with COLOR_ATTACHMENT_BIT.

Wwerman 2023-04-06 github

Hmmm, sounds nasty, let me check if any other traces have same issue. Maybe it is unique to this game issue. And since the capture is 3 years old, maybe the game was fixed since then.

Mmbriar 2023-04-06 github

Also, does this even cause any problems with release builds of Mesa? At least on radv the game has always worked fine and debug builds of Mesa also crash Doom 2016 and Doom Eternal due to asserts even when the relevant game bugs are harmless and caught by vulkan validation anyways..

Ddoitsujin maintainer 2023-04-06 github

We do not trigger the assert on release builds, but rendering to an image that does not have COLOR_ATTACHMENT_BIT set is scary and can easily lead to artifacting, so we should fix it.

Wwerman 2023-04-06 github

No other traces I have exhibit this issue. (Game renders fine on Turnip with assert commented out btw)

Nothing extracted yet.