diff options
author | Jonathan Marek <[email protected]> | 2019-06-19 11:43:54 -0400 |
---|---|---|
committer | Jonathan Marek <[email protected]> | 2019-07-14 10:34:17 -0400 |
commit | 2c393053bf5c1e76bdcf37f620259fc63dd31859 (patch) | |
tree | 12365ec020f3cca4153dbc0ecd6cf7a8713dff8b | |
parent | 63efb6ec6c7b2053f0d6be4714d46ff04f893de1 (diff) |
etnaviv: fix nearest_linear / linear_nearest filtering on GC3000
The MIN filter is never used when not using mipmaps. This fixes that.
Interestingly, only GC3000 needs this (GC2000 works without this fix).
Signed-off-by: Jonathan Marek <[email protected]>
Reviewed-by: Christian Gmeiner <[email protected]>
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_texture_state.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_texture_state.h | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture_state.c b/src/gallium/drivers/etnaviv/etnaviv_texture_state.c index ffb3ffdcc84..c3c68740f97 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_texture_state.c +++ b/src/gallium/drivers/etnaviv/etnaviv_texture_state.c @@ -77,6 +77,12 @@ etna_create_sampler_state_state(struct pipe_context *pipe, cs->min_lod = cs->max_lod = etna_float_to_fixp55(ss->min_lod); } + /* if max_lod is 0, MIN filter will never be used (GC3000) + * when min filter is different from mag filter, we need HW to compute LOD + * the workaround is to set max_lod to at least 1 + */ + cs->max_lod_min = (ss->min_img_filter != ss->mag_img_filter) ? 1 : 0; + return cs; } @@ -284,10 +290,12 @@ etna_emit_texture_state(struct etna_context *ctx) ss = etna_sampler_state(ctx->sampler[x]); sv = etna_sampler_view(ctx->sampler_view[x]); + unsigned max_lod = MAX2(MIN2(ss->max_lod, sv->max_lod), ss->max_lod_min); + /* min and max lod is determined both by the sampler and the view */ /*020C0*/ EMIT_STATE(TE_SAMPLER_LOD_CONFIG(x), ss->TE_SAMPLER_LOD_CONFIG | - VIVS_TE_SAMPLER_LOD_CONFIG_MAX(MIN2(ss->max_lod, sv->max_lod)) | + VIVS_TE_SAMPLER_LOD_CONFIG_MAX(max_lod) | VIVS_TE_SAMPLER_LOD_CONFIG_MIN(MAX2(ss->min_lod, sv->min_lod))); } } diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture_state.h b/src/gallium/drivers/etnaviv/etnaviv_texture_state.h index 87841477be9..a426d4b6c1e 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_texture_state.h +++ b/src/gallium/drivers/etnaviv/etnaviv_texture_state.h @@ -43,7 +43,7 @@ struct etna_sampler_state { uint32_t TE_SAMPLER_CONFIG0; uint32_t TE_SAMPLER_CONFIG1; uint32_t TE_SAMPLER_LOD_CONFIG; - unsigned min_lod, max_lod; + unsigned min_lod, max_lod, max_lod_min; }; static inline struct etna_sampler_state * |