diff options
author | Jonathan Marek <[email protected]> | 2019-10-20 02:11:45 -0400 |
---|---|---|
committer | Christian Gmeiner <[email protected]> | 2019-11-26 19:07:04 +0100 |
commit | 2da4a58ed92feaaab49a078bfb7b4453f9b697ba (patch) | |
tree | c81eb5ceb6edf8ad41318c7d4d4f31f4f880ce5e /src/gallium | |
parent | 7806e058c9e62f0d8e8c275898b1962052a1691a (diff) |
etnaviv: support 3d/array/integer formats in texture descriptors
Signed-off-by: Jonathan Marek <[email protected]>
Reviewed-by: Christian Gmeiner <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_texture_desc.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture_desc.c b/src/gallium/drivers/etnaviv/etnaviv_texture_desc.c index 05b6de44f91..e54b98eadc5 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_texture_desc.c +++ b/src/gallium/drivers/etnaviv/etnaviv_texture_desc.c @@ -90,6 +90,7 @@ static struct pipe_sampler_view * etna_create_sampler_view_desc(struct pipe_context *pctx, struct pipe_resource *prsc, const struct pipe_sampler_view *so) { + const struct util_format_description *desc = util_format_description(so->format); struct etna_sampler_view_desc *sv = CALLOC_STRUCT(etna_sampler_view_desc); struct etna_context *ctx = etna_context(pctx); const uint32_t format = translate_texture_format(so->format); @@ -141,6 +142,17 @@ etna_create_sampler_view_desc(struct pipe_context *pctx, struct pipe_resource *p /** GC7000 needs the size of the BASELOD level */ uint32_t base_width = u_minify(res->base.width0, sv->base.u.tex.first_level); uint32_t base_height = u_minify(res->base.height0, sv->base.u.tex.first_level); + uint32_t base_depth = u_minify(res->base.depth0, sv->base.u.tex.first_level); + bool is_array = false; + bool sint = util_format_is_pure_sint(so->format); + + if (sv->base.target == PIPE_TEXTURE_1D_ARRAY) { + is_array = true; + base_height = res->base.array_size; + } else if (sv->base.target == PIPE_TEXTURE_2D_ARRAY) { + is_array = true; + base_depth = res->base.array_size; + } #define DESC_SET(x, y) buf[(TEXDESC_##x)>>2] = (y) DESC_SET(CONFIG0, COND(!ext && !astc, VIVS_TE_SAMPLER_CONFIG0_FORMAT(format)) @@ -149,11 +161,15 @@ etna_create_sampler_view_desc(struct pipe_context *pctx, struct pipe_resource *p VIVS_TE_SAMPLER_CONFIG0_ADDRESSING_MODE(TEXTURE_ADDRESSING_MODE_LINEAR))); DESC_SET(CONFIG1, COND(ext, VIVS_TE_SAMPLER_CONFIG1_FORMAT_EXT(format)) | COND(astc, VIVS_TE_SAMPLER_CONFIG1_FORMAT_EXT(TEXTURE_FORMAT_EXT_ASTC)) | - VIVS_TE_SAMPLER_CONFIG1_HALIGN(res->halign) | swiz); - DESC_SET(CONFIG2, 0x00030000); + COND(is_array, VIVS_TE_SAMPLER_CONFIG1_TEXTURE_ARRAY) | + VIVS_TE_SAMPLER_CONFIG1_HALIGN(res->halign) | swiz); + DESC_SET(CONFIG2, 0x00030000 | + COND(sint && desc->channel[0].size == 8, TE_SAMPLER_CONFIG2_SIGNED_INT8) | + COND(sint && desc->channel[0].size == 16, TE_SAMPLER_CONFIG2_SIGNED_INT16)); DESC_SET(LINEAR_STRIDE, res->levels[0].stride); + DESC_SET(VOLUME, etna_log2_fixp88(base_depth)); DESC_SET(SLICE, res->levels[0].layer_stride); - DESC_SET(3D_CONFIG, 0x00000001); + DESC_SET(3D_CONFIG, VIVS_TE_SAMPLER_3D_CONFIG_DEPTH(base_depth)); DESC_SET(ASTC0, COND(astc, VIVS_NTE_SAMPLER_ASTC0_ASTC_FORMAT(format)) | VIVS_NTE_SAMPLER_ASTC0_UNK8(0xc) | VIVS_NTE_SAMPLER_ASTC0_UNK16(0xc) | |