[Mesa-dev] [PATCH 05/13] isl: Add a helper for determining when a typed load/store can be used

Jason Ekstrand jason at jlekstrand.net
Sat Apr 16 19:45:13 UTC 2016


---
 src/intel/isl/isl.h               |  7 +++++++
 src/intel/isl/isl_storage_image.c | 10 ++++++++++
 2 files changed, 17 insertions(+)

diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index 2982bad..c6fe318 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -912,6 +912,13 @@ enum isl_format
 isl_lower_storage_image_format(const struct brw_device_info *devinfo,
                                enum isl_format fmt);
 
+/* Returns true if this hardware supports typed load/store on a format with
+ * the same size as the given format.
+ */
+bool
+isl_has_matching_typed_storage_image_format(const struct brw_device_info *devinfo,
+                                            enum isl_format fmt);
+
 static inline bool
 isl_tiling_is_any_y(enum isl_tiling tiling)
 {
diff --git a/src/intel/isl/isl_storage_image.c b/src/intel/isl/isl_storage_image.c
index 8d9bea3..f6d48c9 100644
--- a/src/intel/isl/isl_storage_image.c
+++ b/src/intel/isl/isl_storage_image.c
@@ -187,6 +187,16 @@ isl_lower_storage_image_format(const struct brw_device_info *devinfo,
    }
 }
 
+bool
+isl_has_matching_typed_storage_image_format(const struct brw_device_info *devinfo,
+                                            enum isl_format fmt)
+{
+   return (isl_format_get_layout(fmt)->bs <= 4 ||
+           (isl_format_get_layout(fmt)->bs <= 8 &&
+            (devinfo->gen >= 8 || devinfo->is_haswell)) ||
+           devinfo->gen >= 9);
+}
+
 static const struct brw_image_param image_param_defaults = {
    /* Set the swizzling shifts to all-ones to effectively disable
     * swizzling -- See emit_address_calculation() in
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list