From: Samuel Pitoiset Date: Tue, 3 Sep 2019 16:16:33 +0000 (+0200) Subject: radv: calculate the GSVS vertex size in the shader info pass X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7fa00e178f871f48972ecb9947e04a2b2db16f81;p=mesa.git radv: calculate the GSVS vertex size in the shader info pass Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c index e0503908ee3..0ba81322ac0 100644 --- a/src/amd/vulkan/radv_nir_to_llvm.c +++ b/src/amd/vulkan/radv_nir_to_llvm.c @@ -108,8 +108,6 @@ struct radv_shader_context { uint32_t tcs_num_inputs; uint32_t tcs_num_patches; - uint32_t max_gsvs_emit_size; - uint32_t gsvs_vertex_size; LLVMValueRef vertexptr; /* GFX10 only */ }; @@ -3605,7 +3603,7 @@ static void gfx10_ngg_gs_emit_vertex(struct radv_shader_context *ctx, LLVMBuildStore(builder, out_val, ptr); } } - assert(out_idx * 4 <= ctx->gsvs_vertex_size); + assert(out_idx * 4 <= ctx->shader_info->gs.gsvs_vertex_size); /* Determine and store whether this vertex completed a primitive. */ const LLVMValueRef curverts = LLVMBuildLoad(builder, ctx->gs_curprim_verts[stream], ""); @@ -4282,14 +4280,6 @@ LLVMModuleRef ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm, nir_foreach_variable(variable, &shaders[i]->outputs) scan_shader_output_decl(&ctx, variable, shaders[i], shaders[i]->info.stage); - if (shaders[i]->info.stage == MESA_SHADER_GEOMETRY) { - unsigned addclip = shaders[i]->info.clip_distance_array_size + - shaders[i]->info.cull_distance_array_size > 4; - ctx.gsvs_vertex_size = (util_bitcount64(ctx.output_mask) + addclip) * 16; - ctx.max_gsvs_emit_size = ctx.gsvs_vertex_size * - shaders[i]->info.gs.vertices_out; - } - ac_setup_rings(&ctx); LLVMBasicBlockRef merge_block; @@ -4332,10 +4322,7 @@ LLVMModuleRef ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm, gfx10_ngg_gs_emit_epilogue_2(&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; - } else if (shaders[i]->info.stage == MESA_SHADER_TESS_CTRL) { + if (shaders[i]->info.stage == MESA_SHADER_TESS_CTRL) { shader_info->tcs.num_patches = ctx.tcs_num_patches; shader_info->tcs.lds_size = calculate_tess_lds_size(&ctx); } diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c index 7f2d9752948..065cec3e0e7 100644 --- a/src/amd/vulkan/radv_shader_info.c +++ b/src/amd/vulkan/radv_shader_info.c @@ -744,4 +744,13 @@ radv_nir_shader_info_pass(const struct nir_shader *nir, default: break; } + + if (nir->info.stage == MESA_SHADER_GEOMETRY) { + unsigned add_clip = nir->info.clip_distance_array_size + + nir->info.cull_distance_array_size > 4; + info->gs.gsvs_vertex_size = + (util_bitcount64(nir->info.outputs_written) + add_clip) * 16; + info->gs.max_gsvs_emit_size = + info->gs.gsvs_vertex_size * nir->info.gs.vertices_out; + } }