iris: Add helper function to get isl dim layout
authorSagar Ghuge <sagar.ghuge@intel.com>
Tue, 16 Jul 2019 17:38:00 +0000 (10:38 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 20 Aug 2019 07:50:41 +0000 (00:50 -0700)
v2: Add missing space (Caio)

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/gallium/drivers/iris/iris_resource.c
src/gallium/drivers/iris/iris_resource.h

index d4360523294596ac90395f0ce65672f85e08f5f4..ec59436df798fbfb77624d784e81992770c21c26 100644 (file)
@@ -253,6 +253,35 @@ iris_get_depth_stencil_resources(struct pipe_resource *res,
    }
 }
 
+enum isl_dim_layout
+iris_get_isl_dim_layout(const struct gen_device_info *devinfo,
+                        enum isl_tiling tiling,
+                        enum pipe_texture_target target)
+{
+   switch (target) {
+   case PIPE_TEXTURE_1D:
+   case PIPE_TEXTURE_1D_ARRAY:
+      return (devinfo->gen >= 9 && tiling == ISL_TILING_LINEAR ?
+              ISL_DIM_LAYOUT_GEN9_1D : ISL_DIM_LAYOUT_GEN4_2D);
+
+   case PIPE_TEXTURE_2D:
+   case PIPE_TEXTURE_2D_ARRAY:
+   case PIPE_TEXTURE_RECT:
+   case PIPE_TEXTURE_CUBE:
+   case PIPE_TEXTURE_CUBE_ARRAY:
+      return ISL_DIM_LAYOUT_GEN4_2D;
+
+   case PIPE_TEXTURE_3D:
+      return (devinfo->gen >= 9 ?
+              ISL_DIM_LAYOUT_GEN4_2D : ISL_DIM_LAYOUT_GEN4_3D);
+
+   case PIPE_MAX_TEXTURE_TYPES:
+   case PIPE_BUFFER:
+      break;
+   }
+   unreachable("invalid texture type");
+}
+
 void
 iris_resource_disable_aux(struct iris_resource *res)
 {
index a233d57e32b0b5d3dc3dcffbe770ba3f83d11d55..707c559025cdade8599169f70681a1f46de79912 100644 (file)
@@ -392,6 +392,9 @@ iris_resource_access_raw(struct iris_context *ice,
    }
 }
 
+enum isl_dim_layout iris_get_isl_dim_layout(const struct gen_device_info *devinfo,
+                                            enum isl_tiling tiling,
+                                            enum pipe_texture_target target);
 enum isl_aux_usage iris_resource_texture_aux_usage(struct iris_context *ice,
                                                    const struct iris_resource *res,
                                                    enum isl_format view_fmt,