Skip to content

Commit

Permalink
draw: fix gs vertex stream counting
Browse files Browse the repository at this point in the history
this can't be determined from pipe_shader_state::stream_output,
as this only contains xfb info, which is not the same as the vertex
stream info, and may break primitives generated queries

cc: mesa-stable

Reviewed-by: Dave Airlie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15506>
  • Loading branch information
zmike authored and Marge Bot committed Mar 23, 2022
1 parent 03d342e commit 32f117f
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/gallium/auxiliary/draw/draw_gs.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "tgsi/tgsi_parse.h"
#include "tgsi/tgsi_exec.h"
#include "nir/nir_to_tgsi_info.h"
#include "compiler/nir/nir.h"
#include "pipe/p_shader_tokens.h"

#include "util/u_math.h"
Expand Down Expand Up @@ -792,8 +793,16 @@ draw_create_geometry_shader(struct draw_context *draw,
}

tgsi_scan_shader(state->tokens, &gs->info);
} else
gs->num_vertex_streams = 1;
for (i = 0; i < gs->state.stream_output.num_outputs; i++) {
if (gs->state.stream_output.output[i].stream >= gs->num_vertex_streams)
gs->num_vertex_streams = gs->state.stream_output.output[i].stream + 1;
}
} else {
nir_tgsi_scan_shader(state->ir.nir, &gs->info, true);
nir_shader *nir = state->ir.nir;
gs->num_vertex_streams = util_last_bit(nir->info.gs.active_stream_mask);
}

/* setup the defaults */
gs->max_out_prims = 0;
Expand Down Expand Up @@ -858,12 +867,6 @@ draw_create_geometry_shader(struct draw_context *draw,

gs->machine = draw->gs.tgsi.machine;

gs->num_vertex_streams = 1;
for (i = 0; i < gs->state.stream_output.num_outputs; i++) {
if (gs->state.stream_output.output[i].stream >= gs->num_vertex_streams)
gs->num_vertex_streams = gs->state.stream_output.output[i].stream + 1;
}

#ifdef DRAW_LLVM_AVAILABLE
if (use_llvm) {
int vector_size = gs->vector_length * sizeof(float);
Expand Down

0 comments on commit 32f117f

Please sign in to comment.