From: Roland Scheidegger Date: Fri, 1 Aug 2014 21:50:35 +0000 (+0200) Subject: llvmpipe: implement support for cube map arrays X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ea05cfaacac29d15c9c3d939e12546eba95f05d0;p=mesa.git llvmpipe: implement support for cube map arrays This just covers the resource side of things, not the actual sampling. Here things are trivial as cube map arrays are identical to 2d arrays in all respects. Reviewed-by: Brian Paul --- diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index e25d14e23c4..e10a7630ed8 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -347,7 +347,8 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen, target == PIPE_TEXTURE_2D_ARRAY || target == PIPE_TEXTURE_RECT || target == PIPE_TEXTURE_3D || - target == PIPE_TEXTURE_CUBE); + target == PIPE_TEXTURE_CUBE || + target == PIPE_TEXTURE_CUBE_ARRAY); if (sample_count > 1) return FALSE; diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index d728e85dcb6..e85c4ca9c3d 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -844,7 +844,8 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, } if (res->target == PIPE_TEXTURE_1D_ARRAY || - res->target == PIPE_TEXTURE_2D_ARRAY) { + res->target == PIPE_TEXTURE_2D_ARRAY || + res->target == PIPE_TEXTURE_CUBE_ARRAY) { /* * For array textures, we don't have first_layer, instead * adjust last_layer (stored as depth) plus the mip level offsets @@ -856,6 +857,9 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, jit_tex->mip_offsets[j] += view->u.tex.first_layer * lp_tex->img_stride[j]; } + if (res->target == PIPE_TEXTURE_CUBE_ARRAY) { + assert(jit_tex->depth % 6 == 0); + } assert(view->u.tex.first_layer <= view->u.tex.last_layer); assert(view->u.tex.last_layer < res->array_size); } diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index a14a64f9a3d..0180e99fca0 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -246,12 +246,16 @@ prepare_shader_sampling( img_stride[j] = lp_tex->img_stride[j]; } if (res->target == PIPE_TEXTURE_1D_ARRAY || - res->target == PIPE_TEXTURE_2D_ARRAY) { + res->target == PIPE_TEXTURE_2D_ARRAY || + res->target == PIPE_TEXTURE_CUBE_ARRAY) { num_layers = view->u.tex.last_layer - view->u.tex.first_layer + 1; for (j = first_level; j <= last_level; j++) { mip_offsets[j] += view->u.tex.first_layer * lp_tex->img_stride[j]; } + if (res->target == PIPE_TEXTURE_CUBE_ARRAY) { + assert(num_layers % 6 == 0); + } assert(view->u.tex.first_layer <= view->u.tex.last_layer); assert(view->u.tex.last_layer < res->array_size); } diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index ec9e024662d..ba0e7f8b5b8 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -137,7 +137,8 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen, else if (lpr->base.target == PIPE_TEXTURE_3D) num_slices = depth; else if (lpr->base.target == PIPE_TEXTURE_1D_ARRAY || - lpr->base.target == PIPE_TEXTURE_2D_ARRAY) + lpr->base.target == PIPE_TEXTURE_2D_ARRAY || + lpr->base.target == PIPE_TEXTURE_CUBE_ARRAY) num_slices = layers; else num_slices = 1; diff --git a/src/gallium/drivers/llvmpipe/lp_texture.h b/src/gallium/drivers/llvmpipe/lp_texture.h index aa624b05ea4..9fbd3a21648 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.h +++ b/src/gallium/drivers/llvmpipe/lp_texture.h @@ -144,6 +144,7 @@ llvmpipe_resource_is_texture(const struct pipe_resource *resource) case PIPE_TEXTURE_RECT: case PIPE_TEXTURE_3D: case PIPE_TEXTURE_CUBE: + case PIPE_TEXTURE_CUBE_ARRAY: return TRUE; default: assert(0); @@ -165,6 +166,7 @@ llvmpipe_resource_is_1d(const struct pipe_resource *resource) case PIPE_TEXTURE_RECT: case PIPE_TEXTURE_3D: case PIPE_TEXTURE_CUBE: + case PIPE_TEXTURE_CUBE_ARRAY: return FALSE; default: assert(0);