KhronosGroup / Vulkan-ValidationLayers

Vulkan Validation Layers (VVL)
https://vulkan.lunarg.com/doc/sdk/latest/linux/khronos_validation_layer.html
Other
751 stars 402 forks source link

Crash with dynamic rendering + advanced blend + graphics pipeline library #8202

Closed ShabbyX closed 3 months ago

ShabbyX commented 3 months ago

When VK_EXT_graphics_pipeline_library, VK_EXT_blend_operation_advanced and VK_KHR_dynamic_rendering are simultaneously used, the following piece of code in cc_pipeline_graphics.cpp crashes during draw-time validation:

            if (advance_blend) {
                const uint32_t color_attachment_count = pipeline.rendering_create_info
                                                            ? pipeline.rendering_create_info->colorAttachmentCount
                                                            : subpass_desc->colorAttachmentCount;

The crux of the issue is that pipeline is created out of libraries. The libraries have rendering create info on them, but the linked pipeline neither has a rendering create info nor a render pass. The code above assumes there must be a render pass because there is no rendering create info, which leads to crash.

The color attachment count should be taken from the fragment output library per https://docs.vulkan.org/spec/latest/chapters/pipelines.html#pipelines-graphics-subsets-fragment-output

ShabbyX commented 3 months ago

Should be pretty easy to repro in a test, but if you want something ready to test, take this work-in-progress ANGLE change: https://chromium-review.googlesource.com/c/angle/angle/+/5637155 and run:

$ ./angle_deqp_khr_gles31_tests --use-angle=swiftshader --deqp-case=KHR-GLES31.core.blend_equation_advanced.blend_all.*

Note that support for VK_KHR_dynamic_rendering_local_read was recently added to SwiftShader for testing purposes, so you'd need to sync to ToT of ANGLE, and don't forget gclient sync!

spencer-lunarg commented 3 months ago

thanks, taking a look now, but looking at the code more now, the other issue is we split up pipeline and mix-and-match the renderpass and dynamic-rendering case and it opens to not catching a case like this... going to slightly clean things up to be 2 separate path (with reference, not pointer) so it is clear where in the code a future check is added

spencer-lunarg commented 3 months ago

@ShabbyX ran with --deqp-case=KHR-GLES31.core.* as well and all is working fine now