Vulkan-ValidationLayers icon indicating copy to clipboard operation
Vulkan-ValidationLayers copied to clipboard

Wrong error detection on vkCmdSetPrimitiveTopologyEXT

Open asuessenbach opened this issue 5 months ago • 1 comments

Environment:

  • OS: Windows 10
  • GPU and driver version: NVIDIA RTX 3000 Laptop GPU, driver version 556.12
  • SDK or header version if building from repo: SDK version 1.3.290.0
  • Options enabled (synchronization, best practices, etc.): none

Describe the Issue

In the Vulkan-Samples repository, there's a sample extended_dynamic_state2, containing this code sequence:

		vkCmdBindPipeline(draw_cmd_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline.baseline);
		vkCmdSetPrimitiveTopologyEXT(draw_cmd_buffer, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST);

... draw some triangles here

		vkCmdSetPrimitiveTopologyEXT(draw_cmd_buffer, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP);

... draw some triangle strips here

		vkCmdBindPipeline(draw_cmd_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline.tesselation);
		vkCmdSetPrimitiveTopologyEXT(draw_cmd_buffer, VK_PRIMITIVE_TOPOLOGY_PATCH_LIST);

... draw some patches here

The pipeline.tesselation, that is bound here has VK_PRIMITIVE_TOPOLOGY_PATCH_LIST as its input_assembly_state.topology. But on drawing the patches, I get this error: Validation Error: [ VUID-vkCmdDrawIndexed-dynamicPrimitiveTopologyUnrestricted-07500 ] Object 0: handle = 0x1bf164c2290, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0xa182620000000079, type = VK_OBJECT_TYPE_PIPELINE; | MessageID = 0x66b035ea | vkCmdDrawIndexed(): the last primitive topology VK_PRIMITIVE_TOPOLOGY_PATCH_LIST state set by vkCmdSetPrimitiveTopology is not compatible with the pipeline topology VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP. The Vulkan spec states: If the bound graphics pipeline state was created with the VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY dynamic state enabled and the dynamicPrimitiveTopologyUnrestricted is VK_FALSE, then the primitiveTopology parameter of vkCmdSetPrimitiveTopology must be of the same topology class as the pipeline VkPipelineInputAssemblyStateCreateInfo::topology state (https://vulkan.lunarg.com/doc/view/1.3.290.0/windows/1.3-extensions/vkspec.html#VUID-vkCmdDrawIndexed-dynamicPrimitiveTopologyUnrestricted-07500)

Expected behavior

No error message.

Additional context

In CoreChecks::ValidateGraphicsDynamicStateValue, the pipeline.create_info.pInputAssemblyState->topology is VK_PRIMITIVE_TOPOLOGY_PATCH_LIST. But pipeline.topology_at_rasterizer, which is used to check here, is VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP. It seems, this value is not adjusted on vkCmdBindPipeline.

asuessenbach avatar Sep 26 '24 09:09 asuessenbach