Skip to content

Commit e8a4ce7

Browse files
spencer-lunargcharles-lunarg
authored andcommitted
info: Add vkGetPhysicalDeviceMultisamplePropertiesEXT
1 parent e32b975 commit e8a4ce7

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed

scripts/generators/vulkaninfo_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
'VkSurfaceCapabilitiesKHR', 'VkSurfaceFormatKHR', 'VkLayerProperties', 'VkPhysicalDeviceToolProperties', 'VkFormatProperties',
7878
'VkSurfacePresentScalingCapabilitiesKHR', 'VkSurfacePresentModeCompatibilityKHR', 'VkPhysicalDeviceHostImageCopyProperties',
7979
'VkVideoProfileInfoKHR', 'VkVideoCapabilitiesKHR', 'VkVideoFormatPropertiesKHR', 'VkCooperativeMatrixPropertiesKHR',
80-
'VkPhysicalDeviceFragmentShadingRateKHR']
80+
'VkPhysicalDeviceFragmentShadingRateKHR', 'VkMultisamplePropertiesEXT']
8181
ENUMS_TO_GEN = ['VkResult', 'VkFormat', 'VkPresentModeKHR',
8282
'VkPhysicalDeviceType', 'VkImageTiling', 'VkTimeDomainKHR']
8383
FLAGS_TO_GEN = ['VkSurfaceTransformFlagsKHR', 'VkCompositeAlphaFlagsKHR', 'VkSurfaceCounterFlagsEXT', 'VkQueueFlags',

vulkaninfo/generated/vulkaninfo.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4468,6 +4468,10 @@ void DumpVkLayerProperties(Printer &p, std::string name, const VkLayerProperties
44684468
p.PrintKeyValue("implementationVersion", obj.implementationVersion);
44694469
p.PrintKeyString("description", obj.description);
44704470
}
4471+
void DumpVkMultisamplePropertiesEXT(Printer &p, std::string name, const VkMultisamplePropertiesEXT &obj) {
4472+
ObjectWrapper object{p, name};
4473+
DumpVkExtent2D(p, "maxSampleLocationGridSize", obj.maxSampleLocationGridSize);
4474+
}
44714475
void DumpVkOffset2D(Printer &p, std::string name, const VkOffset2D &obj) {
44724476
ObjectWrapper object{p, name};
44734477
p.SetMinKeyWidth(1);

vulkaninfo/vulkaninfo.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
*
2929
*/
3030

31+
#include <string>
3132
#ifdef _WIN32
3233
#include <crtdbg.h>
3334
#endif
@@ -630,6 +631,21 @@ void GpuDumpFragmentShadingRate(Printer &p, AppGpu &gpu) {
630631
}
631632
}
632633

634+
// VK_EXT_sample_locations ('Multisample Properties' is too ambiguous of a name)
635+
void GpuDumpSampleLocations(Printer &p, AppGpu &gpu) {
636+
auto props = GetSampleLocationInfo(gpu);
637+
if (props.size() > 0) {
638+
p.SetSubHeader();
639+
ObjectWrapper obj(p, "vkGetPhysicalDeviceMultisamplePropertiesEXT");
640+
for (uint32_t i = 0; i < props.size(); i++) {
641+
const VkSampleCountFlagBits sample_count = (VkSampleCountFlagBits)(1 << i);
642+
DumpVkSampleCountFlagBits(p, "samples", sample_count);
643+
DumpVkMultisamplePropertiesEXT(p, "VkMultisamplePropertiesEXT", props[i]);
644+
p.AddNewline();
645+
}
646+
}
647+
}
648+
633649
void GpuDevDump(Printer &p, AppGpu &gpu) {
634650
p.SetHeader();
635651
ObjectWrapper obj_format_props(p, "Format Properties");
@@ -778,6 +794,7 @@ void DumpGpu(Printer &p, AppGpu &gpu, const ShowSettings &show) {
778794
GpuDumpCooperativeMatrix(p, gpu);
779795
GpuDumpCalibrateableTimeDomain(p, gpu);
780796
GpuDumpFragmentShadingRate(p, gpu);
797+
GpuDumpSampleLocations(p, gpu);
781798
}
782799

783800
if (p.Type() != OutputType::text || show.formats) {

vulkaninfo/vulkaninfo.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#include <algorithm>
3232
#include <array>
33+
#include <cstdint>
3334
#include <exception>
3435
#include <iostream>
3536
#include <fstream>
@@ -1901,6 +1902,19 @@ std::vector<VkPhysicalDeviceFragmentShadingRateKHR> GetFragmentShadingRateInfo(A
19011902
return GetVector<VkPhysicalDeviceFragmentShadingRateKHR>("vkGetPhysicalDeviceFragmentShadingRatesKHR",
19021903
vkGetPhysicalDeviceFragmentShadingRatesKHR, gpu.phys_device);
19031904
}
1905+
// Returns vector where each index maps to VkSampleCountFlagBits
1906+
std::vector<VkMultisamplePropertiesEXT> GetSampleLocationInfo(AppGpu &gpu) {
1907+
if (vkGetPhysicalDeviceMultisamplePropertiesEXT == nullptr) return {};
1908+
std::vector<VkMultisamplePropertiesEXT> result;
1909+
// 7 covers VK_SAMPLE_COUNT_1_BIT to 64_BIT
1910+
for (uint32_t i = 0; i < 7; i++) {
1911+
const VkSampleCountFlagBits sample_count = (VkSampleCountFlagBits)(1 << i);
1912+
VkMultisamplePropertiesEXT props = {VK_STRUCTURE_TYPE_MULTISAMPLE_PROPERTIES_EXT, nullptr};
1913+
vkGetPhysicalDeviceMultisamplePropertiesEXT(gpu.phys_device, sample_count, &props);
1914+
result.emplace_back(props);
1915+
}
1916+
return result;
1917+
}
19041918

19051919
// --------- Format Properties ----------//
19061920
// can't use autogen because that is put in a header that we can't include because that header depends on stuff defined here

vulkaninfo/vulkaninfo_functions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ PFN_vkGetPhysicalDeviceFormatProperties2KHR vkGetPhysicalDeviceFormatProperties2
116116
PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR;
117117
PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsKHR vkGetPhysicalDeviceCalibrateableTimeDomainsKHR;
118118
PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR vkGetPhysicalDeviceFragmentShadingRatesKHR;
119+
PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT vkGetPhysicalDeviceMultisamplePropertiesEXT;
119120

120121
// Device functions
121122
PFN_vkCreateImage vkCreateImage;
@@ -249,6 +250,7 @@ static void load_vulkan_instance_functions(VkInstance instance) {
249250
LOAD_INSTANCE_FUNCTION(instance, vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR);
250251
LOAD_INSTANCE_FUNCTION(instance, vkGetPhysicalDeviceCalibrateableTimeDomainsKHR);
251252
LOAD_INSTANCE_FUNCTION(instance, vkGetPhysicalDeviceFragmentShadingRatesKHR);
253+
LOAD_INSTANCE_FUNCTION(instance, vkGetPhysicalDeviceMultisamplePropertiesEXT);
252254

253255
// Load device functions using vkGetInstanceProcAddr, vulkaninfo doesn't care about the extra indirection it causes
254256
LOAD_INSTANCE_FUNCTION(instance, vkCreateImage);

0 commit comments

Comments
 (0)