radv: Crash when creating graphics pipeline libraries with module identifier
Hello,
when testing RADV's GPL implementation with DXVK, I came across an issue that causes various games to crash. This is what happens:
- We create a pipeline library with
VK_GRAPHICS_PIPELINE_LIBRARY_PRE_RASTERIZATION_SHADERS_BIT_EXT
and if dynamic depth clip is not supported, assume that depth clip state is enabled, and cache the module identifier of that shader. - We then need to recompile the same pipeline library with depth clip state disabled. In order to avoid some extra work on our end, we don't pass the shader code again but rather just the identifier and set
VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT
. - The call does not fail, so we do get a valid pipeline handle immediately, but when investigating the pipeline object on the RADV side, it has no vertex shader attached (i.e.
shaders[VERTEX]
isNULL
). - When eventually linking the pipeline, this causes a crash.
When compiling the pipeline library normally with the full shader code, everything works as expected. I'm aware that GPL is still work in progress, but since this pattern is probably not very common outside of DXVK, I'm reporting it anyway so this doesn't get overlooked. This is especially important for 32-bit games for us where we cannot afford to keep pipeline libraries in memory due to address space issues, and instead have to rely on hitting the driver's on-disk pipeline cache to link pipelines.
Since Fossilize cannot be used to reproduce this, here's an apitrace of ELEX 2: https://mega.nz/file/YSpSSILD#-ADBEj2GHeTy9umnggO9GwHqWWlLTuH2dZ14ucoayA0
DXVK from proton-experimental should be good enough to trigger the bug, alternatively use this build. Current master
uses dynamic depth clip and therefore will not crash.
The following patch also needs to be applied to RADV so that DXVK actually uses the feature: radv-dxvk-gpl.patch