}
}
-/* Select the hw shader variant depending on the current state.
- * (*dirty) is set to 1 if current variant was changed */
+/* Select the hw shader variant depending on the current state. */
int si_shader_select(struct pipe_context *ctx,
- struct si_pipe_shader_selector *sel,
- unsigned *dirty)
+ struct si_pipe_shader_selector *sel)
{
union si_shader_key key;
struct si_pipe_shader * shader = NULL;
sel->num_shaders++;
}
- if (dirty)
- *dirty = 1;
-
-
return 0;
}
sel->fs_write_all = info.color0_writes_all_cbufs;
}
- r = si_shader_select(ctx, sel, NULL);
+ r = si_shader_select(ctx, sel);
if (r) {
free(sel);
return NULL;
return;
sctx->vs_shader = sel;
- si_pm4_bind_state(sctx, vs, sel->current->pm4);
- sctx->b.streamout.stride_in_dw = sel->so.stride;
- sctx->b.flags |= R600_CONTEXT_INV_SHADER_CACHE;
}
#if HAVE_LLVM >= 0x0305
return;
sctx->gs_shader = sel;
-
- if (sel && sel->current) {
- si_pm4_bind_state(sctx, gs, sel->current->pm4);
- sctx->b.streamout.stride_in_dw = sel->so.stride;
- sctx->b.flags |= R600_CONTEXT_INV_SHADER_CACHE;
- }
}
#endif
sel = sctx->dummy_pixel_shader;
sctx->ps_shader = sel;
- si_pm4_bind_state(sctx, ps, sel->current->pm4);
- sctx->b.flags |= R600_CONTEXT_INV_SHADER_CACHE;
}
static void si_delete_shader_selector(struct pipe_context *ctx,
si_pm4_set_reg(pm4, R_00B32C_SPI_SHADER_PGM_RSRC2_ES,
S_00B32C_USER_SGPR(num_user_sgprs));
- si_pm4_bind_state(sctx, es, shader->pm4);
sctx->b.flags |= R600_CONTEXT_INV_SHADER_CACHE;
}
si_pm4_set_reg(pm4, R_00B22C_SPI_SHADER_PGM_RSRC2_GS,
S_00B22C_USER_SGPR(num_user_sgprs));
- si_pm4_bind_state(sctx, gs, shader->pm4);
sctx->b.flags |= R600_CONTEXT_INV_SHADER_CACHE;
}
S_00B12C_SO_BASE3_EN(!!shader->selector->so.stride[3]) |
S_00B12C_SO_EN(!!shader->selector->so.num_outputs));
- si_pm4_bind_state(sctx, vs, shader->pm4);
sctx->b.flags |= R600_CONTEXT_INV_SHADER_CACHE;
}
shader->cb0_is_integer = sctx->fb_cb0_is_integer;
shader->sprite_coord_enable = sctx->sprite_coord_enable;
- si_pm4_bind_state(sctx, ps, shader->pm4);
sctx->b.flags |= R600_CONTEXT_INV_SHADER_CACHE;
}
static void si_update_derived_state(struct si_context *sctx)
{
struct pipe_context * ctx = (struct pipe_context*)sctx;
- unsigned vs_dirty = 0, ps_dirty = 0;
if (!sctx->blitter->running) {
/* Flush depth textures which need to be flushed. */
}
if (sctx->gs_shader) {
- unsigned es_dirty = 0, gs_dirty = 0;
-
- si_shader_select(ctx, sctx->gs_shader, &gs_dirty);
+ si_shader_select(ctx, sctx->gs_shader);
if (!sctx->gs_shader->current->pm4) {
si_pipe_shader_gs(ctx, sctx->gs_shader->current);
si_pipe_shader_vs(ctx,
sctx->gs_shader->current->gs_copy_shader);
- gs_dirty = 0;
}
- if (gs_dirty) {
- si_pm4_bind_state(sctx, gs, sctx->gs_shader->current->pm4);
- si_pm4_bind_state(sctx, vs,
- sctx->gs_shader->current->gs_copy_shader->pm4);
- }
+ si_pm4_bind_state(sctx, gs, sctx->gs_shader->current->pm4);
+ si_pm4_bind_state(sctx, vs, sctx->gs_shader->current->gs_copy_shader->pm4);
+
+ sctx->b.streamout.stride_in_dw = sctx->gs_shader->so.stride;
- si_shader_select(ctx, sctx->vs_shader, &es_dirty);
+ si_shader_select(ctx, sctx->vs_shader);
- if (!sctx->vs_shader->current->pm4) {
+ if (!sctx->vs_shader->current->pm4)
si_pipe_shader_es(ctx, sctx->vs_shader->current);
- es_dirty = 0;
- }
- if (es_dirty) {
- si_pm4_bind_state(sctx, es, sctx->vs_shader->current->pm4);
- }
+ si_pm4_bind_state(sctx, es, sctx->vs_shader->current->pm4);
if (!sctx->gs_rings)
si_init_gs_rings(sctx);
}
si_pm4_bind_state(sctx, gs_onoff, sctx->gs_on);
} else {
- si_shader_select(ctx, sctx->vs_shader, &vs_dirty);
+ si_shader_select(ctx, sctx->vs_shader);
- if (!sctx->vs_shader->current->pm4) {
+ if (!sctx->vs_shader->current->pm4)
si_pipe_shader_vs(ctx, sctx->vs_shader->current);
- vs_dirty = 0;
- }
- if (vs_dirty) {
- si_pm4_bind_state(sctx, vs, sctx->vs_shader->current->pm4);
- }
+ si_pm4_bind_state(sctx, vs, sctx->vs_shader->current->pm4);
+
+ sctx->b.streamout.stride_in_dw = sctx->vs_shader->so.stride;
if (!sctx->gs_off) {
sctx->gs_off = si_pm4_alloc_state(sctx);
si_pm4_bind_state(sctx, es, NULL);
}
- si_shader_select(ctx, sctx->ps_shader, &ps_dirty);
+ si_shader_select(ctx, sctx->ps_shader);
- if (!sctx->ps_shader->current->pm4) {
- si_pipe_shader_ps(ctx, sctx->ps_shader->current);
- ps_dirty = 0;
- }
- if (sctx->ps_shader->current->cb0_is_integer != sctx->fb_cb0_is_integer) {
+ if (!sctx->ps_shader->current->pm4 ||
+ sctx->ps_shader->current->cb0_is_integer != sctx->fb_cb0_is_integer)
si_pipe_shader_ps(ctx, sctx->ps_shader->current);
- ps_dirty = 0;
- }
- if (ps_dirty) {
- si_pm4_bind_state(sctx, ps, sctx->ps_shader->current->pm4);
- }
+ si_pm4_bind_state(sctx, ps, sctx->ps_shader->current->pm4);
if (si_pm4_state_changed(sctx, ps) || si_pm4_state_changed(sctx, vs)) {
/* XXX: Emitting the PS state even when only the VS changed