diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_draw.c | 13 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_shaders.c | 106 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_viewport.c | 13 |
4 files changed, 61 insertions, 75 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 69a53f7a10b..fb4649771fc 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -1418,7 +1418,7 @@ static void si_emit_db_render_state(struct si_context *sctx) } /* Disable the gl_SampleMask fragment shader output if MSAA is disabled. */ - if (!rs || !rs->multisample_enable) + if (!rs->multisample_enable) db_shader_control &= C_02880C_MASK_EXPORT_ENABLE; if (sctx->screen->has_rbplus && @@ -3251,7 +3251,7 @@ static void si_emit_msaa_sample_locs(struct si_context *sctx) */ if (has_msaa_sample_loc_bug && sctx->framebuffer.nr_samples > 1 && - rs && !rs->multisample_enable) + !rs->multisample_enable) small_prim_filter_cntl &= C_028830_SMALL_PRIM_FILTER_ENABLE; radeon_opt_set_context_reg(sctx, diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c index 5370587d747..942cb3c7994 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.c +++ b/src/gallium/drivers/radeonsi/si_state_draw.c @@ -1229,15 +1229,10 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) return; } - if (unlikely(!sctx->vs_shader.cso)) { - assert(0); - return; - } - if (unlikely(!sctx->ps_shader.cso && (!rs || !rs->rasterizer_discard))) { - assert(0); - return; - } - if (unlikely(!!sctx->tes_shader.cso != (info->mode == PIPE_PRIM_PATCHES))) { + if (unlikely(!sctx->vs_shader.cso || + !rs || + (!sctx->ps_shader.cso && !rs->rasterizer_discard) || + (!!sctx->tes_shader.cso != (info->mode == PIPE_PRIM_PATCHES)))) { assert(0); return; } diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index aa270ebcb4d..e7610af2fa7 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -1418,65 +1418,63 @@ static inline void si_shader_selector_key(struct pipe_context *ctx, key->part.ps.epilog.color_is_int10 &= sel->info.colors_written; } - if (rs) { - bool is_poly = !util_prim_is_points_or_lines(sctx->current_rast_prim); - bool is_line = util_prim_is_lines(sctx->current_rast_prim); + bool is_poly = !util_prim_is_points_or_lines(sctx->current_rast_prim); + bool is_line = util_prim_is_lines(sctx->current_rast_prim); - key->part.ps.prolog.color_two_side = rs->two_side && sel->info.colors_read; - key->part.ps.prolog.flatshade_colors = rs->flatshade && sel->info.colors_read; + key->part.ps.prolog.color_two_side = rs->two_side && sel->info.colors_read; + key->part.ps.prolog.flatshade_colors = rs->flatshade && sel->info.colors_read; - if (sctx->queued.named.blend) { - key->part.ps.epilog.alpha_to_one = sctx->queued.named.blend->alpha_to_one && - rs->multisample_enable; - } + if (sctx->queued.named.blend) { + key->part.ps.epilog.alpha_to_one = sctx->queued.named.blend->alpha_to_one && + rs->multisample_enable; + } - key->part.ps.prolog.poly_stipple = rs->poly_stipple_enable && is_poly; - key->part.ps.epilog.poly_line_smoothing = ((is_poly && rs->poly_smooth) || - (is_line && rs->line_smooth)) && - sctx->framebuffer.nr_samples <= 1; - key->part.ps.epilog.clamp_color = rs->clamp_fragment_color; + key->part.ps.prolog.poly_stipple = rs->poly_stipple_enable && is_poly; + key->part.ps.epilog.poly_line_smoothing = ((is_poly && rs->poly_smooth) || + (is_line && rs->line_smooth)) && + sctx->framebuffer.nr_samples <= 1; + key->part.ps.epilog.clamp_color = rs->clamp_fragment_color; - if (sctx->ps_iter_samples > 1 && - sel->info.reads_samplemask) { - key->part.ps.prolog.samplemask_log_ps_iter = - util_logbase2(sctx->ps_iter_samples); - } + if (sctx->ps_iter_samples > 1 && + sel->info.reads_samplemask) { + key->part.ps.prolog.samplemask_log_ps_iter = + util_logbase2(sctx->ps_iter_samples); + } - if (rs->force_persample_interp && - rs->multisample_enable && - sctx->framebuffer.nr_samples > 1 && - sctx->ps_iter_samples > 1) { - key->part.ps.prolog.force_persp_sample_interp = - sel->info.uses_persp_center || - sel->info.uses_persp_centroid; - - key->part.ps.prolog.force_linear_sample_interp = - sel->info.uses_linear_center || - sel->info.uses_linear_centroid; - } else if (rs->multisample_enable && - sctx->framebuffer.nr_samples > 1) { - key->part.ps.prolog.bc_optimize_for_persp = - sel->info.uses_persp_center && - sel->info.uses_persp_centroid; - key->part.ps.prolog.bc_optimize_for_linear = - sel->info.uses_linear_center && - sel->info.uses_linear_centroid; - } else { - /* Make sure SPI doesn't compute more than 1 pair - * of (i,j), which is the optimization here. */ - key->part.ps.prolog.force_persp_center_interp = - sel->info.uses_persp_center + - sel->info.uses_persp_centroid + - sel->info.uses_persp_sample > 1; - - key->part.ps.prolog.force_linear_center_interp = - sel->info.uses_linear_center + - sel->info.uses_linear_centroid + - sel->info.uses_linear_sample > 1; - - if (sel->info.opcode_count[TGSI_OPCODE_INTERP_SAMPLE]) - key->mono.u.ps.interpolate_at_sample_force_center = 1; - } + if (rs->force_persample_interp && + rs->multisample_enable && + sctx->framebuffer.nr_samples > 1 && + sctx->ps_iter_samples > 1) { + key->part.ps.prolog.force_persp_sample_interp = + sel->info.uses_persp_center || + sel->info.uses_persp_centroid; + + key->part.ps.prolog.force_linear_sample_interp = + sel->info.uses_linear_center || + sel->info.uses_linear_centroid; + } else if (rs->multisample_enable && + sctx->framebuffer.nr_samples > 1) { + key->part.ps.prolog.bc_optimize_for_persp = + sel->info.uses_persp_center && + sel->info.uses_persp_centroid; + key->part.ps.prolog.bc_optimize_for_linear = + sel->info.uses_linear_center && + sel->info.uses_linear_centroid; + } else { + /* Make sure SPI doesn't compute more than 1 pair + * of (i,j), which is the optimization here. */ + key->part.ps.prolog.force_persp_center_interp = + sel->info.uses_persp_center + + sel->info.uses_persp_centroid + + sel->info.uses_persp_sample > 1; + + key->part.ps.prolog.force_linear_center_interp = + sel->info.uses_linear_center + + sel->info.uses_linear_centroid + + sel->info.uses_linear_sample > 1; + + if (sel->info.opcode_count[TGSI_OPCODE_INTERP_SAMPLE]) + key->mono.u.ps.interpolate_at_sample_force_center = 1; } key->part.ps.epilog.alpha_func = si_get_alpha_test_func(sctx); diff --git a/src/gallium/drivers/radeonsi/si_state_viewport.c b/src/gallium/drivers/radeonsi/si_state_viewport.c index d16c3e7e41b..d0287d5ad75 100644 --- a/src/gallium/drivers/radeonsi/si_state_viewport.c +++ b/src/gallium/drivers/radeonsi/si_state_viewport.c @@ -193,8 +193,7 @@ static void si_emit_guardband(struct si_context *ctx) discard_x = 1.0; discard_y = 1.0; - if (unlikely(util_prim_is_points_or_lines(ctx->current_rast_prim)) && - ctx->queued.named.rasterizer) { + if (unlikely(util_prim_is_points_or_lines(ctx->current_rast_prim))) { /* When rendering wide points or lines, we need to be more * conservative about when to discard them entirely. */ const struct si_state_rasterizer *rs = ctx->queued.named.rasterizer; @@ -229,10 +228,7 @@ static void si_emit_scissors(struct si_context *ctx) struct radeon_winsys_cs *cs = ctx->gfx_cs; struct pipe_scissor_state *states = ctx->scissors.states; unsigned mask = ctx->scissors.dirty_mask; - bool scissor_enabled = false; - - if (ctx->queued.named.rasterizer) - scissor_enabled = ctx->queued.named.rasterizer->scissor_enable; + bool scissor_enabled = ctx->queued.named.rasterizer->scissor_enable; /* The simple case: Only 1 viewport is active. */ if (!ctx->vs_writes_viewport_index) { @@ -348,13 +344,10 @@ static void si_emit_depth_ranges(struct si_context *ctx) struct radeon_winsys_cs *cs = ctx->gfx_cs; struct pipe_viewport_state *states = ctx->viewports.states; unsigned mask = ctx->viewports.depth_range_dirty_mask; - bool clip_halfz = false; + bool clip_halfz = ctx->queued.named.rasterizer->clip_halfz; bool window_space = ctx->vs_disables_clipping_viewport; float zmin, zmax; - if (ctx->queued.named.rasterizer) - clip_halfz = ctx->queued.named.rasterizer->clip_halfz; - /* The simple case: Only 1 viewport is active. */ if (!ctx->vs_writes_viewport_index) { if (!(mask & 1)) |