radv/gfx10: Move NGG output handling outside of giant if-statement.

In merged shaders we put a big if around each shader, so both stages
can have a different number of threads. However, the NGG output code
still needs to run if the first shader is not executed.

This can happen when there are more gs threads than vs/es threads, or
when there are 0 es/vs threads (why? no clue).

Fixes: ee21bd7440 "radv/gfx10: implement NGG support (VS only)"
Reviewed-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Bas Nieuwenhuizen
2019-07-08 01:19:55 +02:00
parent 703efab7e4
commit 4d118ad44a

View File

@@ -3647,10 +3647,10 @@ handle_shader_outputs_post(struct ac_shader_abi *abi, unsigned max_outputs,
case MESA_SHADER_VERTEX:
if (ctx->options->key.vs.out.as_ls)
handle_ls_outputs_post(ctx);
else if (ctx->options->key.vs.out.as_ngg)
break; /* handled outside of the shader body */
else if (ctx->options->key.vs.out.as_es)
handle_es_outputs_post(ctx, &ctx->shader_info->vs.es_info);
else if (ctx->options->key.vs.out.as_ngg)
handle_ngg_outputs_post(ctx);
else
handle_vs_outputs_post(ctx, ctx->options->key.vs.out.export_prim_id,
ctx->options->key.vs.out.export_layer_id,
@@ -4023,6 +4023,14 @@ LLVMModuleRef ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm,
LLVMPositionBuilderAtEnd(ctx.ac.builder, merge_block);
}
/* This needs to be outside the if wrapping the shader body, as sometimes
* the HW generates waves with 0 es/vs threads. */
if (is_pre_gs_stage(shaders[i]->info.stage) &&
ctx.options->key.vs.out.as_ngg &&
i == shader_count - 1) {
handle_ngg_outputs_post(&ctx);
}
if (shaders[i]->info.stage == MESA_SHADER_GEOMETRY) {
shader_info->gs.gsvs_vertex_size = ctx.gsvs_vertex_size;
shader_info->gs.max_gsvs_emit_size = ctx.max_gsvs_emit_size;