Module: Mesa Branch: main Commit: cb05c85abd90a4456b72497738307d9d42e56225 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cb05c85abd90a4456b72497738307d9d42e56225
Author: Timur Kristóf <[email protected]> Date: Fri Sep 17 21:35:25 2021 +0200 radv: Disable HW generated edge flags for NGG shaders. Vulkan doesn't support user edge flags, and also doesn't have any decomposed primitives where drawing internal edges should be disallowed. Hence, we don't need this. Signed-off-by: Timur Kristóf <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12998> --- src/amd/vulkan/radv_pipeline.c | 16 ---------------- src/amd/vulkan/si_cmd_buffer.c | 9 +++++++++ 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index 7da3a7bb0c5..30caf4b8326 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -4635,22 +4635,6 @@ radv_pipeline_generate_hw_ngg(struct radeon_cmdbuf *ctx_cs, struct radeon_cmdbuf S_028B90_CNT(gs_num_invocations) | S_028B90_ENABLE(gs_num_invocations > 1) | S_028B90_EN_MAX_VERT_OUT_PER_GS_INSTANCE(ngg_state->max_vert_out_per_gs_instance)); - /* User edge flags are set by the pos exports. If user edge flags are - * not used, we must use hw-generated edge flags and pass them via - * the prim export to prevent drawing lines on internal edges of - * decomposed primitives (such as quads) with polygon mode = lines. - * - * TODO: We should combine hw-generated edge flags with user edge - * flags in the shader. - */ - radeon_set_context_reg( - ctx_cs, R_028838_PA_CL_NGG_CNTL, - S_028838_INDEX_BUF_EDGE_FLAG_ENA(!radv_pipeline_has_tess(pipeline) && - !radv_pipeline_has_gs(pipeline)) | - /* Reuse for NGG. */ - S_028838_VERTEX_REUSE_DEPTH( - pipeline->device->physical_device->rad_info.chip_class >= GFX10_3 ? 30 : 0)); - ge_cntl = S_03096C_PRIM_GRP_SIZE(ngg_state->max_gsprims) | S_03096C_VERT_GRP_SIZE(ngg_state->enable_vertex_grouping ? ngg_state->hw_max_esverts : 256) | /* 256 = disable vertex grouping */ S_03096C_BREAK_WAVE_AT_EOI(break_wave_at_eoi); diff --git a/src/amd/vulkan/si_cmd_buffer.c b/src/amd/vulkan/si_cmd_buffer.c index f95cd0e88cc..86fa0b04288 100644 --- a/src/amd/vulkan/si_cmd_buffer.c +++ b/src/amd/vulkan/si_cmd_buffer.c @@ -369,6 +369,15 @@ si_emit_graphics(struct radv_device *device, struct radeon_cmdbuf *cs) radeon_set_context_reg(cs, R_028C50_PA_SC_NGG_MODE_CNTL, S_028C50_MAX_DEALLOCS_IN_WAVE(512)); radeon_set_context_reg(cs, R_028C58_VGT_VERTEX_REUSE_BLOCK_CNTL, 14); + /* Vulkan doesn't support user edge flags and it also doesn't + * need to prevent drawing lines on internal edges of + * decomposed primitives (such as quads) with polygon mode = lines. + */ + unsigned vertex_reuse_depth = physical_device->rad_info.chip_class >= GFX10_3 ? 30 : 0; + radeon_set_context_reg(cs, R_028838_PA_CL_NGG_CNTL, + S_028838_INDEX_BUF_EDGE_FLAG_ENA(0) | + S_028838_VERTEX_REUSE_DEPTH(vertex_reuse_depth)); + /* Enable CMASK/FMASK/HTILE/DCC caching in L2 for small chips. */ unsigned meta_write_policy, meta_read_policy;
