aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Marek <[email protected]>2019-10-20 02:10:43 -0400
committerJonathan Marek <[email protected]>2019-12-13 09:09:08 -0500
commitd34705c89139d5a6917dbfbafd537809e39fdf8c (patch)
tree023f898f82b43c7506c6faa2c27d010c31b4d4aa
parent15e9704ccb1ebc60a41f9d56c9f129547bc9a529 (diff)
etnaviv: update INT_FILTER choice for GLES3 formats
Signed-off-by: Jonathan Marek <[email protected]> Reviewed-by: Christian Gmeiner <[email protected]>
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_format.c34
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_format.h4
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_texture_desc.c2
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_texture_state.c2
4 files changed, 40 insertions, 2 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.c b/src/gallium/drivers/etnaviv/etnaviv_format.c
index c476e4a9543..ce87f57d9f3 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_format.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_format.c
@@ -272,6 +272,40 @@ translate_texture_format(enum pipe_format fmt)
}
bool
+texture_use_int_filter(const struct pipe_sampler_view *so, bool tex_desc)
+{
+ switch (so->target) {
+ case PIPE_TEXTURE_1D_ARRAY:
+ case PIPE_TEXTURE_2D_ARRAY:
+ if (tex_desc)
+ break;
+ case PIPE_TEXTURE_3D:
+ return false;
+ default:
+ break;
+ }
+
+ /* only unorm formats can use int filter */
+ if (!util_format_is_unorm(so->format))
+ return false;
+
+ if (util_format_is_srgb(so->format))
+ return false;
+
+ switch (so->format) {
+ /* apparently D16 can't use int filter but D24 can */
+ case PIPE_FORMAT_Z16_UNORM:
+ case PIPE_FORMAT_R10G10B10A2_UNORM:
+ case PIPE_FORMAT_R10G10B10X2_UNORM:
+ case PIPE_FORMAT_ETC2_R11_UNORM:
+ case PIPE_FORMAT_ETC2_RG11_UNORM:
+ return false;
+ default:
+ return true;
+ }
+}
+
+bool
texture_format_needs_swiz(enum pipe_format fmt)
{
static const unsigned char def[4] = SWIZ(X, Y, Z, W);
diff --git a/src/gallium/drivers/etnaviv/etnaviv_format.h b/src/gallium/drivers/etnaviv/etnaviv_format.h
index db3d8b970d1..ecc9f8e439c 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_format.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_format.h
@@ -28,6 +28,7 @@
#define ETNAVIV_FORMAT_H_
#include "util/format/u_format.h"
+#include "pipe/p_state.h"
#include <stdint.h>
#define ETNA_NO_MATCH (~0)
@@ -38,6 +39,9 @@ uint32_t
translate_texture_format(enum pipe_format fmt);
bool
+texture_use_int_filter(const struct pipe_sampler_view *so, bool tex_desc);
+
+bool
texture_format_needs_swiz(enum pipe_format fmt);
uint32_t
diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture_desc.c b/src/gallium/drivers/etnaviv/etnaviv_texture_desc.c
index e54b98eadc5..29ae71b785c 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_texture_desc.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_texture_desc.c
@@ -127,7 +127,7 @@ etna_create_sampler_view_desc(struct pipe_context *pctx, struct pipe_resource *p
if (util_format_is_srgb(so->format))
sv->SAMP_CTRL1 |= VIVS_NTE_DESCRIPTOR_SAMP_CTRL1_SRGB;
- if (!util_format_is_float(so->format) && so->target != PIPE_TEXTURE_3D)
+ if (texture_use_int_filter(so, true))
sv->SAMP_CTRL0 |= VIVS_NTE_DESCRIPTOR_SAMP_CTRL0_INT_FILTER;
/* Create texture descriptor */
diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture_state.c b/src/gallium/drivers/etnaviv/etnaviv_texture_state.c
index 8bedb7ee882..6b112206b01 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_texture_state.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_texture_state.c
@@ -188,7 +188,7 @@ etna_create_sampler_view_state(struct pipe_context *pctx, struct pipe_resource *
VIVS_TE_SAMPLER_LOG_SIZE_HEIGHT(etna_log2_fixp55(base_height)) |
COND(util_format_is_srgb(so->format) && !astc, VIVS_TE_SAMPLER_LOG_SIZE_SRGB) |
COND(astc, VIVS_TE_SAMPLER_LOG_SIZE_ASTC) |
- COND(!util_format_is_float(so->format) && so->target != PIPE_TEXTURE_3D, VIVS_TE_SAMPLER_LOG_SIZE_INT_FILTER);
+ COND(texture_use_int_filter(so, false), VIVS_TE_SAMPLER_LOG_SIZE_INT_FILTER);
sv->TE_SAMPLER_3D_CONFIG =
VIVS_TE_SAMPLER_3D_CONFIG_DEPTH(base_depth) |
VIVS_TE_SAMPLER_3D_CONFIG_LOG_DEPTH(etna_log2_fixp55(base_depth));