Try / Tempest

API abstraction layer for 3D graphics, UI and sound. Written in C++17 with Vulkan, DX12 and Metal support.
MIT License
107 stars 27 forks source link

mesh shader usage on RADV triggers a firmware bug #55

Closed cyanreg closed 7 months ago

cyanreg commented 8 months ago

This seems to be a strictly firmware-level bug, but it doesn't manifest in DXVK's generated mesh shader, nor in other Vulkan users of it, so it's possible Tempest does something odd to trigger it. https://gitlab.freedesktop.org/mesa/mesa/-/issues/10360 A small reproduction example or ideas why this might happen are appreciated.

Try commented 8 months ago

Wow, glad someone actually testing this project on linux :)

Don't think that Tempest does anything here: there is a mesh-shader-emulation layer, yet it's non-applicable in your case.

Relevant shader code, that you might want to look into, in OpenGothic: https://github.com/Try/OpenGothic/blob/master/shader/materials/main.mesh https://github.com/Try/OpenGothic/blob/master/shader/materials/main.task ^ those are very simple ones - frustrum+HiZ in task, mesh stage performs same work as vertex would otherwise. No gl_ClipDistance or similar - only gl_Position + a few user defined varyings. Task payload struct defined here And varyings here

One more shader mesh-shader: https://github.com/Try/OpenGothic/blob/master/shader/water/water_reflection.mesh This is a bit unusual: mesh-stage does tile-classification and emits quad.

A small reproduction example or ideas why this might happen are appreciated.

I wasn't aware of concrete RADV issues, with my engine before this ticket, apparently someone else reported it. If you looking for simplistic content, there is a sample code in engine repo: https://github.com/Try/Tempest/tree/master/Examples/MeshShader

cyanreg commented 8 months ago

The MeshShader example in Tempest doesn't trigger the issue, oddly enough.

Try commented 8 months ago

Based on Timur's presentation, slide 29 https://indico.freedesktop.org/event/2/contributions/49/attachments/55/80/xdc2022_mesa_mesh_shader_implementation.pdf

Task shader implementation ideas
• Abuse the tessellator (Intel, NVidia)
• Use a compute pre-pass
• Do it in firmware (AMD)

And the fact that only OpenGothic utilizes task-stage, I would look into this direction

Try commented 7 months ago

Some FYI: opengothic no longer uses task-shader since "GPU-driven optimizations" patch is merged (323a6e5a)

cyanreg commented 7 months ago

Thanks for the ping, can confirm, I can't replicate it after that commit.

I'll close this issue, but leave the Mesa issue open, in case someday someone runs into it.

Cheers