Intel Vulkan driver crash with alpha-to-coverage
I have a test case which does two things:
- Set VkPipelineMultisampleStateCreateInfo::alphaToCoverageEnable = TRUE
- The fragment shader writes to the output sample mask (SpvBuiltInSampleMask).
During Vk pipeline creation the Vulkan driver crashes with:
extra dangling SSA sources:
0x7fffe808b1a0
0x7fffe8078be8
Thread 3 "main-svga" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) where
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007ffff60d6801 in __GI_abort () at abort.c:79
#2 0x00007fffe79498b7 in validate_function_impl (impl=0x7fffe80a4030, state=0x7ffff49146c0) at ../src/compiler/nir/nir_validate.c:1233
#3 0x00007fffe794991f in validate_function (func=0x7fffe804c520, state=0x7ffff49146c0) at ../src/compiler/nir/nir_validate.c:1242
#4 0x00007fffe794a002 in nir_validate_shader (shader=0x7fffe8079330, when=0x7fffe7ab71e0 "after brw_nir_lower_alpha_to_coverage") at ../src/compiler/nir/nir_validate.c:1352
#5 0x00007fffe72141af in brw_compile_fs (compiler=0x7ffff03caf90, log_data=0x7ffff06e2050, mem_ctx=0x7fffe808d980, key=0x7ffff4919e68, prog_data=0x7ffff491b048, shader=0x7fffe8079330, shader_time_index8=-1, shader_time_index16=-1, shader_time_index32=-1, allow_spilling=true, use_rep_send=false, vue_map=0x0, stats=0x7ffff491b29c, error_str=0x0) at ../src/intel/compiler/brw_fs.cpp:8597
#6 0x00007fffe68751f1 in anv_pipeline_compile_fs (compiler=0x7ffff03caf90, mem_ctx=0x7fffe808d980, device=0x7ffff06e2050, fs_stage=0x7ffff4919e30, prev_stage=0x7ffff4914a70) at ../src/intel/vulkan/anv_pipeline.c:1073
#7 0x00007fffe6876d02 in anv_pipeline_compile_graphics (pipeline=0x7fffe809c0c0, cache=0x7ffff06e36f8, info=0x7fffe80385e8) at ../src/intel/vulkan/anv_pipeline.c:1536
#8 0x00007fffe6878abf in anv_graphics_pipeline_init (pipeline=0x7fffe809c0c0, device=0x7ffff06e2050, cache=0x7ffff06e36f8, pCreateInfo=0x7fffe80385e8, alloc=0x555555f26b00 <customAllocCallbacks.35049>) at ../src/intel/vulkan/anv_pipeline.c:2080
#9 0x00007fffe6d3f520 in gen9_graphics_pipeline_create (_device=0x7ffff06e2050, cache=0x7ffff06e36f8, pCreateInfo=0x7fffe80385e8, pAllocator=0x555555f26b00 <customAllocCallbacks.35049>, pPipeline=0x7ffff491ce18) at ../src/intel/vulkan/genX_pipeline.c:2171
#10 0x00007fffe6d44186 in gen9_CreateGraphicsPipelines (_device=0x7ffff06e2050, pipelineCache=0x0, count=1, pCreateInfos=0x7fffe80385e8, pAllocator=0x555555f26b00 <customAllocCallbacks.35049>, pPipelines=0x7ffff491ce18) at ../src/intel/vulkan/genX_pipeline.c:2443
#11 0x00007fffdecd62f9 in DispatchCreateGraphicsPipelines (device=0x7ffff06e2050, pipelineCache=0x0, createInfoCount=1, pCreateInfos=0x7ffff491ce50, pAllocator=0x555555f26b00 <customAllocCallbacks.35049>, pPipelines=0x7ffff491ce18) at /home/projects/vulkan-projects/Vulkan-ValidationLayers/layers/generated/layer_chassis_dispatch.cpp:217
#12 0x00007fffdebc41b7 in vulkan_layer_chassis::CreateGraphicsPipelines (device=0x7ffff06e2050, pipelineCache=0x0, createInfoCount=1, pCreateInfos=0x7ffff491ce50, pAllocator=0x555555f26b00 <customAllocCallbacks.35049>, pPipelines=0x7ffff491ce18) at /home/projects/vulkan-projects/Vulkan-ValidationLayers/layers/generated/chassis.cpp:726
If I either disable VkPipelineMultisampleStateCreateInfo::alphaToCoverageEnable or prevent the FS from writing to the output sample mask, there is no crash.
I don't have a public test program handy, but I could provide something privately.