Mesa (master): isl: render target cube maps should be handled as 2D images , not cubes

Iago Toral Quiroga itoral at kemper.freedesktop.org
Mon Jan 9 10:49:17 UTC 2017


Module: Mesa
Branch: master
Commit: 030e5f07a553716dcab9793681c56e975c42af94
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=030e5f07a553716dcab9793681c56e975c42af94

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Fri Jan  6 12:29:45 2017 +0100

isl: render target cube maps should be handled as 2D images, not cubes

This fixes layered rendering Vulkan CTS tests with cube (arrays). We
also do this in the GL driver, see this code from gen8_depth_state.c
for example:

case GL_TEXTURE_CUBE_MAP_ARRAY:
case GL_TEXTURE_CUBE_MAP:
   /* The PRM claims that we should use BRW_SURFACE_CUBE for this
    * situation, but experiments show that gl_Layer doesn't work when we do
    * this.  So we use BRW_SURFACE_2D, since for rendering purposes this is
    * equivalent.
    */
   surftype = BRW_SURFACE_2D;
   depth *= 6;
   break;

So I guess we simply forgot to port this workaround to Vulkan.

v2: tweak the conditions so the special case is cube texture sampling
    rather than anything else (Jason)

Fixes:
dEQP-VK.geometry.layered.cube*

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/intel/isl/isl_surface_state.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c
index 3bb0abd..b9093cc 100644
--- a/src/intel/isl/isl_surface_state.c
+++ b/src/intel/isl/isl_surface_state.c
@@ -113,12 +113,14 @@ get_surftype(enum isl_surf_dim dim, isl_surf_usage_flags_t usage)
       assert(!(usage & ISL_SURF_USAGE_CUBE_BIT));
       return SURFTYPE_1D;
    case ISL_SURF_DIM_2D:
-      if (usage & ISL_SURF_USAGE_STORAGE_BIT) {
-         /* Storage images are always plain 2-D, not cube */
-         return SURFTYPE_2D;
-      } else if (usage & ISL_SURF_USAGE_CUBE_BIT) {
+      if ((usage & ISL_SURF_USAGE_CUBE_BIT) &&
+          (usage & ISL_SURF_USAGE_TEXTURE_BIT)) {
+         /* We need SURFTYPE_CUBE to make cube sampling work */
          return SURFTYPE_CUBE;
       } else {
+         /* Everything else (render and storage) treat cubes as plain
+          * 2D array textures
+          */
          return SURFTYPE_2D;
       }
    case ISL_SURF_DIM_3D:




More information about the mesa-commit mailing list