anv: fix dynamic primitive topology for tess

this needs to use the pre-converted topology using tess state patch control points

Fixes: f6fa4a8000 ("anv: add support for dynamic primitive topology change")

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11332>
(cherry picked from commit 24342e499b)
This commit is contained in:
Mike Blumenkrantz 2021-06-11 17:47:53 -04:00 committed by Eric Engestrom
parent 3771988c55
commit f3f253a694
3 changed files with 3 additions and 16 deletions

View file

@ -1075,7 +1075,7 @@
"description": "anv: fix dynamic primitive topology for tess",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "f6fa4a8000053fc6e9a25a30f482c59466390898"
},

View file

@ -1926,20 +1926,7 @@ copy_non_dynamic_state(struct anv_graphics_pipeline *pipeline,
if (states & ANV_CMD_DIRTY_DYNAMIC_PRIMITIVE_TOPOLOGY) {
assert(pCreateInfo->pInputAssemblyState);
bool has_tess = false;
for (uint32_t i = 0; i < pCreateInfo->stageCount; i++) {
const VkPipelineShaderStageCreateInfo *sinfo = &pCreateInfo->pStages[i];
gl_shader_stage stage = vk_to_mesa_shader_stage(sinfo->stage);
if (stage == MESA_SHADER_TESS_CTRL || stage == MESA_SHADER_TESS_EVAL)
has_tess = true;
}
if (has_tess) {
const VkPipelineTessellationStateCreateInfo *tess_info =
pCreateInfo->pTessellationState;
dynamic->primitive_topology = _3DPRIM_PATCHLIST(tess_info->patchControlPoints);
} else {
dynamic->primitive_topology = pCreateInfo->pInputAssemblyState->topology;
}
dynamic->primitive_topology = pCreateInfo->pInputAssemblyState->topology;
}
/* Section 9.2 of the Vulkan 1.0.15 spec says:

View file

@ -637,7 +637,7 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer)
ANV_CMD_DIRTY_DYNAMIC_PRIMITIVE_TOPOLOGY)) {
uint32_t topology;
if (anv_pipeline_has_stage(pipeline, MESA_SHADER_TESS_EVAL))
topology = d->primitive_topology;
topology = pipeline->topology;
else
topology = genX(vk_to_gen_primitive_type)[d->primitive_topology];