diff options
author | Rob Clark <[email protected]> | 2017-04-15 10:04:55 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2017-04-18 16:32:00 -0400 |
commit | 4299849ec7a873edf46a3a366749282fdec020fe (patch) | |
tree | d1fdc58b6fc65ad2c9fdbe096a4c3acd4eea3a6b /src/gallium/drivers/freedreno/a2xx | |
parent | d7fa7f5e7eafed8bb88f7e0b9ba4261a76ad9c95 (diff) |
freedreno: refactor dirty state handling
In particular, move per-shader-stage info out to a seperate array of
enum's indexed by shader stage. This will make it easier to add more
shader stages as well as new per-stage state (like SSBOs).
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/a2xx')
-rw-r--r-- | src/gallium/drivers/freedreno/a2xx/fd2_draw.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a2xx/fd2_emit.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a2xx/fd2_emit.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a2xx/fd2_program.c | 6 |
4 files changed, 12 insertions, 7 deletions
diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_draw.c b/src/gallium/drivers/freedreno/a2xx/fd2_draw.c index feec59fa5de..f360ec2f6e2 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_draw.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_draw.c @@ -284,9 +284,12 @@ fd2_clear(struct fd_context *ctx, unsigned buffers, FD_DIRTY_RASTERIZER | FD_DIRTY_SAMPLE_MASK | FD_DIRTY_PROG | - FD_DIRTY_CONSTBUF | + FD_DIRTY_CONST | FD_DIRTY_BLEND | FD_DIRTY_FRAMEBUFFER; + + ctx->dirty_shader[PIPE_SHADER_VERTEX] |= FD_DIRTY_SHADER_PROG; + ctx->dirty_shader[PIPE_SHADER_FRAGMENT] |= FD_DIRTY_SHADER_PROG | FD_DIRTY_SHADER_CONST; } void diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c index fe2750ba10b..d745e44b0ad 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c @@ -182,7 +182,7 @@ fd2_emit_vertex_bufs(struct fd_ringbuffer *ring, uint32_t val, } void -fd2_emit_state(struct fd_context *ctx, const uint32_t dirty) +fd2_emit_state(struct fd_context *ctx, const enum fd_dirty_3d_state dirty) { struct fd2_blend_stateobj *blend = fd2_blend_stateobj(ctx->blend); struct fd2_zsa_stateobj *zsa = fd2_zsa_stateobj(ctx->zsa); @@ -284,7 +284,7 @@ fd2_emit_state(struct fd_context *ctx, const uint32_t dirty) fd2_program_emit(ring, &ctx->prog); } - if (dirty & (FD_DIRTY_PROG | FD_DIRTY_CONSTBUF)) { + if (dirty & (FD_DIRTY_PROG | FD_DIRTY_CONST)) { emit_constants(ring, VS_CONST_BASE * 4, &ctx->constbuf[PIPE_SHADER_VERTEX], (dirty & FD_DIRTY_PROG) ? ctx->prog.vp : NULL); @@ -309,7 +309,7 @@ fd2_emit_state(struct fd_context *ctx, const uint32_t dirty) OUT_RING(ring, blend->rb_colormask); } - if (dirty & (FD_DIRTY_VERTTEX | FD_DIRTY_FRAGTEX | FD_DIRTY_PROG)) + if (dirty & (FD_DIRTY_TEX | FD_DIRTY_PROG)) emit_textures(ring, ctx); } diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_emit.h b/src/gallium/drivers/freedreno/a2xx/fd2_emit.h index 6a26c85c142..d908b113514 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_emit.h +++ b/src/gallium/drivers/freedreno/a2xx/fd2_emit.h @@ -42,7 +42,7 @@ struct fd2_vertex_buf { void fd2_emit_vertex_bufs(struct fd_ringbuffer *ring, uint32_t val, struct fd2_vertex_buf *vbufs, uint32_t n); -void fd2_emit_state(struct fd_context *ctx, uint32_t dirty); +void fd2_emit_state(struct fd_context *ctx, enum fd_dirty_3d_state dirty); void fd2_emit_restore(struct fd_context *ctx, struct fd_ringbuffer *ring); void fd2_emit_init(struct pipe_context *pctx); diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_program.c b/src/gallium/drivers/freedreno/a2xx/fd2_program.c index 8dcbb979383..9a774572514 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_program.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_program.c @@ -241,16 +241,18 @@ void fd2_program_validate(struct fd_context *ctx) { struct fd_program_stateobj *prog = &ctx->prog; + bool dirty_fp = !!(ctx->dirty_shader[PIPE_SHADER_FRAGMENT] & FD_DIRTY_SHADER_PROG); + bool dirty_vp = !!(ctx->dirty_shader[PIPE_SHADER_VERTEX] & FD_DIRTY_SHADER_PROG); /* if vertex or frag shader is dirty, we may need to recompile. Compile * frag shader first, as that assigns the register slots for exports * from the vertex shader. And therefore if frag shader has changed we * need to recompile both vert and frag shader. */ - if (ctx->dirty & FD_SHADER_DIRTY_FP) + if (dirty_fp) compile(prog, prog->fp); - if (ctx->dirty & (FD_SHADER_DIRTY_FP | FD_SHADER_DIRTY_VP)) + if (dirty_fp || dirty_vp) compile(prog, prog->vp); /* if necessary, fix up vertex fetch instructions: */ |