[Mesa-dev] [PATCH 0/3] i965: Correctly set RENDER_SURFACE_STATE::Depth for

Jason Ekstrand jason at jlekstrand.net
Tue Jul 19 05:16:50 UTC 2016

>From the Sky Lake PRM:

   "For SURFTYPE_CUBE: For Sampling Engine Surfaces and Typed Data Port
   Surfaces, the range of this field is [0,340], indicating the number of
   cube array elements (equal to the number of underlying 2D array elements
   divided by 6). For other surfaces, this field must be zero."

In other words, the depth field for cube maps is in number of cubes not
number of 2-D slices so we need to divide by 6.  It appears as if we've
been doing this wrong ever since we first added cube map arrays for Sandy
Bridge.  We've also had a shader hack to divide the size Z dimension of
cube maps by 6 in the textureSize call.  This is completely bogus and the
only reason for it is that we've been setting the depth six times too

This little series fixes this.  In order to keep things back-portable,
patch 3 comes in two versions.  Version (a) is based on pre-ISL and should
be backportable to 12.0 or maybe even 11.2 or 11.1.  Version (b) on the
other hand is based on top of the ISL work and can be applied on master.

Cc: Emil Velikov <emil.velikov at collabora.com>

Jason Ekstrand (3):
  i965: Use intel_get_image_dims in alloc_texture_storage
  i965/miptree: Set logical_depth0 == 6 for cube maps
  i965: Correctly set RENDER_SURFACE_STATE::Depth for cube map textures

 src/mesa/drivers/dri/i965/brw_fs_nir.cpp          | 21 +++++----------------
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c  |  6 +++++-
 src/mesa/drivers/dri/i965/gen7_wm_surface_state.c |  3 ++-
 src/mesa/drivers/dri/i965/gen8_surface_state.c    |  3 ++-
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c     | 14 ++++++++++----
 src/mesa/drivers/dri/i965/intel_tex.c             |  2 ++
 6 files changed, 26 insertions(+), 23 deletions(-)


More information about the mesa-dev mailing list