mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 04:50:11 +01:00
etnaviv: do not use int filter when anisotropic filtering is used
The blob does not use this combination. This change moves the
decision if int filter gets used to state emit time.
Fixes: 7aaa0e5908 ("etnaviv: add anisotropic filter support")
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4872>
This commit is contained in:
parent
b38e51bd96
commit
89a41dae77
4 changed files with 25 additions and 12 deletions
|
|
@ -268,9 +268,11 @@ translate_texture_format(enum pipe_format fmt)
|
|||
}
|
||||
|
||||
bool
|
||||
texture_use_int_filter(const struct pipe_sampler_view *so, bool tex_desc)
|
||||
texture_use_int_filter(const struct pipe_sampler_view *sv,
|
||||
const struct pipe_sampler_state *ss,
|
||||
bool tex_desc)
|
||||
{
|
||||
switch (so->target) {
|
||||
switch (sv->target) {
|
||||
case PIPE_TEXTURE_1D_ARRAY:
|
||||
case PIPE_TEXTURE_2D_ARRAY:
|
||||
if (tex_desc)
|
||||
|
|
@ -282,16 +284,19 @@ texture_use_int_filter(const struct pipe_sampler_view *so, bool tex_desc)
|
|||
}
|
||||
|
||||
/* only unorm formats can use int filter */
|
||||
if (!util_format_is_unorm(so->format))
|
||||
if (!util_format_is_unorm(sv->format))
|
||||
return false;
|
||||
|
||||
if (util_format_is_srgb(so->format))
|
||||
if (util_format_is_srgb(sv->format))
|
||||
return false;
|
||||
|
||||
if (util_format_description(so->format)->layout == UTIL_FORMAT_LAYOUT_ASTC)
|
||||
if (util_format_description(sv->format)->layout == UTIL_FORMAT_LAYOUT_ASTC)
|
||||
return false;
|
||||
|
||||
switch (so->format) {
|
||||
if (ss->max_anisotropy > 1)
|
||||
return false;
|
||||
|
||||
switch (sv->format) {
|
||||
/* apparently D16 can't use int filter but D24 can */
|
||||
case PIPE_FORMAT_Z16_UNORM:
|
||||
case PIPE_FORMAT_R10G10B10A2_UNORM:
|
||||
|
|
|
|||
|
|
@ -39,7 +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);
|
||||
texture_use_int_filter(const struct pipe_sampler_view *sv,
|
||||
const struct pipe_sampler_state *ss,
|
||||
bool tex_desc);
|
||||
|
||||
bool
|
||||
texture_format_needs_swiz(enum pipe_format fmt);
|
||||
|
|
|
|||
|
|
@ -161,9 +161,6 @@ 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 (texture_use_int_filter(so, true))
|
||||
sv->SAMP_CTRL0 |= VIVS_NTE_DESCRIPTOR_SAMP_CTRL0_INT_FILTER;
|
||||
|
||||
/* Create texture descriptor */
|
||||
sv->bo = etna_bo_new(ctx->screen->dev, 0x100, DRM_ETNA_GEM_CACHE_WC);
|
||||
if (!sv->bo)
|
||||
|
|
@ -293,6 +290,10 @@ etna_emit_texture_desc(struct etna_context *ctx)
|
|||
if ((1 << x) & active_samplers) {
|
||||
struct etna_sampler_state_desc *ss = etna_sampler_state_desc(ctx->sampler[x]);
|
||||
struct etna_sampler_view_desc *sv = etna_sampler_view_desc(ctx->sampler_view[x]);
|
||||
|
||||
if (texture_use_int_filter(&sv->base, &ss->base, true))
|
||||
sv->SAMP_CTRL0 |= VIVS_NTE_DESCRIPTOR_SAMP_CTRL0_INT_FILTER;
|
||||
|
||||
etna_set_state(stream, VIVS_NTE_DESCRIPTOR_TX_CTRL(x),
|
||||
COND(sv->ts.enable, VIVS_NTE_DESCRIPTOR_TX_CTRL_TS_ENABLE) |
|
||||
VIVS_NTE_DESCRIPTOR_TX_CTRL_TS_MODE(sv->ts.mode) |
|
||||
|
|
|
|||
|
|
@ -232,8 +232,7 @@ etna_create_sampler_view_state(struct pipe_context *pctx, struct pipe_resource *
|
|||
VIVS_TE_SAMPLER_LOG_SIZE_WIDTH(etna_log2_fixp55(res->base.width0)) |
|
||||
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(texture_use_int_filter(so, false), VIVS_TE_SAMPLER_LOG_SIZE_INT_FILTER);
|
||||
COND(astc, VIVS_TE_SAMPLER_LOG_SIZE_ASTC);
|
||||
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));
|
||||
|
|
@ -335,6 +334,7 @@ etna_emit_texture_state(struct etna_context *ctx)
|
|||
}
|
||||
}
|
||||
if (unlikely(dirty & (ETNA_DIRTY_SAMPLER_VIEWS))) {
|
||||
struct etna_sampler_state *ss;
|
||||
struct etna_sampler_view *sv;
|
||||
|
||||
for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
|
||||
|
|
@ -345,7 +345,12 @@ etna_emit_texture_state(struct etna_context *ctx)
|
|||
}
|
||||
for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
|
||||
if ((1 << x) & active_samplers) {
|
||||
ss = etna_sampler_state(ctx->sampler[x]);
|
||||
sv = etna_sampler_view(ctx->sampler_view[x]);
|
||||
|
||||
if (texture_use_int_filter(&sv->base, &ss->base, false))
|
||||
sv->TE_SAMPLER_LOG_SIZE |= VIVS_TE_SAMPLER_LOG_SIZE_INT_FILTER;
|
||||
|
||||
/*02080*/ EMIT_STATE(TE_SAMPLER_LOG_SIZE(x), sv->TE_SAMPLER_LOG_SIZE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue