* from the vertex shader. And therefore if frag shader has changed we
* need to recompile both vert and frag shader.
*/
- if (prog->dirty & FD_SHADER_DIRTY_FP)
+ if (ctx->dirty & FD_SHADER_DIRTY_FP)
compile(prog, prog->fp);
- if (prog->dirty & (FD_SHADER_DIRTY_FP | FD_SHADER_DIRTY_VP))
+ if (ctx->dirty & (FD_SHADER_DIRTY_FP | FD_SHADER_DIRTY_VP))
compile(prog, prog->vp);
- if (prog->dirty)
- ctx->dirty |= FD_DIRTY_PROG;
-
/* if necessary, fix up vertex fetch instructions: */
if (ctx->dirty & (FD_DIRTY_VTXSTATE | FD_DIRTY_PROG))
patch_vtx_fetches(ctx, prog->vp, ctx->vtx.vtx);
A2XX_SQ_PROGRAM_CNTL_VS_EXPORT_COUNT(vs_export) |
A2XX_SQ_PROGRAM_CNTL_PS_REGS(fs_gprs) |
A2XX_SQ_PROGRAM_CNTL_VS_REGS(vs_gprs));
-
- prog->dirty = 0;
}
/* Creates shader:
struct ir3_shader_key *last_key = &fd3_ctx->last_key;
if (!ir3_shader_key_equal(last_key, key)) {
- ctx->dirty |= FD_DIRTY_PROG;
-
if (last_key->has_per_samp || key->has_per_samp) {
if ((last_key->vsaturate_s != key->vsaturate_s) ||
(last_key->vsaturate_t != key->vsaturate_t) ||
(last_key->vsaturate_r != key->vsaturate_r))
- ctx->prog.dirty |= FD_SHADER_DIRTY_VP;
+ ctx->dirty |= FD_SHADER_DIRTY_VP;
if ((last_key->fsaturate_s != key->fsaturate_s) ||
(last_key->fsaturate_t != key->fsaturate_t) ||
(last_key->fsaturate_r != key->fsaturate_r))
- ctx->prog.dirty |= FD_SHADER_DIRTY_FP;
+ ctx->dirty |= FD_SHADER_DIRTY_FP;
}
if (last_key->vclamp_color != key->vclamp_color)
- ctx->prog.dirty |= FD_SHADER_DIRTY_VP;
+ ctx->dirty |= FD_SHADER_DIRTY_VP;
if (last_key->fclamp_color != key->fclamp_color)
- ctx->prog.dirty |= FD_SHADER_DIRTY_FP;
+ ctx->dirty |= FD_SHADER_DIRTY_FP;
if (last_key->color_two_side != key->color_two_side)
- ctx->prog.dirty |= FD_SHADER_DIRTY_FP;
+ ctx->dirty |= FD_SHADER_DIRTY_FP;
if (last_key->half_precision != key->half_precision)
- ctx->prog.dirty |= FD_SHADER_DIRTY_FP;
+ ctx->dirty |= FD_SHADER_DIRTY_FP;
fd3_ctx->last_key = *key;
}
ir3_emit_consts(vp, ring, ctx, emit->info, dirty);
if (!emit->key.binning_pass)
ir3_emit_consts(fp, ring, ctx, emit->info, dirty);
- /* mark clean after emitting consts.. a bit ugly, but since binning
- * pass is emitted first, we want to do this only for main draw:
- */
- if (!emit->key.binning_pass)
- ctx->prog.dirty = 0;
}
if (dirty & (FD_DIRTY_BLEND | FD_DIRTY_FRAMEBUFFER)) {
struct ir3_shader_key *last_key = &fd4_ctx->last_key;
if (!ir3_shader_key_equal(last_key, key)) {
- ctx->dirty |= FD_DIRTY_PROG;
-
if (last_key->has_per_samp || key->has_per_samp) {
if ((last_key->vsaturate_s != key->vsaturate_s) ||
(last_key->vsaturate_t != key->vsaturate_t) ||
(last_key->vsaturate_r != key->vsaturate_r) ||
(last_key->vastc_srgb != key->vastc_srgb))
- ctx->prog.dirty |= FD_SHADER_DIRTY_VP;
+ ctx->dirty |= FD_SHADER_DIRTY_VP;
if ((last_key->fsaturate_s != key->fsaturate_s) ||
(last_key->fsaturate_t != key->fsaturate_t) ||
(last_key->fsaturate_r != key->fsaturate_r) ||
(last_key->fastc_srgb != key->fastc_srgb))
- ctx->prog.dirty |= FD_SHADER_DIRTY_FP;
+ ctx->dirty |= FD_SHADER_DIRTY_FP;
}
if (last_key->vclamp_color != key->vclamp_color)
- ctx->prog.dirty |= FD_SHADER_DIRTY_VP;
+ ctx->dirty |= FD_SHADER_DIRTY_VP;
if (last_key->fclamp_color != key->fclamp_color)
- ctx->prog.dirty |= FD_SHADER_DIRTY_FP;
+ ctx->dirty |= FD_SHADER_DIRTY_FP;
if (last_key->color_two_side != key->color_two_side)
- ctx->prog.dirty |= FD_SHADER_DIRTY_FP;
+ ctx->dirty |= FD_SHADER_DIRTY_FP;
if (last_key->half_precision != key->half_precision)
- ctx->prog.dirty |= FD_SHADER_DIRTY_FP;
+ ctx->dirty |= FD_SHADER_DIRTY_FP;
if (last_key->rasterflat != key->rasterflat)
- ctx->prog.dirty |= FD_SHADER_DIRTY_FP;
+ ctx->dirty |= FD_SHADER_DIRTY_FP;
fd4_ctx->last_key = *key;
}
ir3_emit_consts(vp, ring, ctx, emit->info, dirty);
if (!emit->key.binning_pass)
ir3_emit_consts(fp, ring, ctx, emit->info, dirty);
- /* mark clean after emitting consts.. a bit ugly, but since binning
- * pass is emitted first, we want to do this only for main draw:
- */
- if (!emit->key.binning_pass)
- ctx->prog.dirty = 0;
}
if ((dirty & FD_DIRTY_BLEND)) {
struct fd_program_stateobj {
void *vp, *fp;
- enum {
- FD_SHADER_DIRTY_VP = (1 << 0),
- FD_SHADER_DIRTY_FP = (1 << 1),
- } dirty;
+
+ /* rest only used by fd2.. split out: */
uint8_t num_exports;
/* Indexed by semantic name or TGSI_SEMANTIC_COUNT + semantic index
* for TGSI_SEMANTIC_GENERIC. Special vs exports (position and point-
FD_DIRTY_FRAGTEX = (1 << 3),
FD_DIRTY_VERTTEX = (1 << 4),
FD_DIRTY_TEXSTATE = (1 << 5),
- FD_DIRTY_PROG = (1 << 6),
- FD_DIRTY_BLEND_COLOR = (1 << 7),
- FD_DIRTY_STENCIL_REF = (1 << 8),
- FD_DIRTY_SAMPLE_MASK = (1 << 9),
- FD_DIRTY_FRAMEBUFFER = (1 << 10),
- FD_DIRTY_STIPPLE = (1 << 11),
- FD_DIRTY_VIEWPORT = (1 << 12),
- FD_DIRTY_CONSTBUF = (1 << 13),
- FD_DIRTY_VTXSTATE = (1 << 14),
- FD_DIRTY_VTXBUF = (1 << 15),
- FD_DIRTY_INDEXBUF = (1 << 16),
- FD_DIRTY_SCISSOR = (1 << 17),
- FD_DIRTY_STREAMOUT = (1 << 18),
- FD_DIRTY_UCP = (1 << 19),
- FD_DIRTY_BLEND_DUAL = (1 << 20),
+
+ FD_SHADER_DIRTY_VP = (1 << 6),
+ FD_SHADER_DIRTY_FP = (1 << 7),
+ /* skip geom/tcs/tes/compute */
+ FD_DIRTY_PROG = FD_SHADER_DIRTY_FP | FD_SHADER_DIRTY_VP,
+
+ FD_DIRTY_BLEND_COLOR = (1 << 12),
+ FD_DIRTY_STENCIL_REF = (1 << 13),
+ FD_DIRTY_SAMPLE_MASK = (1 << 14),
+ FD_DIRTY_FRAMEBUFFER = (1 << 15),
+ FD_DIRTY_STIPPLE = (1 << 16),
+ FD_DIRTY_VIEWPORT = (1 << 17),
+ FD_DIRTY_CONSTBUF = (1 << 18),
+ FD_DIRTY_VTXSTATE = (1 << 19),
+ FD_DIRTY_VTXBUF = (1 << 20),
+ FD_DIRTY_INDEXBUF = (1 << 21),
+ FD_DIRTY_SCISSOR = (1 << 22),
+ FD_DIRTY_STREAMOUT = (1 << 23),
+ FD_DIRTY_UCP = (1 << 24),
+ FD_DIRTY_BLEND_DUAL = (1 << 25),
} dirty;
struct pipe_blend_state *blend;
{
struct fd_context *ctx = fd_context(pctx);
ctx->prog.fp = hwcso;
- ctx->prog.dirty |= FD_SHADER_DIRTY_FP;
- ctx->dirty |= FD_DIRTY_PROG;
+ ctx->dirty |= FD_SHADER_DIRTY_FP;
}
static void
{
struct fd_context *ctx = fd_context(pctx);
ctx->prog.vp = hwcso;
- ctx->prog.dirty |= FD_SHADER_DIRTY_VP;
- ctx->dirty |= FD_DIRTY_PROG;
+ ctx->dirty |= FD_SHADER_DIRTY_VP;
}
static const char *solid_fp =
if (v->type == SHADER_VERTEX) {
constbuf = &ctx->constbuf[PIPE_SHADER_VERTEX];
- shader_dirty = !!(ctx->prog.dirty & FD_SHADER_DIRTY_VP);
+ shader_dirty = !!(dirty & FD_SHADER_DIRTY_VP);
} else if (v->type == SHADER_FRAGMENT) {
constbuf = &ctx->constbuf[PIPE_SHADER_FRAGMENT];
- shader_dirty = !!(ctx->prog.dirty & FD_SHADER_DIRTY_FP);
+ shader_dirty = !!(dirty & FD_SHADER_DIRTY_FP);
} else {
unreachable("bad shader type");
return;