isl: Add a helper for determining when a typed load/store can be used
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 16 Apr 2016 00:05:24 +0000 (17:05 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 22 Apr 2016 03:44:27 +0000 (20:44 -0700)
Reviewed-by: Chad Versace <chad.versace@intel.com>
src/intel/isl/isl.h
src/intel/isl/isl_storage_image.c

index 6c417b29f4ca5f911391b4944da92e471d447299..47d3a68ae4a9796862bb24ca636704d11dc4bbcb 100644 (file)
@@ -903,6 +903,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)
 {
index 8d9bea3f9547ca08f212ee68b161a82f6207c7ec..590d2e48b05397e9af41d16411911fb6c97eea79 100644 (file)
@@ -187,6 +187,19 @@ 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)
+{
+   if (devinfo->gen >= 9) {
+      return true;
+   } else if (devinfo->gen >= 8 || devinfo->is_haswell) {
+      return isl_format_get_layout(fmt)->bs <= 8;
+   } else {
+      return isl_format_get_layout(fmt)->bs <= 4;
+   }
+}
+
 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