[Freedreno] [PATCH 2/2] freedreno/a3xx: fix integer and 32-bit float border colors

Ilia Mirkin imirkin at alum.mit.edu
Sun Apr 5 22:46:48 PDT 2015


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

32-bit float still fails, but I think it's because of what the test does wrt blending. Same for depth -- it's better with this patch but still not quite right.

 src/gallium/drivers/freedreno/a3xx/fd3_emit.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
index f961fc0..efc87c5 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
@@ -217,6 +217,7 @@ emit_textures(struct fd_context *ctx, struct fd_ringbuffer *ring,
 			uint16_t *bcolor = (uint16_t *)((uint8_t *)ptr +
 					(BORDERCOLOR_SIZE * tex_off[sb]) +
 					(BORDERCOLOR_SIZE * i));
+			uint32_t *bcolor32 = (uint32_t *)&bcolor[16];
 
 			/*
 			 * XXX HACK ALERT XXX
@@ -231,7 +232,22 @@ emit_textures(struct fd_context *ctx, struct fd_ringbuffer *ring,
 				const struct util_format_description *desc =
 					util_format_description(tex->textures[i]->format);
 				for (j = 0; j < 4; j++) {
-					if (desc->swizzle[j] < 4)
+					if (desc->swizzle[j] >= 4)
+						continue;
+
+					const struct util_format_channel_description *chan =
+						&desc->channel[desc->swizzle[j]];
+
+					if (chan->pure_integer && chan->size > 16)
+						bcolor32[desc->swizzle[j] + 4] =
+							sampler->base.border_color.i[j];
+					else if (chan->size > 16)
+						bcolor32[desc->swizzle[j]] =
+							fui(sampler->base.border_color.f[j]);
+					else if (chan->pure_integer)
+						bcolor[desc->swizzle[j] + 8] =
+							sampler->base.border_color.i[j];
+					else
 						bcolor[desc->swizzle[j]] =
 							util_float_to_half(sampler->base.border_color.f[j]);
 				}
-- 
2.0.5



More information about the Freedreno mailing list