freedreno/a3xx: only emit dirty consts
authorRob Clark <robclark@freedesktop.org>
Fri, 17 Oct 2014 12:57:16 +0000 (08:57 -0400)
committerRob Clark <robclark@freedesktop.org>
Tue, 21 Oct 2014 01:42:44 +0000 (21:42 -0400)
If app only updates (for example) vertex uniforms, it would be nice to
only re-emit those and not also frag uniforms.  Means we need to mark
the first frag shader const buffer dirty after a clear.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/a3xx/fd3_draw.c
src/gallium/drivers/freedreno/a3xx/fd3_emit.c

index 7cc24e5..e168d97 100644 (file)
@@ -136,14 +136,21 @@ fd3_draw(struct fd_context *ctx, const struct pipe_draw_info *info)
                },
                .rasterflat = ctx->rasterizer && ctx->rasterizer->flatshade,
        };
-       unsigned dirty;
+       uint32_t dirty, vconst;
 
        fixup_shader_state(ctx, &emit.key);
 
+       /* save/restore vertex const state too, so that vertex
+        * shader consts also get emitted for render pass:
+        */
+       vconst = ctx->constbuf[PIPE_SHADER_VERTEX].dirty_mask;
+
        dirty = ctx->dirty;
        emit.dirty = dirty & ~(FD_DIRTY_BLEND);
        draw_impl(ctx, ctx->binning_ring, &emit);
 
+       ctx->constbuf[PIPE_SHADER_VERTEX].dirty_mask = vconst;
+
        /* and now regular (non-binning) pass: */
        emit.key.binning_pass = false;
        emit.dirty = dirty;
@@ -312,6 +319,7 @@ fd3_clear(struct fd_context *ctx, unsigned buffers,
 
        fd3_emit_vertex_bufs(ring, &emit);
 
+       ctx->constbuf[PIPE_SHADER_FRAGMENT].dirty_mask = ~0;
        fd3_emit_constant(ring, SB_FRAG_SHADER, 0, 0, 4, color->ui, NULL);
 
        OUT_PKT0(ring, REG_A3XX_PC_PRIM_VTX_CNTL, 1);
index 0439dc7..8300a55 100644 (file)
@@ -93,10 +93,6 @@ emit_constants(struct fd_ringbuffer *ring,
        uint32_t first_immediate;
        uint32_t base = 0;
 
-       // XXX TODO only emit dirty consts.. but we need to keep track if
-       // they are clobbered by a clear, gmem2mem, or mem2gmem..
-       constbuf->dirty_mask = enabled_mask;
-
        /* in particular, with binning shader we may end up with unused
         * consts, ie. we could end up w/ constlen that is smaller
         * than first_immediate.  In that case truncate the user consts