summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEleni Maria Stea <estea@igalia.com>2019-03-14 21:52:00 +0200
committerMarge Bot <eric+marge@anholt.net>2021-01-27 23:25:27 +0000
commit983cebb5d2f1230fba8d450be95a393de483e5ee (patch)
tree911ca39972f5b7a23b99e4c7ea2009bbfb0a049f
parentecd8477e932d522c7866c3f73e9f1b4720d96a50 (diff)
anv: Implement physical device properties for VK_EXT_sample_locations
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 | true |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 true because we can set sample locations per draw. Implement the vkGetPhysicalDeviceMultisamplePropertiesEXT according to the Vulkan Specification section [36.2. Additional Multisampling Capabilities]. v2: 1- Replaced false with VK_FALSE for consistency. (Sagar Ghuge) 2- Used the isl_device_sample_count to take the number of samples per platform to avoid extra checks. (Sagar Ghuge) v3: 1- Replaced VK_FALSE with false as Jason has sent a patch to replace VK_FALSE with false in other places. (Jason Ekstrand) 2- Removed unecessary defines and set the grid size to 1 (Jason Ekstrand) v4: Fix properties reporting in GetPhysicalDeviceProperties2, not GetPhysicalDeviceFeatures2 (Lionel) Use same alignment as other functions (Lionel) Report variableSampleLocations=true (Lionel) v5: Don't overwrite the pNext in GetPhysicalDeviceMultisamplerPropertiesEXT Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com> (v3) Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1887>
-rw-r--r--src/intel/vulkan/anv_device.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index e1d77ea8247..813af4fc92b 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -2092,6 +2092,25 @@ void anv_GetPhysicalDeviceProperties2(
break;
}
+ case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT: {
+ VkPhysicalDeviceSampleLocationsPropertiesEXT *props =
+ (VkPhysicalDeviceSampleLocationsPropertiesEXT *)ext;
+
+ props->sampleLocationSampleCounts =
+ isl_device_get_sample_counts(&pdevice->isl_dev);
+
+ /* See also anv_GetPhysicalDeviceMultisamplePropertiesEXT */
+ props->maxSampleLocationGridSize.width = 1;
+ props->maxSampleLocationGridSize.height = 1;
+
+ props->sampleLocationCoordinateRange[0] = 0;
+ props->sampleLocationCoordinateRange[1] = 0.9375;
+ props->sampleLocationSubPixelBits = 4;
+
+ props->variableSampleLocations = true;
+ break;
+ }
+
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES_EXT: {
VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT *props =
(VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT *)ext;
@@ -4615,6 +4634,30 @@ VkResult anv_GetCalibratedTimestampsEXT(
return VK_SUCCESS;
}
+void anv_GetPhysicalDeviceMultisamplePropertiesEXT(
+ VkPhysicalDevice physicalDevice,
+ VkSampleCountFlagBits samples,
+ VkMultisamplePropertiesEXT* pMultisampleProperties)
+{
+ ANV_FROM_HANDLE(anv_physical_device, physical_device, physicalDevice);
+
+ assert(pMultisampleProperties->sType ==
+ VK_STRUCTURE_TYPE_MULTISAMPLE_PROPERTIES_EXT);
+
+ VkExtent2D grid_size;
+ if (samples & isl_device_get_sample_counts(&physical_device->isl_dev)) {
+ grid_size.width = 1;
+ grid_size.height = 1;
+ } else {
+ grid_size.width = 0;
+ grid_size.height = 0;
+ }
+ pMultisampleProperties->maxSampleLocationGridSize = grid_size;
+
+ vk_foreach_struct(ext, pMultisampleProperties->pNext)
+ anv_debug_ignored_stype(ext->sType);
+}
+
/* vk_icd.h does not declare this function, so we declare it here to
* suppress Wmissing-prototypes.
*/