freedreno/a3xx: add format to emit info, use to set sint/uint flags
authorIlia Mirkin <imirkin@alum.mit.edu>
Fri, 28 Nov 2014 19:10:36 +0000 (14:10 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sun, 30 Nov 2014 18:00:41 +0000 (13:00 -0500)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/freedreno/a3xx/fd3_draw.c
src/gallium/drivers/freedreno/a3xx/fd3_emit.h
src/gallium/drivers/freedreno/a3xx/fd3_program.c

index b824d212a36dd937d6ae653da419709c79f62a1d..fe53c8ece7a4aed94c5fe9a8d57094bb131156c8 100644 (file)
@@ -114,6 +114,7 @@ static void
 fd3_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info)
 {
        struct fd3_context *fd3_ctx = fd3_context(ctx);
+       struct pipe_framebuffer_state *pfb = &ctx->framebuffer;
        struct fd3_emit emit = {
                .vtx  = &ctx->vtx,
                .prog = &ctx->prog,
@@ -122,7 +123,7 @@ fd3_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info)
                        /* do binning pass first: */
                        .binning_pass = true,
                        .color_two_side = ctx->rasterizer ? ctx->rasterizer->light_twoside : false,
-                       .alpha = util_format_is_alpha(pipe_surface_format(ctx->framebuffer.cbufs[0])),
+                       .alpha = util_format_is_alpha(pipe_surface_format(pfb->cbufs[0])),
                        // TODO set .half_precision based on render target format,
                        // ie. float16 and smaller use half, float32 use full..
                        .half_precision = !!(fd_mesa_debug & FD_DBG_FRAGHALF),
@@ -134,6 +135,7 @@ fd3_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info)
                        .fsaturate_t = fd3_ctx->fsaturate_t,
                        .fsaturate_r = fd3_ctx->fsaturate_r,
                },
+               .format = pipe_surface_format(pfb->cbufs[0]),
                .rasterflat = ctx->rasterizer && ctx->rasterizer->flatshade,
        };
        unsigned dirty;
index c1bd61ae0a875ff275a41f3d1b5628cf23232627..3aa77b6b12b55659476903a09cf11f085ed5f286 100644 (file)
@@ -53,6 +53,7 @@ struct fd3_emit {
        const struct fd_program_stateobj *prog;
        const struct pipe_draw_info *info;
        struct ir3_shader_key key;
+       enum pipe_format format;
        uint32_t dirty;
        bool rasterflat;
 
index b6710957458e44a0cec6c204078ef1799bc3c3b1..db7294349744c1615783cfc3adb3d9ef0717bcf1 100644 (file)
@@ -351,7 +351,9 @@ fd3_program_emit(struct fd_ringbuffer *ring, struct fd3_emit *emit)
 
        OUT_PKT0(ring, REG_A3XX_SP_FS_MRT_REG(0), 4);
        OUT_RING(ring, A3XX_SP_FS_MRT_REG_REGID(color_regid) |
-                       COND(fp->key.half_precision, A3XX_SP_FS_MRT_REG_HALF_PRECISION));
+                       COND(fp->key.half_precision, A3XX_SP_FS_MRT_REG_HALF_PRECISION) |
+                       COND(util_format_is_pure_uint(emit->format), A3XX_SP_FS_MRT_REG_UINT) |
+                       COND(util_format_is_pure_sint(emit->format), A3XX_SP_FS_MRT_REG_SINT));
        OUT_RING(ring, A3XX_SP_FS_MRT_REG_REGID(0));
        OUT_RING(ring, A3XX_SP_FS_MRT_REG_REGID(0));
        OUT_RING(ring, A3XX_SP_FS_MRT_REG_REGID(0));