From 86d931724db87466e7fe827c0c6abbf81376d805 Mon Sep 17 00:00:00 2001 From: Sagar Ghuge Date: Thu, 16 Mar 2023 16:03:41 +0200 Subject: [PATCH] anv: Implement Wa_14015297576 Disable tessellation distribution when primitive id is enabled. Signed-off-by: Sagar Ghuge Reviewed-by: Jordan Justen Part-of: --- src/intel/vulkan/gfx8_cmd_buffer.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/intel/vulkan/gfx8_cmd_buffer.c b/src/intel/vulkan/gfx8_cmd_buffer.c index 7121d8c..b7565ee 100644 --- a/src/intel/vulkan/gfx8_cmd_buffer.c +++ b/src/intel/vulkan/gfx8_cmd_buffer.c @@ -211,6 +211,24 @@ want_stencil_pma_fix(struct anv_cmd_buffer *cmd_buffer, wm_prog_data->computed_depth_mode != PSCDEPTH_OFF; } +static UNUSED bool +geom_or_tess_prim_id_used(struct anv_graphics_pipeline *pipeline) +{ + const struct brw_tcs_prog_data *tcs_prog_data = + anv_pipeline_has_stage(pipeline, MESA_SHADER_TESS_EVAL) ? + get_tcs_prog_data(pipeline) : NULL; + const struct brw_tes_prog_data *tes_prog_data = + anv_pipeline_has_stage(pipeline, MESA_SHADER_TESS_EVAL) ? + get_tes_prog_data(pipeline) : NULL; + const struct brw_gs_prog_data *gs_prog_data = + anv_pipeline_has_stage(pipeline, MESA_SHADER_GEOMETRY) ? + get_gs_prog_data(pipeline) : NULL; + + return (tcs_prog_data && tcs_prog_data->include_primitive_id) || + (tes_prog_data && tes_prog_data->include_primitive_id) || + (gs_prog_data && gs_prog_data->include_primitive_id); +} + static void genX(cmd_emit_te)(struct anv_cmd_buffer *cmd_buffer) { @@ -236,6 +254,16 @@ genX(cmd_emit_te)(struct anv_cmd_buffer *cmd_buffer) te.TessellationDistributionMode = TEDMODE_RR_STRICT; else te.TessellationDistributionMode = TEDMODE_RR_FREE; + + if (intel_needs_workaround(cmd_buffer->device->info, 14015297576)) { + /* Wa_14015297576: + * + * Disable Tessellation Distribution when primitive Id is enabled. + */ + if (geom_or_tess_prim_id_used(pipeline)) + te.TessellationDistributionMode = TEDMODE_OFF; + } + te.TessellationDistributionLevel = TEDLEVEL_PATCH; /* 64_TRIANGLES */ te.SmallPatchThreshold = 3; -- 2.7.4