draw: change geom shader output to an array of outputs.

Instead of a single output ptr, pass in one per output stream.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3530>
This commit is contained in:
Dave Airlie
2020-01-23 16:17:25 +10:00
committed by Marge Bot
parent 8583fcd8f1
commit 0c77007c9d
4 changed files with 20 additions and 12 deletions
+15 -9
View File
@@ -321,7 +321,7 @@ llvm_fetch_gs_outputs(struct draw_geometry_shader *shader,
int vertex_count = 0;
int total_prims = 0;
int max_prims_per_invocation = 0;
char *output_ptr = (char*)shader->gs_output;
char *output_ptr = (char*)shader->gs_output[stream];
int i, j, prim_idx;
unsigned next_prim_boundary = shader->primitive_boundary;
@@ -402,20 +402,24 @@ static void
llvm_gs_run(struct draw_geometry_shader *shader,
unsigned input_primitives, unsigned *out_prims)
{
unsigned ret;
char *input = (char*)shader->gs_output;
struct vertex_header *input[PIPE_MAX_VERTEX_STREAMS];
for (unsigned i = 0; i < shader->num_vertex_streams; i++) {
char *tmp = (char *)shader->gs_output[i];
tmp += shader->stream[i].emitted_vertices * shader->vertex_size;
input[i] = (struct vertex_header *)tmp;
}
input += (shader->stream[0].emitted_vertices * shader->vertex_size);
ret = shader->current_variant->jit_func(
shader->current_variant->jit_func(
shader->jit_context, shader->gs_input->data,
(struct vertex_header*)input,
input,
input_primitives,
shader->draw->instance_id,
shader->llvm_prim_ids,
shader->invocation_id);
*out_prims = ret;
for (unsigned i = 0; i < shader->num_vertex_streams; i++) {
out_prims[i] = shader->jit_context->emitted_prims[i];
}
}
#endif
@@ -634,7 +638,9 @@ int draw_geometry_shader_run(struct draw_geometry_shader *shader,
#ifdef LLVM_AVAILABLE
if (shader->draw->llvm) {
shader->gs_output = output_verts[0].verts;
for (i = 0; i < shader->num_vertex_streams; i++) {
shader->gs_output[i] = output_verts[i].verts;
}
if (max_out_prims > shader->max_out_prims) {
unsigned i;
if (shader->llvm_prim_lengths) {
+1 -1
View File
@@ -100,7 +100,7 @@ struct draw_geometry_shader {
struct draw_gs_inputs *gs_input;
struct draw_gs_jit_context *jit_context;
struct draw_gs_llvm_variant *current_variant;
struct vertex_header *gs_output;
struct vertex_header *gs_output[PIPE_MAX_VERTEX_STREAMS];
int **llvm_prim_lengths;
int *llvm_emitted_primitives;
+3 -1
View File
@@ -1557,6 +1557,8 @@ draw_gs_llvm_emit_vertex(const struct lp_build_gs_iface *gs_base,
indices[i] = LLVMBuildAdd(builder, indices[i], currently_emitted, "");
}
io = lp_build_pointer_get(builder, io, LLVMBuildExtractElement(builder, stream_id, lp_build_const_int32(gallivm, 0), ""));
convert_to_aos(gallivm, io, indices,
outputs, clipmask,
gs_info->num_outputs, gs_type,
@@ -2432,7 +2434,7 @@ draw_gs_llvm_generate(struct draw_llvm *llvm,
arg_types[0] = get_gs_context_ptr_type(variant); /* context */
arg_types[1] = variant->input_array_type; /* input */
arg_types[2] = variant->vertex_header_ptr_type; /* vertex_header */
arg_types[2] = LLVMPointerType(variant->vertex_header_ptr_type, 0); /* vertex_header */
arg_types[3] = int32_type; /* num_prims */
arg_types[4] = int32_type; /* instance_id */
arg_types[5] = LLVMPointerType(
+1 -1
View File
@@ -335,7 +335,7 @@ typedef boolean
typedef int
(*draw_gs_jit_func)(struct draw_gs_jit_context *context,
float inputs[6][PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS][TGSI_NUM_CHANNELS],
struct vertex_header *output,
struct vertex_header **output,
unsigned num_prims,
unsigned instance_id,
int *prim_ids,