Mesa (master): freedreno/a3xx: add format to emit info, use to set sint/ uint flags

Rob Clark robclark at kemper.freedesktop.org
Sun Nov 30 22:59:36 UTC 2014


Module: Mesa
Branch: master
Commit: d63afe3b588096ca6b91db8d1d8807968b63b390
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d63afe3b588096ca6b91db8d1d8807968b63b390

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Fri Nov 28 14:10:36 2014 -0500

freedreno/a3xx: add format to emit info, use to set sint/uint flags

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>

---

 src/gallium/drivers/freedreno/a3xx/fd3_draw.c    |    4 +++-
 src/gallium/drivers/freedreno/a3xx/fd3_emit.h    |    1 +
 src/gallium/drivers/freedreno/a3xx/fd3_program.c |    4 +++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_draw.c b/src/gallium/drivers/freedreno/a3xx/fd3_draw.c
index b824d21..fe53c8e 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_draw.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_draw.c
@@ -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;
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.h b/src/gallium/drivers/freedreno/a3xx/fd3_emit.h
index c1bd61a..3aa77b6 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.h
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.h
@@ -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;
 
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_program.c b/src/gallium/drivers/freedreno/a3xx/fd3_program.c
index b671095..db72943 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_program.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_program.c
@@ -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));




More information about the mesa-commit mailing list