mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 22:10:10 +01:00
etnaviv: add linear sampling support
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
This commit is contained in:
parent
42ca4dda2d
commit
34458c1cf6
3 changed files with 25 additions and 1 deletions
|
|
@ -172,7 +172,9 @@ etna_resource_sampler_compatible(struct etna_resource *res)
|
||||||
if (res->layout == ETNA_LAYOUT_SUPER_TILED && VIV_FEATURE(screen, chipMinorFeatures2, SUPERTILED_TEXTURE))
|
if (res->layout == ETNA_LAYOUT_SUPER_TILED && VIV_FEATURE(screen, chipMinorFeatures2, SUPERTILED_TEXTURE))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* TODO: LINEAR_TEXTURE_SUPPORT */
|
/* This GPU supports texturing from linear textures? */
|
||||||
|
if (res->layout == ETNA_LAYOUT_LINEAR && VIV_FEATURE(screen, chipMinorFeatures1, LINEAR_TEXTURE_SUPPORT))
|
||||||
|
return true;
|
||||||
|
|
||||||
/* Otherwise, only support tiled layouts */
|
/* Otherwise, only support tiled layouts */
|
||||||
if (res->layout != ETNA_LAYOUT_TILED)
|
if (res->layout != ETNA_LAYOUT_TILED)
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,17 @@ etna_create_sampler_view_state(struct pipe_context *pctx, struct pipe_resource *
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res->addressing_mode == ETNA_ADDRESSING_MODE_LINEAR) {
|
||||||
|
sv->TE_SAMPLER_CONFIG0 |= VIVS_TE_SAMPLER_CONFIG0_ADDRESSING_MODE(TEXTURE_ADDRESSING_MODE_LINEAR);
|
||||||
|
|
||||||
|
for (int lod = 0; lod <= res->base.last_level; ++lod)
|
||||||
|
sv->TE_SAMPLER_LINEAR_STRIDE[lod] = res->levels[lod].stride;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
sv->TE_SAMPLER_CONFIG0 |= VIVS_TE_SAMPLER_CONFIG0_ADDRESSING_MODE(TEXTURE_ADDRESSING_MODE_TILED);
|
||||||
|
memset(&sv->TE_SAMPLER_LINEAR_STRIDE, 0, sizeof(sv->TE_SAMPLER_LINEAR_STRIDE));
|
||||||
|
}
|
||||||
|
|
||||||
sv->TE_SAMPLER_CONFIG1 = COND(ext, VIVS_TE_SAMPLER_CONFIG1_FORMAT_EXT(format)) |
|
sv->TE_SAMPLER_CONFIG1 = COND(ext, VIVS_TE_SAMPLER_CONFIG1_FORMAT_EXT(format)) |
|
||||||
COND(astc, VIVS_TE_SAMPLER_CONFIG1_FORMAT_EXT(TEXTURE_FORMAT_EXT_ASTC)) |
|
COND(astc, VIVS_TE_SAMPLER_CONFIG1_FORMAT_EXT(TEXTURE_FORMAT_EXT_ASTC)) |
|
||||||
VIVS_TE_SAMPLER_CONFIG1_HALIGN(res->halign) | swiz;
|
VIVS_TE_SAMPLER_CONFIG1_HALIGN(res->halign) | swiz;
|
||||||
|
|
@ -294,6 +305,16 @@ etna_emit_texture_state(struct etna_context *ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (unlikely(dirty & (ETNA_DIRTY_SAMPLER_VIEWS))) {
|
||||||
|
for (int y = 0; y < VIVS_TE_SAMPLER_LINEAR_STRIDE__LEN; ++y) {
|
||||||
|
for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
|
||||||
|
if ((1 << x) & active_samplers) {
|
||||||
|
struct etna_sampler_view *sv = etna_sampler_view(ctx->sampler_view[x]);
|
||||||
|
/*02C00*/ EMIT_STATE(TE_SAMPLER_LINEAR_STRIDE(x, y), sv->TE_SAMPLER_LINEAR_STRIDE[y]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (unlikely(ctx->specs.tex_astc && (dirty & (ETNA_DIRTY_SAMPLER_VIEWS)))) {
|
if (unlikely(ctx->specs.tex_astc && (dirty & (ETNA_DIRTY_SAMPLER_VIEWS)))) {
|
||||||
for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
|
for (int x = 0; x < VIVS_TE_SAMPLER__LEN; ++x) {
|
||||||
if ((1 << x) & active_samplers) {
|
if ((1 << x) & active_samplers) {
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ struct etna_sampler_view {
|
||||||
uint32_t TE_SAMPLER_SIZE;
|
uint32_t TE_SAMPLER_SIZE;
|
||||||
uint32_t TE_SAMPLER_LOG_SIZE;
|
uint32_t TE_SAMPLER_LOG_SIZE;
|
||||||
uint32_t TE_SAMPLER_ASTC0;
|
uint32_t TE_SAMPLER_ASTC0;
|
||||||
|
uint32_t TE_SAMPLER_LINEAR_STRIDE[VIVS_TE_SAMPLER_LINEAR_STRIDE__LEN];
|
||||||
struct etna_reloc TE_SAMPLER_LOD_ADDR[VIVS_TE_SAMPLER_LOD_ADDR__LEN];
|
struct etna_reloc TE_SAMPLER_LOD_ADDR[VIVS_TE_SAMPLER_LOD_ADDR__LEN];
|
||||||
unsigned min_lod, max_lod; /* 5.5 fixp */
|
unsigned min_lod, max_lod; /* 5.5 fixp */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue