Mesa (main): tu: allow dynamic primitive topology with tessellation
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Aug 12 01:56:36 UTC 2021
Module: Mesa
Branch: main
Commit: 4b8f4bae01360a69e05889c66764231b92aa7495
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4b8f4bae01360a69e05889c66764231b92aa7495
Author: Hyunjun Ko <zzoon at igalia.com>
Date: Tue Aug 10 05:06:36 2021 +0000
tu: allow dynamic primitive topology with tessellation
This allows to set VK_PRIMITIVE_TOPOLOGY_PATCH_LIST dynamically when
tessellation used.
If other values are set via vkCmdSetPrimitiveTopologyEXT for the case,
the validation layer can detect the issue.
Fixes dEQP-VK.pipeline.extended_dynamic_state.*.topology_patch*
Signed-off-by: Hyunjun Ko <zzoon at igalia.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12299>
---
src/freedreno/vulkan/tu_cmd_buffer.c | 14 ++++++++++++--
src/freedreno/vulkan/tu_pipeline.c | 2 --
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/freedreno/vulkan/tu_cmd_buffer.c b/src/freedreno/vulkan/tu_cmd_buffer.c
index 017f0720e4a..43e42141c86 100644
--- a/src/freedreno/vulkan/tu_cmd_buffer.c
+++ b/src/freedreno/vulkan/tu_cmd_buffer.c
@@ -3790,8 +3790,18 @@ tu_draw_initiator(struct tu_cmd_buffer *cmd, enum pc_di_src_sel src_sel)
const struct tu_pipeline *pipeline = cmd->state.pipeline;
enum pc_di_primtype primtype = pipeline->ia.primtype;
- if (pipeline->dynamic_state_mask & BIT(TU_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY))
- primtype = cmd->state.primtype;
+ if (pipeline->dynamic_state_mask & BIT(TU_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY)) {
+ if (primtype < DI_PT_PATCHES0) {
+ /* If tesselation used, only VK_PRIMITIVE_TOPOLOGY_PATCH_LIST can be
+ * set via vkCmdSetPrimitiveTopologyEXT, but primtype is already
+ * calculated at the pipeline creation based on control points
+ * for each patch.
+ *
+ * Just use the primtype as is for the case.
+ */
+ primtype = cmd->state.primtype;
+ }
+ }
uint32_t initiator =
CP_DRAW_INDX_OFFSET_0_PRIM_TYPE(primtype) |
diff --git a/src/freedreno/vulkan/tu_pipeline.c b/src/freedreno/vulkan/tu_pipeline.c
index ac315b29437..15a39aa80db 100644
--- a/src/freedreno/vulkan/tu_pipeline.c
+++ b/src/freedreno/vulkan/tu_pipeline.c
@@ -2633,8 +2633,6 @@ tu_pipeline_builder_parse_tessellation(struct tu_pipeline_builder *builder,
const VkPipelineTessellationStateCreateInfo *tess_info =
builder->create_info->pTessellationState;
- assert(!(pipeline->dynamic_state_mask & BIT(TU_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY)));
-
assert(pipeline->ia.primtype == DI_PT_PATCHES0);
assert(tess_info->patchControlPoints <= 32);
pipeline->ia.primtype += tess_info->patchControlPoints;
More information about the mesa-commit
mailing list