summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/a4xx
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2015-11-20 18:34:03 -0500
committerIlia Mirkin <[email protected]>2015-11-20 19:46:21 -0500
commitfe29330406f8ea277b2c02f9c6dd2da78796ea84 (patch)
tree1ba00808c30fdf4bed22e82219eae0ef408e289b /src/gallium/drivers/freedreno/a4xx
parent39fa5c8419076f6ec84de0252905617feb70f279 (diff)
freedreno/a4xx: use hardware RGTC texture samplers
a4xx hardware has real support for RGTC so there's no need to fake it like we do on a3xx. Undo the hacks, and keep track of an "internal format" of a resource, which on a3xx will be different, triggering the transfer-time conversions to take place. Signed-off-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/a4xx')
-rw-r--r--src/gallium/drivers/freedreno/a4xx/a4xx.xml.h4
-rw-r--r--src/gallium/drivers/freedreno/a4xx/fd4_format.c27
-rw-r--r--src/gallium/drivers/freedreno/a4xx/fd4_format.h1
-rw-r--r--src/gallium/drivers/freedreno/a4xx/fd4_texture.c2
4 files changed, 13 insertions, 21 deletions
diff --git a/src/gallium/drivers/freedreno/a4xx/a4xx.xml.h b/src/gallium/drivers/freedreno/a4xx/a4xx.xml.h
index e46a11e94fe..4436697aad4 100644
--- a/src/gallium/drivers/freedreno/a4xx/a4xx.xml.h
+++ b/src/gallium/drivers/freedreno/a4xx/a4xx.xml.h
@@ -207,6 +207,10 @@ enum a4xx_tex_fmt {
TFMT4_DXT1 = 86,
TFMT4_DXT3 = 87,
TFMT4_DXT5 = 88,
+ TFMT4_RGTC1_UNORM = 90,
+ TFMT4_RGTC1_SNORM = 91,
+ TFMT4_RGTC2_UNORM = 94,
+ TFMT4_RGTC2_SNORM = 95,
TFMT4_BPTC_UFLOAT = 97,
TFMT4_BPTC_FLOAT = 98,
TFMT4_BPTC = 99,
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_format.c b/src/gallium/drivers/freedreno/a4xx/fd4_format.c
index d2a1aee68d3..a97e01aa6c2 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_format.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_format.c
@@ -291,15 +291,14 @@ static struct fd4_format formats[PIPE_FORMAT_COUNT] = {
_T(BPTC_RGB_FLOAT, BPTC_FLOAT, NONE, WZYX),
_T(BPTC_RGB_UFLOAT, BPTC_UFLOAT, NONE, WZYX),
- /* faked */
- _T(RGTC1_UNORM, 8_8_8_8_UNORM, NONE, WZYX),
- _T(RGTC1_SNORM, 8_8_8_8_SNORM, NONE, WZYX),
- _T(RGTC2_UNORM, 8_8_8_8_UNORM, NONE, WZYX),
- _T(RGTC2_SNORM, 8_8_8_8_SNORM, NONE, WZYX),
- _T(LATC1_UNORM, 8_8_8_8_UNORM, NONE, WZYX),
- _T(LATC1_SNORM, 8_8_8_8_SNORM, NONE, WZYX),
- _T(LATC2_UNORM, 8_8_8_8_UNORM, NONE, WZYX),
- _T(LATC2_SNORM, 8_8_8_8_SNORM, NONE, WZYX),
+ _T(RGTC1_UNORM, RGTC1_UNORM, NONE, WZYX),
+ _T(RGTC1_SNORM, RGTC1_SNORM, NONE, WZYX),
+ _T(RGTC2_UNORM, RGTC2_UNORM, NONE, WZYX),
+ _T(RGTC2_SNORM, RGTC2_SNORM, NONE, WZYX),
+ _T(LATC1_UNORM, RGTC1_UNORM, NONE, WZYX),
+ _T(LATC1_SNORM, RGTC1_SNORM, NONE, WZYX),
+ _T(LATC2_UNORM, RGTC2_UNORM, NONE, WZYX),
+ _T(LATC2_SNORM, RGTC2_SNORM, NONE, WZYX),
};
/* convert pipe format to vertex buffer format: */
@@ -342,8 +341,6 @@ fd4_pipe2fetchsize(enum pipe_format format)
{
if (format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT)
format = PIPE_FORMAT_Z32_FLOAT;
- else if (util_format_description(format)->layout == UTIL_FORMAT_LAYOUT_RGTC)
- format = PIPE_FORMAT_R8G8B8A8_UNORM;
switch (util_format_get_blocksizebits(format) / util_format_get_blockwidth(format)) {
case 8: return TFETCH4_1_BYTE;
@@ -359,14 +356,6 @@ fd4_pipe2fetchsize(enum pipe_format format)
}
}
-unsigned
-fd4_pipe2nblocksx(enum pipe_format format, unsigned width)
-{
- if (util_format_description(format)->layout == UTIL_FORMAT_LAYOUT_RGTC)
- format = PIPE_FORMAT_R8G8B8A8_UNORM;
- return util_format_get_nblocksx(format, width);
-}
-
/* we need to special case a bit the depth/stencil restore, because we are
* using the texture sampler to blit into the depth/stencil buffer, *not*
* into a color buffer. Otherwise fd4_tex_swiz() will do the wrong thing,
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_format.h b/src/gallium/drivers/freedreno/a4xx/fd4_format.h
index 8c365f081de..04837da650b 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_format.h
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_format.h
@@ -38,7 +38,6 @@ enum a4xx_tex_fmt fd4_pipe2tex(enum pipe_format format);
enum a4xx_color_fmt fd4_pipe2color(enum pipe_format format);
enum pipe_format fd4_gmem_restore_format(enum pipe_format format);
enum a3xx_color_swap fd4_pipe2swap(enum pipe_format format);
-unsigned fd4_pipe2nblocksx(enum pipe_format format, unsigned width);
enum a4xx_tex_fetchsize fd4_pipe2fetchsize(enum pipe_format format);
enum a4xx_depth_format fd4_pipe2depth(enum pipe_format format);
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
index 00c257b78e5..75b083b8ca0 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
@@ -240,7 +240,7 @@ fd4_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
so->texconst2 =
A4XX_TEX_CONST_2_FETCHSIZE(fd4_pipe2fetchsize(cso->format)) |
A4XX_TEX_CONST_2_PITCH(
- fd4_pipe2nblocksx(
+ util_format_get_nblocksx(
cso->format, rsc->slices[lvl].pitch) * rsc->cpp);
switch (prsc->target) {