isl: Add func isl_device_get_sample_counts()
authorChad Versace <chad.versace@intel.com>
Wed, 20 Jan 2016 23:53:54 +0000 (15:53 -0800)
committerChad Versace <chad.versace@intel.com>
Sat, 23 Jan 2016 01:19:57 +0000 (17:19 -0800)
src/isl/isl.c
src/isl/isl.h

index 40663ca18af284169524184308cd806d039bef2d..acc80eae59c624447afd0734f3fa8062e188bcf4 100644 (file)
@@ -67,6 +67,38 @@ isl_device_init(struct isl_device *dev,
       assert(ISL_DEV_USE_SEPARATE_STENCIL(dev));
 }
 
+/**
+ * @brief Query the set of multisamples supported by the device.
+ *
+ * This function always returns non-zero, as ISL_SAMPLE_COUNT_1_BIT is always
+ * supported.
+ */
+isl_sample_count_mask_t ATTRIBUTE_CONST
+isl_device_get_sample_counts(struct isl_device *dev)
+{
+   if (ISL_DEV_GEN(dev) >= 9) {
+      return ISL_SAMPLE_COUNT_1_BIT |
+             ISL_SAMPLE_COUNT_2_BIT |
+             ISL_SAMPLE_COUNT_4_BIT |
+             ISL_SAMPLE_COUNT_8_BIT |
+             ISL_SAMPLE_COUNT_16_BIT;
+   } else if (ISL_DEV_GEN(dev) >= 8) {
+      return ISL_SAMPLE_COUNT_1_BIT |
+             ISL_SAMPLE_COUNT_2_BIT |
+             ISL_SAMPLE_COUNT_4_BIT |
+             ISL_SAMPLE_COUNT_8_BIT;
+   } else if (ISL_DEV_GEN(dev) >= 7) {
+      return ISL_SAMPLE_COUNT_1_BIT |
+             ISL_SAMPLE_COUNT_4_BIT |
+             ISL_SAMPLE_COUNT_8_BIT;
+   } else if (ISL_DEV_GEN(dev) >= 6) {
+      return ISL_SAMPLE_COUNT_1_BIT |
+             ISL_SAMPLE_COUNT_4_BIT;
+   } else {
+      return ISL_SAMPLE_COUNT_1_BIT;
+   }
+}
+
 /**
  * @param[out] info is written only on success
  */
index 9b99e00ec1c1dbd81738af8bbb5cba2149158d1d..85e43b8b35b91865d2a3e754c6600e2f30c46e0b 100644 (file)
@@ -457,6 +457,18 @@ typedef uint64_t isl_surf_usage_flags_t;
 #define ISL_SURF_USAGE_DISPLAY_FLIP_Y_BIT      (1u << 11)
 /** @} */
 
+/**
+ * Identical to VkSampleCountFlagBits.
+ */
+enum isl_sample_count {
+   ISL_SAMPLE_COUNT_1_BIT     = 1u,
+   ISL_SAMPLE_COUNT_2_BIT     = 2u,
+   ISL_SAMPLE_COUNT_4_BIT     = 4u,
+   ISL_SAMPLE_COUNT_8_BIT     = 8u,
+   ISL_SAMPLE_COUNT_16_BIT    = 16u,
+};
+typedef uint32_t isl_sample_count_mask_t;
+
 /**
  * @brief Multisample Format
  */
@@ -690,6 +702,9 @@ isl_device_init(struct isl_device *dev,
                 const struct brw_device_info *info,
                 bool has_bit6_swizzling);
 
+isl_sample_count_mask_t ATTRIBUTE_CONST
+isl_device_get_sample_counts(struct isl_device *dev);
+
 static inline const struct isl_format_layout * ATTRIBUTE_CONST
 isl_format_get_layout(enum isl_format fmt)
 {