return formats[fmt].tex;
}
+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)
{
#define ETNAVIV_FORMAT_H_
#include "util/format/u_format.h"
+#include "pipe/p_state.h"
#include <stdint.h>
#define ETNA_NO_MATCH (~0)
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);
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 */
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));