summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2015-04-22 13:00:03 -0400
committerRob Clark <[email protected]>2015-04-22 13:20:28 -0400
commit48a651e98ce764a9dae3d4dfd6e18044414be18b (patch)
tree659c114c34294c3d8b0af62f980be883144359f0 /src/gallium
parent21ceedfd8bd1b9e45ee12be24b328876bd7fa4eb (diff)
freedreno/a4xx: formats updates/fixes
Update formats table with new formats that Ilia has figured out, and fix sampling from srgb texture and integer vbo's. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/freedreno/a4xx/fd4_emit.c2
-rw-r--r--src/gallium/drivers/freedreno/a4xx/fd4_format.c111
-rw-r--r--src/gallium/drivers/freedreno/a4xx/fd4_texture.c3
3 files changed, 84 insertions, 32 deletions
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c
index 847a6753d36..7a244d8a4c5 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c
@@ -328,6 +328,7 @@ fd4_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd4_emit *emit)
bool switchnext = (i != last) ||
(vertex_regid != regid(63, 0)) ||
(instance_regid != regid(63, 0));
+ bool isint = util_format_is_pure_integer(pfmt);
uint32_t fs = util_format_get_blocksize(pfmt);
uint32_t off = vb->buffer_offset + elem->src_offset;
uint32_t size = fd_bo_size(rsc->bo) - off;
@@ -350,6 +351,7 @@ fd4_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd4_emit *emit)
A4XX_VFD_DECODE_INSTR_REGID(vp->inputs[i].regid) |
A4XX_VFD_DECODE_INSTR_SHIFTCNT(fs) |
A4XX_VFD_DECODE_INSTR_LASTCOMPVALID |
+ COND(isint, A4XX_VFD_DECODE_INSTR_INT) |
COND(switchnext, A4XX_VFD_DECODE_INSTR_SWITCHNEXT));
total_in += vp->inputs[i].ncomp;
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_format.c b/src/gallium/drivers/freedreno/a4xx/fd4_format.c
index 9cff1340ee7..29abe0b0cc3 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_format.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_format.c
@@ -78,7 +78,7 @@ struct fd4_format {
static struct fd4_format formats[PIPE_FORMAT_COUNT] = {
/* 8-bit */
- VT(R8_UNORM, 8_UNORM, NONE, WZYX),
+ VT(R8_UNORM, 8_UNORM, R8_UNORM, WZYX),
V_(R8_SNORM, 8_SNORM, NONE, WZYX),
V_(R8_UINT, 8_UINT, NONE, WZYX),
V_(R8_SINT, 8_SINT, NONE, WZYX),
@@ -86,29 +86,38 @@ static struct fd4_format formats[PIPE_FORMAT_COUNT] = {
V_(R8_SSCALED, 8_UINT, NONE, WZYX),
_T(A8_UNORM, 8_UNORM, A8_UNORM, WZYX),
- _T(L8_UNORM, 8_UNORM, NONE, WZYX),
+ _T(L8_UNORM, 8_UNORM, R8_UNORM, WZYX),
_T(I8_UNORM, 8_UNORM, NONE, WZYX),
/* 16-bit */
V_(R16_UNORM, 16_UNORM, NONE, WZYX),
V_(R16_SNORM, 16_SNORM, NONE, WZYX),
- V_(R16_UINT, 16_UINT, NONE, WZYX),
- V_(R16_SINT, 16_SINT, NONE, WZYX),
+ VT(R16_UINT, 16_UINT, R16_UINT, WZYX),
+ VT(R16_SINT, 16_SINT, R16_SINT, WZYX),
V_(R16_USCALED, 16_UINT, NONE, WZYX),
V_(R16_SSCALED, 16_UINT, NONE, WZYX),
VT(R16_FLOAT, 16_FLOAT, NONE, WZYX),
- VT(R8G8_UNORM, 8_8_UNORM, NONE, WZYX),
- V_(R8G8_SNORM, 8_8_SNORM, NONE, WZYX),
- V_(R8G8_UINT, 8_8_UINT, NONE, WZYX),
- V_(R8G8_SINT, 8_8_SINT, NONE, WZYX),
+ _T(A16_UINT, 16_UINT, NONE, WZYX),
+ _T(A16_SINT, 16_SINT, NONE, WZYX),
+ _T(L16_UINT, 16_UINT, NONE, WZYX),
+ _T(L16_SINT, 16_SINT, NONE, WZYX),
+ _T(I16_UINT, 16_UINT, NONE, WZYX),
+ _T(I16_SINT, 16_SINT, NONE, WZYX),
+
+ VT(R8G8_UNORM, 8_8_UNORM, R8G8_UNORM, WZYX),
+ VT(R8G8_SNORM, 8_8_SNORM, R8G8_SNORM, WZYX),
+ VT(R8G8_UINT, 8_8_UINT, NONE, WZYX),
+ VT(R8G8_SINT, 8_8_SINT, NONE, WZYX),
V_(R8G8_USCALED, 8_8_UINT, NONE, WZYX),
V_(R8G8_SSCALED, 8_8_SINT, NONE, WZYX),
- /*_T(B5G6R5_UNORM, 5_6_5_UNORM, R5G6B5_UNORM, WXYZ),*/
- _T(B5G5R5A1_UNORM, 5_5_5_1_UNORM, NONE, WXYZ),
- _T(B5G5R5X1_UNORM, 5_5_5_1_UNORM, NONE, WXYZ),
- _T(B4G4R4A4_UNORM, 4_4_4_4_UNORM, NONE, WXYZ),
+ _T(L8A8_UINT, 8_8_UINT, NONE, WZYX),
+ _T(L8A8_SINT, 8_8_SINT, NONE, WZYX),
+
+ _T(B5G5R5A1_UNORM, 5_5_5_1_UNORM, R5G5B5A1_UNORM, WXYZ),
+ _T(B5G5R5X1_UNORM, 5_5_5_1_UNORM, R5G5B5A1_UNORM, WXYZ),
+ _T(B4G4R4A4_UNORM, 4_4_4_4_UNORM, R4G4B4A4_UNORM, WXYZ),
/* 24-bit */
V_(R8G8B8_UNORM, 8_8_8_UNORM, NONE, WZYX),
@@ -119,48 +128,67 @@ static struct fd4_format formats[PIPE_FORMAT_COUNT] = {
V_(R8G8B8_SSCALED, 8_8_8_SINT, NONE, WZYX),
/* 32-bit */
+ VT(R32_UINT, 32_UINT, R32_UINT, WZYX),
+ VT(R32_SINT, 32_SINT, R32_SINT, WZYX),
+ V_(R32_USCALED, 32_UINT, NONE, WZYX),
+ V_(R32_SSCALED, 32_UINT, NONE, WZYX),
VT(R32_FLOAT, 32_FLOAT, NONE, WZYX),
V_(R32_FIXED, 32_FIXED, NONE, WZYX),
+ _T(A32_UINT, 32_UINT, NONE, WZYX),
+ _T(A32_SINT, 32_SINT, NONE, WZYX),
+ _T(L32_UINT, 32_UINT, NONE, WZYX),
+ _T(L32_SINT, 32_SINT, NONE, WZYX),
+ _T(I32_UINT, 32_UINT, NONE, WZYX),
+ _T(I32_SINT, 32_SINT, NONE, WZYX),
+
V_(R16G16_UNORM, 16_16_UNORM, NONE, WZYX),
V_(R16G16_SNORM, 16_16_SNORM, NONE, WZYX),
- V_(R16G16_UINT, 16_16_UINT, NONE, WZYX),
- V_(R16G16_SINT, 16_16_SINT, NONE, WZYX),
+ VT(R16G16_UINT, 16_16_UINT, R16G16_UINT, WZYX),
+ VT(R16G16_SINT, 16_16_SINT, R16G16_SINT, WZYX),
V_(R16G16_USCALED, 16_16_UINT, NONE, WZYX),
V_(R16G16_SSCALED, 16_16_SINT, NONE, WZYX),
VT(R16G16_FLOAT, 16_16_FLOAT, NONE, WZYX),
+ _T(L16A16_UINT, 16_16_UINT, NONE, WZYX),
+ _T(L16A16_SINT, 16_16_SINT, NONE, WZYX),
+
VT(R8G8B8A8_UNORM, 8_8_8_8_UNORM, R8G8B8A8_UNORM, WZYX),
_T(R8G8B8X8_UNORM, 8_8_8_8_UNORM, R8G8B8A8_UNORM, WZYX),
- _T(R8G8B8A8_SRGB, 8_8_8_8_UNORM, NONE, WZYX),
- _T(R8G8B8X8_SRGB, 8_8_8_8_UNORM, NONE, WZYX),
- V_(R8G8B8A8_SNORM, 8_8_8_8_SNORM, NONE, WZYX),
- V_(R8G8B8A8_UINT, 8_8_8_8_UINT, NONE, WZYX),
- V_(R8G8B8A8_SINT, 8_8_8_8_SINT, NONE, WZYX),
+ _T(R8G8B8A8_SRGB, 8_8_8_8_UNORM, R8G8B8A8_UNORM, WZYX),
+ _T(R8G8B8X8_SRGB, 8_8_8_8_UNORM, R8G8B8A8_UNORM, WZYX),
+ VT(R8G8B8A8_SNORM, 8_8_8_8_SNORM, R8G8B8A8_SNORM, WZYX),
+ VT(R8G8B8A8_UINT, 8_8_8_8_UINT, R8G8B8A8_UINT, WZYX),
+ VT(R8G8B8A8_SINT, 8_8_8_8_SINT, R8G8B8A8_SINT, WZYX),
V_(R8G8B8A8_USCALED, 8_8_8_8_UINT, NONE, WZYX),
V_(R8G8B8A8_SSCALED, 8_8_8_8_SINT, NONE, WZYX),
VT(B8G8R8A8_UNORM, 8_8_8_8_UNORM, R8G8B8A8_UNORM, WXYZ),
_T(B8G8R8X8_UNORM, 8_8_8_8_UNORM, R8G8B8A8_UNORM, WXYZ),
- VT(B8G8R8A8_SRGB, 8_8_8_8_UNORM, NONE, WXYZ),
- _T(B8G8R8X8_SRGB, 8_8_8_8_UNORM, NONE, WXYZ),
+ VT(B8G8R8A8_SRGB, 8_8_8_8_UNORM, R8G8B8A8_UNORM, WXYZ),
+ _T(B8G8R8X8_SRGB, 8_8_8_8_UNORM, R8G8B8A8_UNORM, WXYZ),
VT(A8B8G8R8_UNORM, 8_8_8_8_UNORM, R8G8B8A8_UNORM, XYZW),
_T(X8B8G8R8_UNORM, 8_8_8_8_UNORM, R8G8B8A8_UNORM, XYZW),
- _T(A8B8G8R8_SRGB, 8_8_8_8_UNORM, NONE, XYZW),
- _T(X8B8G8R8_SRGB, 8_8_8_8_UNORM, NONE, XYZW),
+ _T(A8B8G8R8_SRGB, 8_8_8_8_UNORM, R8G8B8A8_UNORM, XYZW),
+ _T(X8B8G8R8_SRGB, 8_8_8_8_UNORM, R8G8B8A8_UNORM, XYZW),
VT(A8R8G8B8_UNORM, 8_8_8_8_UNORM, R8G8B8A8_UNORM, ZYXW),
_T(X8R8G8B8_UNORM, 8_8_8_8_UNORM, R8G8B8A8_UNORM, ZYXW),
- _T(A8R8G8B8_SRGB, 8_8_8_8_UNORM, NONE, ZYXW),
- _T(X8R8G8B8_SRGB, 8_8_8_8_UNORM, NONE, ZYXW),
+ _T(A8R8G8B8_SRGB, 8_8_8_8_UNORM, R8G8B8A8_UNORM, ZYXW),
+ _T(X8R8G8B8_SRGB, 8_8_8_8_UNORM, R8G8B8A8_UNORM, ZYXW),
- V_(R10G10B10A2_UNORM, 10_10_10_2_UNORM, NONE/*R10G10B10A2_UNORM*/, WZYX),
+ VT(R10G10B10A2_UNORM, 10_10_10_2_UNORM, R10G10B10A2_UNORM, WZYX),
+ VT(B10G10R10A2_UNORM, 10_10_10_2_UNORM, R10G10B10A2_UNORM, WXYZ),
+ _T(B10G10R10X2_UNORM, 10_10_10_2_UNORM, R10G10B10A2_UNORM, WXYZ),
V_(R10G10B10A2_SNORM, 10_10_10_2_SNORM, NONE, WZYX),
V_(R10G10B10A2_UINT, 10_10_10_2_UINT, NONE, WZYX),
V_(R10G10B10A2_USCALED, 10_10_10_2_UINT, NONE, WZYX),
V_(R10G10B10A2_SSCALED, 10_10_10_2_SINT, NONE, WZYX),
+ _T(R11G11B10_FLOAT, 11_11_10_FLOAT, R11G11B10_FLOAT, WZYX),
+ _T(R9G9B9E5_FLOAT, 9_9_9_E5_FLOAT, NONE, WZYX),
+
_T(Z24X8_UNORM, X8Z24_UNORM, R8G8B8A8_UNORM, WZYX),
_T(Z24_UNORM_S8_UINT, X8Z24_UNORM, R8G8B8A8_UNORM, WZYX),
/*_T(Z32_FLOAT, Z32_FLOAT, R8G8B8A8_UNORM, WZYX),*/
@@ -177,23 +205,42 @@ static struct fd4_format formats[PIPE_FORMAT_COUNT] = {
/* 64-bit */
V_(R16G16B16A16_UNORM, 16_16_16_16_UNORM, NONE, WZYX),
V_(R16G16B16A16_SNORM, 16_16_16_16_SNORM, NONE, WZYX),
- V_(R16G16B16A16_UINT, 16_16_16_16_UINT, NONE, WZYX),
- V_(R16G16B16A16_SINT, 16_16_16_16_SINT, NONE, WZYX),
+ VT(R16G16B16A16_UINT, 16_16_16_16_UINT, R16G16B16A16_UINT, WZYX),
+ _T(R16G16B16X16_UINT, 16_16_16_16_UINT, R16G16B16A16_UINT, WZYX),
+ VT(R16G16B16A16_SINT, 16_16_16_16_SINT, R16G16B16A16_SINT, WZYX),
+ _T(R16G16B16X16_SINT, 16_16_16_16_SINT, R16G16B16A16_SINT, WZYX),
V_(R16G16B16A16_USCALED, 16_16_16_16_UINT, NONE, WZYX),
V_(R16G16B16A16_SSCALED, 16_16_16_16_SINT, NONE, WZYX),
- VT(R16G16B16A16_FLOAT, 16_16_16_16_FLOAT, NONE, WZYX),
- _T(R16G16B16X16_FLOAT, 16_16_16_16_FLOAT, NONE, WZYX),
+ VT(R16G16B16A16_FLOAT, 16_16_16_16_FLOAT, R16G16B16A16_FLOAT, WZYX),
+ _T(R16G16B16X16_FLOAT, 16_16_16_16_FLOAT, R16G16B16A16_FLOAT, WZYX),
+ VT(R32G32_UINT, 32_32_UINT, R32G32_UINT, WZYX),
+ VT(R32G32_SINT, 32_32_SINT, R32G32_SINT, WZYX),
+ V_(R32G32_USCALED, 32_32_UINT, NONE, WZYX),
+ V_(R32G32_SSCALED, 32_32_SINT, NONE, WZYX),
VT(R32G32_FLOAT, 32_32_FLOAT, NONE, WZYX),
V_(R32G32_FIXED, 32_32_FIXED, NONE, WZYX),
+ _T(L32A32_UINT, 32_32_UINT, NONE, WZYX),
+ _T(L32A32_SINT, 32_32_SINT, NONE, WZYX),
+
/* 96-bit */
+ V_(R32G32B32_UINT, 32_32_32_UINT, NONE, WZYX),
+ V_(R32G32B32_SINT, 32_32_32_SINT, NONE, WZYX),
+ V_(R32G32B32_USCALED, 32_32_32_UINT, NONE, WZYX),
+ V_(R32G32B32_SSCALED, 32_32_32_SINT, NONE, WZYX),
V_(R32G32B32_FLOAT, 32_32_32_FLOAT, NONE, WZYX),
V_(R32G32B32_FIXED, 32_32_32_FIXED, NONE, WZYX),
/* 128-bit */
- VT(R32G32B32A32_FLOAT, 32_32_32_32_FLOAT, NONE, WZYX),
- _T(R32G32B32X32_FLOAT, 32_32_32_32_FLOAT, NONE, WZYX),
+ VT(R32G32B32A32_UINT, 32_32_32_32_UINT, R32G32B32A32_UINT, WZYX),
+ _T(R32G32B32X32_UINT, 32_32_32_32_UINT, R32G32B32A32_UINT, WZYX),
+ VT(R32G32B32A32_SINT, 32_32_32_32_SINT, R32G32B32A32_SINT, WZYX),
+ _T(R32G32B32X32_SINT, 32_32_32_32_SINT, R32G32B32A32_SINT, WZYX),
+ V_(R32G32B32A32_USCALED, 32_32_32_32_UINT, NONE, WZYX),
+ V_(R32G32B32A32_SSCALED, 32_32_32_32_SINT, NONE, WZYX),
+ VT(R32G32B32A32_FLOAT, 32_32_32_32_FLOAT, R32G32B32A32_FLOAT, WZYX),
+ _T(R32G32B32X32_FLOAT, 32_32_32_32_FLOAT, R32G32B32A32_FLOAT, WZYX),
V_(R32G32B32A32_FIXED, 32_32_32_32_FIXED, NONE, WZYX),
};
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
index f2cc33b1a63..6ba25d0816d 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
@@ -169,6 +169,9 @@ fd4_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
fd4_tex_swiz(cso->format, cso->swizzle_r, cso->swizzle_g,
cso->swizzle_b, cso->swizzle_a);
+ if (util_format_is_srgb(cso->format))
+ so->texconst0 |= A4XX_TEX_CONST_0_SRGB;
+
so->texconst1 =
A4XX_TEX_CONST_1_WIDTH(u_minify(prsc->width0, lvl)) |
A4XX_TEX_CONST_1_HEIGHT(u_minify(prsc->height0, lvl));