radeonsi: make sure that rasterizer state != NULL and remove all NULL checking
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
This commit is contained in:
parent
8b8819e88a
commit
8d90157d49
|
@ -354,6 +354,13 @@ void *util_blitter_get_noop_dsa_state(struct blitter_context *blitter)
|
|||
return ctx->dsa_keep_depth_stencil;
|
||||
}
|
||||
|
||||
void *util_blitter_get_discard_rasterizer_state(struct blitter_context *blitter)
|
||||
{
|
||||
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
|
||||
|
||||
return ctx->rs_discard_state;
|
||||
}
|
||||
|
||||
static void bind_vs_pos_only(struct blitter_context_priv *ctx,
|
||||
unsigned num_so_channels)
|
||||
{
|
||||
|
|
|
@ -156,6 +156,7 @@ void util_blitter_destroy(struct blitter_context *blitter);
|
|||
void util_blitter_cache_all_shaders(struct blitter_context *blitter);
|
||||
void *util_blitter_get_noop_blend_state(struct blitter_context *blitter);
|
||||
void *util_blitter_get_noop_dsa_state(struct blitter_context *blitter);
|
||||
void *util_blitter_get_discard_rasterizer_state(struct blitter_context *blitter);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -550,6 +550,10 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen,
|
|||
sctx->noop_dsa = util_blitter_get_noop_dsa_state(sctx->blitter);
|
||||
sctx->queued.named.dsa = sctx->noop_dsa;
|
||||
|
||||
sctx->discard_rasterizer_state =
|
||||
util_blitter_get_discard_rasterizer_state(sctx->blitter);
|
||||
sctx->queued.named.rasterizer = sctx->discard_rasterizer_state;
|
||||
|
||||
si_init_draw_functions(sctx);
|
||||
si_initialize_prim_discard_tunables(sctx);
|
||||
}
|
||||
|
|
|
@ -888,6 +888,7 @@ struct si_context {
|
|||
struct blitter_context *blitter;
|
||||
void *noop_blend;
|
||||
void *noop_dsa;
|
||||
void *discard_rasterizer_state;
|
||||
void *custom_dsa_flush;
|
||||
void *custom_blend_resolve;
|
||||
void *custom_blend_fmask_decompress;
|
||||
|
|
|
@ -824,7 +824,7 @@ static void si_update_poly_offset_state(struct si_context *sctx)
|
|||
{
|
||||
struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;
|
||||
|
||||
if (!rs || !rs->uses_poly_offset || !sctx->framebuffer.state.zsbuf) {
|
||||
if (!rs->uses_poly_offset || !sctx->framebuffer.state.zsbuf) {
|
||||
si_pm4_bind_state(sctx, poly_offset, NULL);
|
||||
return;
|
||||
}
|
||||
|
@ -1027,10 +1027,10 @@ static void si_bind_rs_state(struct pipe_context *ctx, void *state)
|
|||
(struct si_state_rasterizer*)sctx->queued.named.rasterizer;
|
||||
struct si_state_rasterizer *rs = (struct si_state_rasterizer *)state;
|
||||
|
||||
if (!state)
|
||||
return;
|
||||
if (!rs)
|
||||
rs = (struct si_state_rasterizer *)sctx->discard_rasterizer_state;
|
||||
|
||||
if (!old_rs || old_rs->multisample_enable != rs->multisample_enable) {
|
||||
if (old_rs->multisample_enable != rs->multisample_enable) {
|
||||
si_mark_atom_dirty(sctx, &sctx->atoms.s.db_render_state);
|
||||
|
||||
/* Update the small primitive filter workaround if necessary. */
|
||||
|
@ -1045,30 +1045,25 @@ static void si_bind_rs_state(struct pipe_context *ctx, void *state)
|
|||
si_pm4_bind_state(sctx, rasterizer, rs);
|
||||
si_update_poly_offset_state(sctx);
|
||||
|
||||
if (!old_rs ||
|
||||
old_rs->scissor_enable != rs->scissor_enable)
|
||||
if (old_rs->scissor_enable != rs->scissor_enable)
|
||||
si_mark_atom_dirty(sctx, &sctx->atoms.s.scissors);
|
||||
|
||||
if (!old_rs ||
|
||||
old_rs->line_width != rs->line_width ||
|
||||
if (old_rs->line_width != rs->line_width ||
|
||||
old_rs->max_point_size != rs->max_point_size ||
|
||||
old_rs->half_pixel_center != rs->half_pixel_center)
|
||||
si_mark_atom_dirty(sctx, &sctx->atoms.s.guardband);
|
||||
|
||||
if (!old_rs ||
|
||||
old_rs->clip_halfz != rs->clip_halfz)
|
||||
if (old_rs->clip_halfz != rs->clip_halfz)
|
||||
si_mark_atom_dirty(sctx, &sctx->atoms.s.viewports);
|
||||
|
||||
if (!old_rs ||
|
||||
old_rs->clip_plane_enable != rs->clip_plane_enable ||
|
||||
if (old_rs->clip_plane_enable != rs->clip_plane_enable ||
|
||||
old_rs->pa_cl_clip_cntl != rs->pa_cl_clip_cntl)
|
||||
si_mark_atom_dirty(sctx, &sctx->atoms.s.clip_regs);
|
||||
|
||||
sctx->ia_multi_vgt_param_key.u.line_stipple_enabled =
|
||||
rs->line_stipple_enable;
|
||||
|
||||
if (!old_rs ||
|
||||
old_rs->clip_plane_enable != rs->clip_plane_enable ||
|
||||
if (old_rs->clip_plane_enable != rs->clip_plane_enable ||
|
||||
old_rs->rasterizer_discard != rs->rasterizer_discard ||
|
||||
old_rs->sprite_coord_enable != rs->sprite_coord_enable ||
|
||||
old_rs->flatshade != rs->flatshade ||
|
||||
|
|
|
@ -1768,7 +1768,6 @@ static void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *i
|
|||
}
|
||||
|
||||
if (unlikely(!sctx->vs_shader.cso ||
|
||||
!rs ||
|
||||
(!sctx->ps_shader.cso && !rs->rasterizer_discard) ||
|
||||
(!!sctx->tes_shader.cso != (prim == PIPE_PRIM_PATCHES)))) {
|
||||
assert(0);
|
||||
|
|
|
@ -39,8 +39,7 @@ static void si_set_scissor_states(struct pipe_context *pctx,
|
|||
for (i = 0; i < num_scissors; i++)
|
||||
ctx->scissors[start_slot + i] = state[i];
|
||||
|
||||
if (!ctx->queued.named.rasterizer ||
|
||||
!ctx->queued.named.rasterizer->scissor_enable)
|
||||
if (!ctx->queued.named.rasterizer->scissor_enable)
|
||||
return;
|
||||
|
||||
si_mark_atom_dirty(ctx, &ctx->atoms.s.scissors);
|
||||
|
|
Loading…
Reference in New Issue