mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 18:50:10 +01:00
radeonsi: determine the rasterization primitive type accurately (v2)
v2: reworked version to fix bugs and make it more efficient Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
This commit is contained in:
parent
a4b3eea325
commit
f66ee5af2f
4 changed files with 38 additions and 8 deletions
|
|
@ -1787,6 +1787,18 @@ static inline bool util_prim_is_points_or_lines(unsigned prim)
|
|||
(1 << PIPE_PRIM_POINTS))) != 0;
|
||||
}
|
||||
|
||||
static inline bool util_rast_prim_is_triangles(unsigned prim)
|
||||
{
|
||||
return ((1 << prim) & ((1 << PIPE_PRIM_TRIANGLES) |
|
||||
(1 << PIPE_PRIM_TRIANGLE_STRIP) |
|
||||
(1 << PIPE_PRIM_TRIANGLE_FAN) |
|
||||
(1 << PIPE_PRIM_QUADS) |
|
||||
(1 << PIPE_PRIM_QUAD_STRIP) |
|
||||
(1 << PIPE_PRIM_POLYGON) |
|
||||
(1 << PIPE_PRIM_TRIANGLES_ADJACENCY) |
|
||||
(1 << PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if there is enough memory in VRAM and GTT for the buffers
|
||||
* added so far.
|
||||
|
|
|
|||
|
|
@ -354,6 +354,7 @@ struct si_shader_selector {
|
|||
unsigned pa_cl_vs_out_cntl;
|
||||
ubyte clipdist_mask;
|
||||
ubyte culldist_mask;
|
||||
unsigned rast_prim;
|
||||
|
||||
/* ES parameters. */
|
||||
unsigned esgs_itemsize; /* vertex stride */
|
||||
|
|
|
|||
|
|
@ -1787,15 +1787,18 @@ static void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *i
|
|||
* This must be done after si_decompress_textures, which can call
|
||||
* draw_vbo recursively, and before si_update_shaders, which uses
|
||||
* current_rast_prim for this draw_vbo call. */
|
||||
if (sctx->gs_shader.cso)
|
||||
rast_prim = sctx->gs_shader.cso->gs_output_prim;
|
||||
else if (sctx->tes_shader.cso) {
|
||||
if (sctx->tes_shader.cso->info.properties[TGSI_PROPERTY_TES_POINT_MODE])
|
||||
rast_prim = PIPE_PRIM_POINTS;
|
||||
else
|
||||
rast_prim = sctx->tes_shader.cso->info.properties[TGSI_PROPERTY_TES_PRIM_MODE];
|
||||
} else
|
||||
if (sctx->gs_shader.cso) {
|
||||
/* Only possibilities: POINTS, LINE_STRIP, TRIANGLES */
|
||||
rast_prim = sctx->gs_shader.cso->rast_prim;
|
||||
} else if (sctx->tes_shader.cso) {
|
||||
/* Only possibilities: POINTS, LINE_STRIP, TRIANGLES */
|
||||
rast_prim = sctx->tes_shader.cso->rast_prim;
|
||||
} else if (util_rast_prim_is_triangles(prim)) {
|
||||
rast_prim = PIPE_PRIM_TRIANGLES;
|
||||
} else {
|
||||
/* Only possibilities, POINTS, LINE*, RECTANGLES */
|
||||
rast_prim = prim;
|
||||
}
|
||||
|
||||
if (rast_prim != sctx->current_rast_prim) {
|
||||
if (util_prim_is_points_or_lines(sctx->current_rast_prim) !=
|
||||
|
|
|
|||
|
|
@ -2670,6 +2670,12 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
|
|||
case PIPE_SHADER_GEOMETRY:
|
||||
sel->gs_output_prim =
|
||||
sel->info.properties[TGSI_PROPERTY_GS_OUTPUT_PRIM];
|
||||
|
||||
/* Only possibilities: POINTS, LINE_STRIP, TRIANGLES */
|
||||
sel->rast_prim = sel->gs_output_prim;
|
||||
if (util_rast_prim_is_triangles(sel->rast_prim))
|
||||
sel->rast_prim = PIPE_PRIM_TRIANGLES;
|
||||
|
||||
sel->gs_max_out_vertices =
|
||||
sel->info.properties[TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES];
|
||||
sel->gs_num_invocations =
|
||||
|
|
@ -2738,6 +2744,14 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
|
|||
sel->esgs_itemsize += 4;
|
||||
|
||||
assert(((sel->esgs_itemsize / 4) & C_028AAC_ITEMSIZE) == 0);
|
||||
|
||||
/* Only for TES: */
|
||||
if (sel->info.properties[TGSI_PROPERTY_TES_POINT_MODE])
|
||||
sel->rast_prim = PIPE_PRIM_POINTS;
|
||||
else if (sel->info.properties[TGSI_PROPERTY_TES_PRIM_MODE] == PIPE_PRIM_LINES)
|
||||
sel->rast_prim = PIPE_PRIM_LINE_STRIP;
|
||||
else
|
||||
sel->rast_prim = PIPE_PRIM_TRIANGLES;
|
||||
break;
|
||||
|
||||
case PIPE_SHADER_FRAGMENT:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue