gallivm/draw/gs: pass vertex stream count into shader build

The shader builder can avoid iterations using this info.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5555>
This commit is contained in:
Dave Airlie 2020-06-19 14:54:16 +10:00
parent 99ae39f76c
commit 903b5814b5
4 changed files with 6 additions and 2 deletions

View file

@ -2855,6 +2855,7 @@ draw_gs_llvm_generate(struct draw_llvm *llvm,
params.ssbo_ptr = ssbos_ptr;
params.ssbo_sizes_ptr = num_ssbos_ptr;
params.image = image;
params.gs_vertex_streams = variant->shader->base.num_vertex_streams;
if (llvm->draw->gs.geometry_shader->state.type == PIPE_SHADER_IR_TGSI)
lp_build_tgsi_soa(variant->gallivm,

View file

@ -235,6 +235,7 @@ struct lp_build_nir_soa_context
LLVMValueRef inputs_array;
LLVMValueRef kernel_args_ptr;
unsigned gs_vertex_streams;
};
bool

View file

@ -1879,9 +1879,10 @@ void lp_build_nir_soa(struct gallivm_state *gallivm,
if (bld.gs_iface) {
struct lp_build_context *uint_bld = &bld.bld_base.uint_bld;
bld.gs_vertex_streams = params->gs_vertex_streams;
bld.max_output_vertices_vec = lp_build_const_int_vec(gallivm, bld.bld_base.int_bld.type,
shader->info.gs.vertices_out);
for (int i = 0; i < PIPE_MAX_VERTEX_STREAMS; i++) {
for (int i = 0; i < params->gs_vertex_streams; i++) {
bld.emitted_prims_vec_ptr[i] =
lp_build_alloca(gallivm, uint_bld->vec_type, "emitted_prims_ptr");
bld.emitted_vertices_vec_ptr[i] =
@ -1904,7 +1905,7 @@ void lp_build_nir_soa(struct gallivm_state *gallivm,
LLVMValueRef total_emitted_vertices_vec;
LLVMValueRef emitted_prims_vec;
for (int i = 0; i < PIPE_MAX_VERTEX_STREAMS; i++) {
for (int i = 0; i < params->gs_vertex_streams; i++) {
end_primitive_masked(&bld.bld_base, lp_build_mask_value(bld.mask), i);
total_emitted_vertices_vec =

View file

@ -279,6 +279,7 @@ struct lp_build_tgsi_params {
const struct lp_build_coro_suspend_info *coro;
LLVMValueRef kernel_args;
const struct lp_build_fs_iface *fs_iface;
unsigned gs_vertex_streams;
};
void