tu: Ignore pTessellationState if there is no tesselation shaders
authorDanylo Piliaiev <dpiliaiev@igalia.com>
Thu, 17 Dec 2020 11:50:04 +0000 (13:50 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 17 Dec 2020 16:33:33 +0000 (16:33 +0000)
According to the spec:

"pTessellationState [...] is ignored if the pipeline does not
 include a tessellation control shader stage and tessellation
 evaluation shader stage."

Fixes crash in RenderDoc when inspecting draw call with
geometry shader but without tesselation shaders.

Fixes: eefdca2e "turnip: Parse tess state and support PATCH primtype"
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8140>

src/freedreno/vulkan/tu_pipeline.c

index 9e56b14..883d549 100644 (file)
@@ -2431,12 +2431,13 @@ static void
 tu_pipeline_builder_parse_tessellation(struct tu_pipeline_builder *builder,
                                        struct tu_pipeline *pipeline)
 {
+   if (!(pipeline->active_stages & VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) ||
+       !(pipeline->active_stages & VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT))
+      return;
+
    const VkPipelineTessellationStateCreateInfo *tess_info =
       builder->create_info->pTessellationState;
 
-   if (!tess_info)
-      return;
-
    assert(!(pipeline->dynamic_state_mask & BIT(TU_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY)));
 
    assert(pipeline->ia.primtype == DI_PT_PATCHES0);