From d8435c1628ce6659e28c0f0625c9af42f3a19860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Mon, 19 Oct 2020 11:49:05 +0200 Subject: [PATCH] aco/ngg: Add assertion to make sure we always know the vertex count. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just a sanity check to avoid hangs caused by missing this in the future. Signed-off-by: Timur Kristóf Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/compiler/aco_instruction_selection.cpp | 5 +++++ src/amd/compiler/aco_instruction_selection.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index c57b6709ac6..c1ff5faf046 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -6934,6 +6934,8 @@ void ngg_visit_set_vertex_and_primitive_count(isel_context *ctx, nir_intrinsic_i if (!ctx->args->shader_info->gs.num_stream_output_components[stream]) return; + ctx->ngg_gs_known_vtxcnt[stream] = true; + /* Clear the primitive flags of non-emitted GS vertices. */ if (!nir_src_is_const(instr->src[0]) || nir_src_as_uint(instr->src[0]) < ctx->shader->info.gs.vertices_out) { Temp vtx_cnt = get_ssa_temp(ctx, instr->src[0].ssa); @@ -11577,6 +11579,9 @@ void ngg_gs_prelude(isel_context *ctx) void ngg_gs_finale(isel_context *ctx) { + /* Sanity check. Make sure the vertex/primitive counts are set and the LDS is correctly initialized. */ + assert(ctx->ngg_gs_known_vtxcnt[0]); + if_context ic; Builder bld(ctx->program, ctx->block); diff --git a/src/amd/compiler/aco_instruction_selection.h b/src/amd/compiler/aco_instruction_selection.h index 360f7db38b3..5aa7f0a3599 100644 --- a/src/amd/compiler/aco_instruction_selection.h +++ b/src/amd/compiler/aco_instruction_selection.h @@ -95,6 +95,7 @@ struct isel_context { /* GS inputs */ bool ngg_nogs_early_prim_export = false; bool ngg_gs_early_alloc = false; + bool ngg_gs_known_vtxcnt[4] = {false, false, false, false}; Temp gs_wave_id; unsigned ngg_gs_emit_addr = 0; unsigned ngg_gs_emit_vtx_bytes = 0;