[Mesa-dev] [PATCH 2/9] anv: Set the values for the VkPhysicalDeviceSampleLocationsPropertiesEXT

Eleni Maria Stea estea at igalia.com
Mon Mar 11 15:04:52 UTC 2019


The VkPhysicalDeviceSampleLocationPropertiesEXT struct is filled with
implementation dependent values and according to the table from the
Vulkan Specification section [36.1. Limit Requirements]:

pname | max | min
pname:sampleLocationSampleCounts   |-            |ename:VK_SAMPLE_COUNT_4_BIT
pname:maxSampleLocationGridSize    |-            |(1, 1)
pname:sampleLocationCoordinateRange|(0.0, 0.9375)|(0.0, 0.9375)
pname:sampleLocationSubPixelBits   |-            |4
pname:variableSampleLocations      | false       |implementation dependent

The hardware only supports setting the same sample location for all the
pixels, so we only support 1x1 grids.

Also, variableSampleLocations is set to false because we don't support the
feature.
---
 src/intel/vulkan/anv_device.c  | 21 +++++++++++++++++++++
 src/intel/vulkan/anv_private.h |  3 +++
 2 files changed, 24 insertions(+)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 729cceb3e32..1e183b7f4ad 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1401,6 +1401,27 @@ void anv_GetPhysicalDeviceProperties2(
          break;
       }
 
+      case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT: {
+         VkPhysicalDeviceSampleLocationsPropertiesEXT *props =
+            (VkPhysicalDeviceSampleLocationsPropertiesEXT *)ext;
+         props->sampleLocationSampleCounts = ISL_SAMPLE_COUNT_2_BIT |
+                                             ISL_SAMPLE_COUNT_4_BIT |
+                                             ISL_SAMPLE_COUNT_8_BIT;
+         if (pdevice->info.gen >= 9)
+            props->sampleLocationSampleCounts |= ISL_SAMPLE_COUNT_16_BIT;
+
+         props->maxSampleLocationGridSize.width = SAMPLE_LOC_GRID_W;
+         props->maxSampleLocationGridSize.height = SAMPLE_LOC_GRID_H;
+
+         props->sampleLocationCoordinateRange[0] = 0;
+         props->sampleLocationCoordinateRange[1] = 0.9375;
+         props->sampleLocationSubPixelBits = 4;
+
+         props->variableSampleLocations = false;
+
+         break;
+      }
+
       default:
          anv_debug_ignored_stype(ext->sType);
          break;
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index eed282ff985..5905299e59d 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -195,6 +195,9 @@ struct gen_l3_config;
 
 #define anv_printflike(a, b) __attribute__((__format__(__printf__, a, b)))
 
+#define SAMPLE_LOC_GRID_W 1
+#define SAMPLE_LOC_GRID_H 1
+
 static inline uint32_t
 align_down_npot_u32(uint32_t v, uint32_t a)
 {
-- 
2.20.1



More information about the mesa-dev mailing list