Implemented the vkGetPhysicalDeviceMultisamplePropertiesEXT according to the Vulkan Specification section [36.2. Additional Multisampling Capabilities]. --- src/intel/Makefile.sources | 1 + src/intel/vulkan/anv_sample_locations.c | 60 +++++++++++++++++++++++++ src/intel/vulkan/meson.build | 1 + 3 files changed, 62 insertions(+) create mode 100644 src/intel/vulkan/anv_sample_locations.c
diff --git a/src/intel/Makefile.sources b/src/intel/Makefile.sources index a5c8828a6b6..a0873c7ccc2 100644 --- a/src/intel/Makefile.sources +++ b/src/intel/Makefile.sources @@ -251,6 +251,7 @@ VULKAN_FILES := \ vulkan/anv_pipeline_cache.c \ vulkan/anv_private.h \ vulkan/anv_queue.c \ + vulkan/anv_sample_locations.c \ vulkan/anv_util.c \ vulkan/anv_wsi.c \ vulkan/vk_format_info.h diff --git a/src/intel/vulkan/anv_sample_locations.c b/src/intel/vulkan/anv_sample_locations.c new file mode 100644 index 00000000000..1ebf280e05b --- /dev/null +++ b/src/intel/vulkan/anv_sample_locations.c @@ -0,0 +1,60 @@ +/* + * Copyright © 2019 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "anv_private.h" + +void +anv_GetPhysicalDeviceMultisamplePropertiesEXT(VkPhysicalDevice physicalDevice, + VkSampleCountFlagBits samples, + VkMultisamplePropertiesEXT + *pMultisampleProperties) +{ + ANV_FROM_HANDLE(anv_physical_device, physical_device, physicalDevice); + const struct gen_device_info *devinfo = &physical_device->info; + + VkExtent2D grid_size; + switch (samples) { + case VK_SAMPLE_COUNT_2_BIT: + case VK_SAMPLE_COUNT_4_BIT: + case VK_SAMPLE_COUNT_8_BIT: + grid_size.width = SAMPLE_LOC_GRID_W; + grid_size.height = SAMPLE_LOC_GRID_H; + break; + + case VK_SAMPLE_COUNT_16_BIT: + if (devinfo->gen >= 9) { + grid_size.width = SAMPLE_LOC_GRID_W; + grid_size.height = SAMPLE_LOC_GRID_H; + break; + } + default: + grid_size.width = grid_size.height = 0; + break; + }; + + *pMultisampleProperties = (VkMultisamplePropertiesEXT) { + .sType = VK_STRUCTURE_TYPE_MULTISAMPLE_PROPERTIES_EXT, + .pNext = NULL, + .maxSampleLocationGridSize = grid_size + }; +} diff --git a/src/intel/vulkan/meson.build b/src/intel/vulkan/meson.build index 7fa43a6ad79..3f78757c774 100644 --- a/src/intel/vulkan/meson.build +++ b/src/intel/vulkan/meson.build @@ -135,6 +135,7 @@ libanv_files = files( 'anv_pipeline_cache.c', 'anv_private.h', 'anv_queue.c', + 'anv_sample_locations.c', 'anv_util.c', 'anv_wsi.c', 'vk_format_info.h', -- 2.20.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev