assert in glTextureStorageMem3DEXT with depth > 1
System information
System: Host: c-pc Kernel: 5.8.1-zen1-1-zen x86_64 bits: 64 compiler: N/A Desktop: KDE Plasma 5.19.4 tk: Qt 5.15.0
wm: kwin_x11 dm: SDDM Distro: Arch Linux
CPU: Info: 16-Core (2-Die) model: AMD Ryzen 9 3950X bits: 64 type: MT MCP MCM arch: Zen 2 L2 cache: 8192 KiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 223592
Speed: 4236 MHz min/max: 2200/3500 MHz Core speeds (MHz): 1: 4308 2: 4205 3: 3594 4: 3594 5: 3593 6: 3595 7: 4192
8: 4159 9: 4286 10: 4251 11: 4376 12: 4365 13: 4381 14: 3588 15: 3591 16: 3583 17: 3590 18: 3594 19: 3591 20: 3593
21: 3586 22: 4158 23: 3592 24: 4271 25: 3592 26: 3591 27: 3597 28: 3592 29: 3605 30: 3592 31: 3595 32: 3593
Graphics: Device-1: Advanced Micro Devices [AMD/ATI] Vega 10 XL/XT [Radeon RX Vega 56/64] vendor: Sapphire Limited
driver: amdgpu v: kernel bus ID: 0b:00.0 chip ID: 1002:687f
Display: x11 server: X.Org 1.20.8 compositor: kwin_x11 driver: amdgpu resolution: 1: 3840x2160~60Hz 2: 1920x1080
s-dpi: 96
OpenGL: renderer: Radeon RX Vega (VEGA10 DRM 3.38.0 5.8.1-zen1-1-zen LLVM 12.0.0)
v: 4.6 Mesa 20.3.0-devel (git-418c4c0d7d) direct render: Yes
Describe the issue
In our Monado OpenXR runtime we import Vulkan textures into OpenGL using glTextureStorageMem3DEXT() in the case of array textures https://gitlab.freedesktop.org/monado/monado/-/blob/355ea625dd11b4c6376ed1696723ac35cfed38bf/src/xrt/compositor/client/comp_gl_memobj_swapchain.c#L111-114
When mesa is compiled with -Db_ndebug=true
everything works fine, but when mesa is compiled with -Db_ndebug=false
, an assert in mesa happens:
conformance_cli: ../src/gallium/drivers/radeonsi/si_texture.c:293: si_init_surface: Assertion `ptex->nr_samples <= 1 && ptex->array_size == 1 && ptex->depth0 == 1 && ptex->last_level == 0 && !(flags & RADEON_SURF_Z_OR_SBUFFER)' failed.
specifically, ptex->array_size
is 2 in this case.
This assert is encountered because is_scanout
is true determined by surface.flags & RADEON_SURF_SCANOUT
. https://gitlab.freedesktop.org/mesa/mesa/-/blob/a880f97d593a461bdcce27e526423a9b1d6834b4/src/gallium/drivers/radeonsi/si_texture.c#L291-294
The "culprit" setting this flag is this line based on some tiling mode https://gitlab.freedesktop.org/mesa/mesa/-/blob/a880f97d593a461bdcce27e526423a9b1d6834b4/src/amd/common/ac_surface.c#L2354
Tested with mesa 20.2 and git 418c4c0d, happens on both.