radeonsi: set current_rast_prim at bind time for tess and GS
It doesn't have to be done in draw_vbo. Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8434>
This commit is contained in:
parent
2edfb27913
commit
7581743510
|
@ -1949,36 +1949,33 @@ static void si_draw_vbo(struct pipe_context *ctx,
|
||||||
*
|
*
|
||||||
* This must be done after si_decompress_textures, which can call
|
* This must be done after si_decompress_textures, which can call
|
||||||
* draw_vbo recursively, and before si_update_shaders, which uses
|
* draw_vbo recursively, and before si_update_shaders, which uses
|
||||||
* current_rast_prim for this draw_vbo call. */
|
* current_rast_prim for this draw_vbo call.
|
||||||
enum pipe_prim_type rast_prim;
|
*/
|
||||||
|
if (!HAS_GS && !HAS_TESS) {
|
||||||
|
enum pipe_prim_type rast_prim;
|
||||||
|
|
||||||
if (HAS_GS) {
|
if (util_rast_prim_is_triangles(prim)) {
|
||||||
/* Only possibilities: POINTS, LINE_STRIP, TRIANGLES */
|
rast_prim = PIPE_PRIM_TRIANGLES;
|
||||||
rast_prim = sctx->gs_shader.cso->rast_prim;
|
} else {
|
||||||
} else if (HAS_TESS) {
|
/* Only possibilities, POINTS, LINE*, RECTANGLES */
|
||||||
/* Only possibilities: POINTS, LINE_STRIP, TRIANGLES */
|
rast_prim = prim;
|
||||||
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 (rast_prim != sctx->current_rast_prim) {
|
||||||
if (util_prim_is_points_or_lines(sctx->current_rast_prim) !=
|
if (util_prim_is_points_or_lines(sctx->current_rast_prim) !=
|
||||||
util_prim_is_points_or_lines(rast_prim))
|
util_prim_is_points_or_lines(rast_prim))
|
||||||
si_mark_atom_dirty(sctx, &sctx->atoms.s.guardband);
|
si_mark_atom_dirty(sctx, &sctx->atoms.s.guardband);
|
||||||
|
|
||||||
sctx->current_rast_prim = rast_prim;
|
sctx->current_rast_prim = rast_prim;
|
||||||
sctx->do_update_shaders = true;
|
sctx->do_update_shaders = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update NGG culling settings. */
|
/* Update NGG culling settings. */
|
||||||
uint8_t old_ngg_culling = sctx->ngg_culling;
|
uint8_t old_ngg_culling = sctx->ngg_culling;
|
||||||
if (GFX_VERSION >= GFX10) {
|
if (GFX_VERSION >= GFX10) {
|
||||||
struct si_shader_selector *hw_vs;
|
struct si_shader_selector *hw_vs;
|
||||||
if (NGG && !dispatch_prim_discard_cs && rast_prim == PIPE_PRIM_TRIANGLES &&
|
if (NGG && !dispatch_prim_discard_cs && sctx->current_rast_prim == PIPE_PRIM_TRIANGLES &&
|
||||||
(hw_vs = si_get_vs_inline(sctx, HAS_TESS, HAS_GS)->cso) &&
|
(hw_vs = si_get_vs_inline(sctx, HAS_TESS, HAS_GS)->cso) &&
|
||||||
(total_direct_count > hw_vs->ngg_cull_vert_threshold ||
|
(total_direct_count > hw_vs->ngg_cull_vert_threshold ||
|
||||||
(!index_size &&
|
(!index_size &&
|
||||||
|
|
|
@ -2942,6 +2942,30 @@ static void si_update_clip_regs(struct si_context *sctx, struct si_shader_select
|
||||||
si_mark_atom_dirty(sctx, &sctx->atoms.s.clip_regs);
|
si_mark_atom_dirty(sctx, &sctx->atoms.s.clip_regs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void si_update_rasterized_prim(struct si_context *sctx)
|
||||||
|
{
|
||||||
|
enum pipe_prim_type rast_prim;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
/* Determined by draw calls. */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rast_prim != sctx->current_rast_prim) {
|
||||||
|
if (util_prim_is_points_or_lines(sctx->current_rast_prim) !=
|
||||||
|
util_prim_is_points_or_lines(rast_prim))
|
||||||
|
si_mark_atom_dirty(sctx, &sctx->atoms.s.guardband);
|
||||||
|
|
||||||
|
sctx->current_rast_prim = rast_prim;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void si_update_common_shader_state(struct si_context *sctx, struct si_shader_selector *sel,
|
static void si_update_common_shader_state(struct si_context *sctx, struct si_shader_selector *sel,
|
||||||
enum pipe_shader_type type)
|
enum pipe_shader_type type)
|
||||||
{
|
{
|
||||||
|
@ -2988,6 +3012,7 @@ static void si_bind_vs_shader(struct pipe_context *ctx, void *state)
|
||||||
si_update_streamout_state(sctx);
|
si_update_streamout_state(sctx);
|
||||||
si_update_clip_regs(sctx, old_hw_vs, old_hw_vs_variant, si_get_vs(sctx)->cso,
|
si_update_clip_regs(sctx, old_hw_vs, old_hw_vs_variant, si_get_vs(sctx)->cso,
|
||||||
si_get_vs(sctx)->current);
|
si_get_vs(sctx)->current);
|
||||||
|
si_update_rasterized_prim(sctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void si_update_tess_uses_prim_id(struct si_context *sctx)
|
static void si_update_tess_uses_prim_id(struct si_context *sctx)
|
||||||
|
@ -3069,6 +3094,7 @@ static void si_bind_gs_shader(struct pipe_context *ctx, void *state)
|
||||||
si_update_streamout_state(sctx);
|
si_update_streamout_state(sctx);
|
||||||
si_update_clip_regs(sctx, old_hw_vs, old_hw_vs_variant, si_get_vs(sctx)->cso,
|
si_update_clip_regs(sctx, old_hw_vs, old_hw_vs_variant, si_get_vs(sctx)->cso,
|
||||||
si_get_vs(sctx)->current);
|
si_get_vs(sctx)->current);
|
||||||
|
si_update_rasterized_prim(sctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void si_bind_tcs_shader(struct pipe_context *ctx, void *state)
|
static void si_bind_tcs_shader(struct pipe_context *ctx, void *state)
|
||||||
|
@ -3119,6 +3145,7 @@ static void si_bind_tes_shader(struct pipe_context *ctx, void *state)
|
||||||
si_update_streamout_state(sctx);
|
si_update_streamout_state(sctx);
|
||||||
si_update_clip_regs(sctx, old_hw_vs, old_hw_vs_variant, si_get_vs(sctx)->cso,
|
si_update_clip_regs(sctx, old_hw_vs, old_hw_vs_variant, si_get_vs(sctx)->cso,
|
||||||
si_get_vs(sctx)->current);
|
si_get_vs(sctx)->current);
|
||||||
|
si_update_rasterized_prim(sctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void si_bind_ps_shader(struct pipe_context *ctx, void *state)
|
static void si_bind_ps_shader(struct pipe_context *ctx, void *state)
|
||||||
|
|
Loading…
Reference in New Issue