intel/isl: Treat 3-D textures as 2-D arrays for rendering

In particular, this means that isl_view::base_array_layer and
isl_view::array_len get applied to 3-D textures but only when rendering.
We were already applying isl_view::base_array_layer for rendering into 3-D
textures so this isn't a huge deviation.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Jason Ekstrand
2016-09-12 08:13:43 -07:00
parent 63fe9ab894
commit 48f195d7c6
2 changed files with 13 additions and 4 deletions

View File

@@ -879,6 +879,12 @@ struct isl_view {
* *
* For cube maps, both base_array_layer and array_len should be * For cube maps, both base_array_layer and array_len should be
* specified in terms of 2-D layers and must be a multiple of 6. * specified in terms of 2-D layers and must be a multiple of 6.
*
* 3-D textures are effectively treated as 2-D arrays when used as a
* storage image or render target. If `usage` contains
* ISL_SURF_USAGE_RENDER_TARGET_BIT or ISL_SURF_USAGE_STORAGE_BIT then
* base_array_layer and array_len are applied. If the surface is only used
* for texturing, they are ignored.
*/ */
uint32_t base_array_layer; uint32_t base_array_layer;
uint32_t array_len; uint32_t array_len;

View File

@@ -288,8 +288,6 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
s.RenderTargetViewExtent = s.Depth; s.RenderTargetViewExtent = s.Depth;
break; break;
case SURFTYPE_3D: case SURFTYPE_3D:
s.MinimumArrayElement = info->view->base_array_layer;
/* From the Broadwell PRM >> RENDER_SURFACE_STATE::Depth: /* From the Broadwell PRM >> RENDER_SURFACE_STATE::Depth:
* *
* If the volume texture is MIP-mapped, this field specifies the * If the volume texture is MIP-mapped, this field specifies the
@@ -309,11 +307,16 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
* textures with more levels than we can render to. In order to prevent * textures with more levels than we can render to. In order to prevent
* assert-failures in the packing function below, we only set the field * assert-failures in the packing function below, we only set the field
* when it's actually going to be used by the hardware. * when it's actually going to be used by the hardware.
*
* Similaraly, the MinimumArrayElement field is ignored by all hardware
* prior to Sky Lake when texturing and we want it set to 0 anyway.
* Since it's already initialized to 0, we can just leave it alone for
* texture surfaces.
*/ */
if (info->view->usage & (ISL_SURF_USAGE_RENDER_TARGET_BIT | if (info->view->usage & (ISL_SURF_USAGE_RENDER_TARGET_BIT |
ISL_SURF_USAGE_STORAGE_BIT)) { ISL_SURF_USAGE_STORAGE_BIT)) {
s.RenderTargetViewExtent = isl_minify(info->surf->logical_level0_px.depth, s.MinimumArrayElement = info->view->base_array_layer;
info->view->base_level) - 1; s.RenderTargetViewExtent = info->view->array_len - 1;
} }
break; break;
default: default: