|
|
|
@@ -238,7 +238,8 @@ static unsigned si_pack_float_12p4(float x)
|
|
|
|
|
/*
|
|
|
|
|
* Inferred framebuffer and blender state.
|
|
|
|
|
*
|
|
|
|
|
* One of the reasons this must be derived from the framebuffer state is that:
|
|
|
|
|
* One of the reasons CB_TARGET_MASK must be derived from the framebuffer state
|
|
|
|
|
* is that:
|
|
|
|
|
* - The blend state mask is 0xf most of the time.
|
|
|
|
|
* - The COLOR1 format isn't INVALID because of possible dual-source blending,
|
|
|
|
|
* so COLOR1 is enabled pretty much all the time.
|
|
|
|
@@ -246,18 +247,18 @@ static unsigned si_pack_float_12p4(float x)
|
|
|
|
|
*
|
|
|
|
|
* Another reason is to avoid a hang with dual source blending.
|
|
|
|
|
*/
|
|
|
|
|
static void si_emit_cb_target_mask(struct si_context *sctx, struct r600_atom *atom)
|
|
|
|
|
static void si_emit_cb_render_state(struct si_context *sctx, struct r600_atom *atom)
|
|
|
|
|
{
|
|
|
|
|
struct radeon_winsys_cs *cs = sctx->b.gfx.cs;
|
|
|
|
|
struct si_state_blend *blend = sctx->queued.named.blend;
|
|
|
|
|
uint32_t mask = 0, i;
|
|
|
|
|
uint32_t cb_target_mask = 0, i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < sctx->framebuffer.state.nr_cbufs; i++)
|
|
|
|
|
if (sctx->framebuffer.state.cbufs[i])
|
|
|
|
|
mask |= 0xf << (4*i);
|
|
|
|
|
cb_target_mask |= 0xf << (4*i);
|
|
|
|
|
|
|
|
|
|
if (blend)
|
|
|
|
|
mask &= blend->cb_target_mask;
|
|
|
|
|
cb_target_mask &= blend->cb_target_mask;
|
|
|
|
|
|
|
|
|
|
/* Avoid a hang that happens when dual source blending is enabled
|
|
|
|
|
* but there is not enough color outputs. This is undefined behavior,
|
|
|
|
@@ -268,9 +269,9 @@ static void si_emit_cb_target_mask(struct si_context *sctx, struct r600_atom *at
|
|
|
|
|
if (blend && blend->dual_src_blend &&
|
|
|
|
|
sctx->ps_shader.cso &&
|
|
|
|
|
(sctx->ps_shader.cso->info.colors_written & 0x3) != 0x3)
|
|
|
|
|
mask = 0;
|
|
|
|
|
cb_target_mask = 0;
|
|
|
|
|
|
|
|
|
|
radeon_set_context_reg(cs, R_028238_CB_TARGET_MASK, mask);
|
|
|
|
|
radeon_set_context_reg(cs, R_028238_CB_TARGET_MASK, cb_target_mask);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@@ -532,7 +533,7 @@ static void si_bind_blend_state(struct pipe_context *ctx, void *state)
|
|
|
|
|
{
|
|
|
|
|
struct si_context *sctx = (struct si_context *)ctx;
|
|
|
|
|
si_pm4_bind_state(sctx, blend, (struct si_state_blend *)state);
|
|
|
|
|
si_mark_atom_dirty(sctx, &sctx->cb_target_mask);
|
|
|
|
|
si_mark_atom_dirty(sctx, &sctx->cb_render_state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void si_delete_blend_state(struct pipe_context *ctx, void *state)
|
|
|
|
@@ -2461,7 +2462,7 @@ static void si_set_framebuffer_state(struct pipe_context *ctx,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
si_update_poly_offset_state(sctx);
|
|
|
|
|
si_mark_atom_dirty(sctx, &sctx->cb_target_mask);
|
|
|
|
|
si_mark_atom_dirty(sctx, &sctx->cb_render_state);
|
|
|
|
|
si_mark_atom_dirty(sctx, &sctx->framebuffer.atom);
|
|
|
|
|
|
|
|
|
|
if (sctx->framebuffer.nr_samples != old_nr_samples) {
|
|
|
|
@@ -3376,7 +3377,7 @@ void si_init_state_functions(struct si_context *sctx)
|
|
|
|
|
si_init_atom(sctx, &sctx->db_render_state, &sctx->atoms.s.db_render_state, si_emit_db_render_state);
|
|
|
|
|
si_init_atom(sctx, &sctx->msaa_config, &sctx->atoms.s.msaa_config, si_emit_msaa_config);
|
|
|
|
|
si_init_atom(sctx, &sctx->sample_mask.atom, &sctx->atoms.s.sample_mask, si_emit_sample_mask);
|
|
|
|
|
si_init_atom(sctx, &sctx->cb_target_mask, &sctx->atoms.s.cb_target_mask, si_emit_cb_target_mask);
|
|
|
|
|
si_init_atom(sctx, &sctx->cb_render_state, &sctx->atoms.s.cb_render_state, si_emit_cb_render_state);
|
|
|
|
|
si_init_atom(sctx, &sctx->blend_color.atom, &sctx->atoms.s.blend_color, si_emit_blend_color);
|
|
|
|
|
si_init_atom(sctx, &sctx->clip_regs, &sctx->atoms.s.clip_regs, si_emit_clip_regs);
|
|
|
|
|
si_init_atom(sctx, &sctx->clip_state.atom, &sctx->atoms.s.clip_state, si_emit_clip_state);
|
|
|
|
|