aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Giessen <charles@lunarg.com>2021-11-14 13:32:30 -0700
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2022-02-02 16:22:12 -0700
commit484aac746d11631bd8bc449bad08923a2ff6410e (patch)
treea7e8de183567f713632a9b1a7a2d80af46c4d646
parent81dbf823d8c17a53c048c255bc031ed31675dd65 (diff)
downloadusermoji-484aac746d11631bd8bc449bad08923a2ff6410e.tar.xz
vulkaninfo: Support QueueProperties pNext chain
Make the autogen and vulkaninfo source code support printing of the pNext chain in VkQueueProperties2KHR. Several structs were added to this chain recently and are helpful information to be printed. This required special casing the output so that it only prints the elements that are 'valid' and modifying the chain printer to unset the next header flag.
-rw-r--r--scripts/vulkaninfo_generator.py13
-rw-r--r--vulkaninfo/generated/vulkaninfo.hpp158
-rw-r--r--vulkaninfo/outputprinter.h10
-rw-r--r--vulkaninfo/vulkaninfo.cpp5
-rw-r--r--vulkaninfo/vulkaninfo.h66
5 files changed, 220 insertions, 32 deletions
diff --git a/scripts/vulkaninfo_generator.py b/scripts/vulkaninfo_generator.py
index b0b40006..bb28c06e 100644
--- a/scripts/vulkaninfo_generator.py
+++ b/scripts/vulkaninfo_generator.py
@@ -108,9 +108,10 @@ predefined_types = ['char', 'VkBool32', 'uint32_t', 'uint8_t', 'int32_t',
EXTENSION_CATEGORIES = OrderedDict((
('phys_device_props2', {'extends': 'VkPhysicalDeviceProperties2', 'type': 'both', 'holder_type': 'VkPhysicalDeviceProperties2'}),
('phys_device_mem_props2', {'extends': 'VkPhysicalDeviceMemoryProperties2', 'type': 'device', 'holder_type':'VkPhysicalDeviceMemoryProperties2'}),
- ('phys_device_features2', {'extends': 'VkPhysicalDeviceFeatures2,VkDeviceCreateInfo', 'type': 'device', 'holder_type':'VkPhysicalDeviceFeatures2'}),
- ('surface_capabilities2', {'extends': 'VkSurfaceCapabilities2KHR', 'type': 'both', 'holder_type':'VkSurfaceCapabilities2KHR'}),
- ('format_properties2', {'extends': 'VkFormatProperties2', 'type': 'device', 'holder_type':'VkFormatProperties2'})
+ ('phys_device_features2', {'extends': 'VkPhysicalDeviceFeatures2,VkDeviceCreateInfo', 'type': 'device', 'holder_type': 'VkPhysicalDeviceFeatures2'}),
+ ('surface_capabilities2', {'extends': 'VkSurfaceCapabilities2KHR', 'type': 'both', 'holder_type': 'VkSurfaceCapabilities2KHR'}),
+ ('format_properties2', {'extends': 'VkFormatProperties2', 'type': 'device', 'holder_type':'VkFormatProperties2'}),
+ ('queue_properties2', {'extends': 'VkQueueFamilyProperties2', 'type': 'device', 'holder_type': 'VkQueueFamilyProperties2'})
))
class VulkanInfoGeneratorOptions(GeneratorOptions):
def __init__(self,
@@ -531,6 +532,11 @@ def PrintStructure(struct, types_to_gen, structure_names, aliases):
elif (v.arrayLength == str(8) and v.typeID == "uint8_t"): # VK_LUID_SIZE
out += f" if (obj.deviceLUIDValid)" # special case
out += f" p.PrintKeyString(\"{v.name}\", to_string_8(obj.{v.name}), {str(max_key_len)});\n"
+ elif struct.name == "VkQueueFamilyGlobalPriorityPropertiesEXT" and v.name == "priorities":
+ out += f" ArrayWrapper arr(p,\"{v.name}\", obj.priorityCount);\n"
+ out += f" for (uint32_t i = 0; i < obj.priorityCount; i++) {{\n"
+ out += f" Dump{v.typeID}(p, \"{v.name}\", obj.{v.name}[i]);\n"
+ out += f" }}\n"
elif v.arrayLength.isdigit():
out += f" {{ ArrayWrapper arr(p,\"{v.name}\", "+v.arrayLength+");\n"
for i in range(0, int(v.arrayLength)):
@@ -717,6 +723,7 @@ def PrintChainIterator(listName, structures, all_structures, checkExtLoc, extTyp
out += AddGuardFooter(s)
out += f" place = structure->pNext;\n"
out += f" }}\n"
+ out += f" p.UnsetSubHeader();\n"
out += f"}}\n"
return out
diff --git a/vulkaninfo/generated/vulkaninfo.hpp b/vulkaninfo/generated/vulkaninfo.hpp
index d48eedd1..6685dc82 100644
--- a/vulkaninfo/generated/vulkaninfo.hpp
+++ b/vulkaninfo/generated/vulkaninfo.hpp
@@ -434,6 +434,22 @@ void DumpVkPresentModeKHR(Printer &p, std::string name, VkPresentModeKHR value,
p.PrintKeyString(name, VkPresentModeKHRString(value), width);
}
}
+static const char *VkQueueGlobalPriorityKHRString(VkQueueGlobalPriorityKHR value) {
+ switch (value) {
+ case (128): return "QUEUE_GLOBAL_PRIORITY_LOW_KHR";
+ case (256): return "QUEUE_GLOBAL_PRIORITY_MEDIUM_KHR";
+ case (512): return "QUEUE_GLOBAL_PRIORITY_HIGH_KHR";
+ case (1024): return "QUEUE_GLOBAL_PRIORITY_REALTIME_KHR";
+ default: return "UNKNOWN_VkQueueGlobalPriorityKHR";
+ }
+}
+void DumpVkQueueGlobalPriorityKHR(Printer &p, std::string name, VkQueueGlobalPriorityKHR value, int width = 0) {
+ if (p.Type() == OutputType::json) {
+ p.PrintKeyValue(name, value, width);
+ } else {
+ p.PrintKeyString(name, VkQueueGlobalPriorityKHRString(value), width);
+ }
+}
static const char *VkResultString(VkResult value) {
switch (value) {
case (0): return "SUCCESS";
@@ -1025,6 +1041,37 @@ void DumpVkToolPurposeFlagBits(Printer &p, std::string name, VkToolPurposeFlagBi
p.PrintKeyString(name, strings.at(0), width);
}
+std::vector<const char *>VkVideoCodecOperationFlagBitsKHRGetStrings(VkVideoCodecOperationFlagBitsKHR value) {
+ std::vector<const char *> strings;
+ if (value == 0) { strings.push_back("None"); return strings; }
+ if (0 & value) strings.push_back("VIDEO_CODEC_OPERATION_INVALID_BIT_KHR");
+ if (0x10000 & value) strings.push_back("VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT");
+ if (0x20000 & value) strings.push_back("VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_EXT");
+ if (0x1 & value) strings.push_back("VIDEO_CODEC_OPERATION_DECODE_H264_BIT_EXT");
+ if (0x2 & value) strings.push_back("VIDEO_CODEC_OPERATION_DECODE_H265_BIT_EXT");
+ return strings;
+}
+#ifdef VK_ENABLE_BETA_EXTENSIONS
+void DumpVkVideoCodecOperationFlagsKHR(Printer &p, std::string name, VkVideoCodecOperationFlagsKHR value, int width = 0) {
+ if (p.Type() == OutputType::json) { p.PrintKeyValue(name, value); return; }
+ if (static_cast<VkVideoCodecOperationFlagBitsKHR>(value) == 0) {
+ ArrayWrapper arr(p, name, 0);
+ if (p.Type() != OutputType::vkconfig_output)
+ p.SetAsType().PrintString("None");
+ return;
+ }
+ auto strings = VkVideoCodecOperationFlagBitsKHRGetStrings(static_cast<VkVideoCodecOperationFlagBitsKHR>(value));
+ ArrayWrapper arr(p, name, strings.size());
+ for(auto& str : strings){
+ p.SetAsType().PrintString(str);
+ }
+}
+void DumpVkVideoCodecOperationFlagBitsKHR(Printer &p, std::string name, VkVideoCodecOperationFlagBitsKHR value, int width = 0) {
+ auto strings = VkVideoCodecOperationFlagBitsKHRGetStrings(value);
+ p.PrintKeyString(name, strings.at(0), width);
+}
+#endif // VK_ENABLE_BETA_EXTENSIONS
+
void DumpVkDrmFormatModifierProperties2EXT(Printer &p, std::string name, VkDrmFormatModifierProperties2EXT &obj) {
ObjectWrapper object{p, name};
p.PrintKeyValue("drmFormatModifier", obj.drmFormatModifier, 27);
@@ -2294,6 +2341,34 @@ void DumpVkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures(Printer &p, std::
ObjectWrapper object{p, name};
p.PrintKeyBool("shaderZeroInitializeWorkgroupMemory", static_cast<bool>(obj.shaderZeroInitializeWorkgroupMemory), 35);
}
+void DumpVkQueueFamilyGlobalPriorityPropertiesKHR(Printer &p, std::string name, VkQueueFamilyGlobalPriorityPropertiesKHR &obj) {
+ ObjectWrapper object{p, name};
+ p.PrintKeyValue("priorityCount", obj.priorityCount, 14);
+ { ArrayWrapper arr(p,"priorities", 16);
+ p.PrintElement(obj.priorities[0]);
+ p.PrintElement(obj.priorities[1]);
+ p.PrintElement(obj.priorities[2]);
+ p.PrintElement(obj.priorities[3]);
+ p.PrintElement(obj.priorities[4]);
+ p.PrintElement(obj.priorities[5]);
+ p.PrintElement(obj.priorities[6]);
+ p.PrintElement(obj.priorities[7]);
+ p.PrintElement(obj.priorities[8]);
+ p.PrintElement(obj.priorities[9]);
+ p.PrintElement(obj.priorities[10]);
+ p.PrintElement(obj.priorities[11]);
+ p.PrintElement(obj.priorities[12]);
+ p.PrintElement(obj.priorities[13]);
+ p.PrintElement(obj.priorities[14]);
+ p.PrintElement(obj.priorities[15]);
+ }
+}
+#ifdef VK_ENABLE_BETA_EXTENSIONS
+void DumpVkQueueFamilyQueryResultStatusProperties2KHR(Printer &p, std::string name, VkQueueFamilyQueryResultStatusProperties2KHR &obj) {
+ ObjectWrapper object{p, name};
+ p.PrintKeyBool("supported", static_cast<bool>(obj.supported), 9);
+}
+#endif // VK_ENABLE_BETA_EXTENSIONS
void DumpVkSharedPresentSurfaceCapabilitiesKHR(Printer &p, std::string name, VkSharedPresentSurfaceCapabilitiesKHR &obj) {
ObjectWrapper object{p, name};
DumpVkImageUsageFlags(p, "sharedPresentSupportedUsageFlags", obj.sharedPresentSupportedUsageFlags, 0);
@@ -2326,6 +2401,12 @@ void DumpVkSurfaceProtectedCapabilitiesKHR(Printer &p, std::string name, VkSurfa
ObjectWrapper object{p, name};
p.PrintKeyBool("supportsProtected", static_cast<bool>(obj.supportsProtected), 17);
}
+#ifdef VK_ENABLE_BETA_EXTENSIONS
+void DumpVkVideoQueueFamilyProperties2KHR(Printer &p, std::string name, VkVideoQueueFamilyProperties2KHR &obj) {
+ ObjectWrapper object{p, name};
+ DumpVkVideoCodecOperationFlagsKHR(p, "videoCodecOperations", obj.videoCodecOperations, 0);
+}
+#endif // VK_ENABLE_BETA_EXTENSIONS
struct phys_device_props2_chain {
phys_device_props2_chain() = default;
phys_device_props2_chain(const phys_device_props2_chain &) = delete;
@@ -2846,6 +2927,48 @@ void setup_format_properties2_chain(VkFormatProperties2& start, std::unique_ptr<
chain->initialize_chain();
start.pNext = chain->start_of_chain;
};
+struct queue_properties2_chain {
+ queue_properties2_chain() = default;
+ queue_properties2_chain(const queue_properties2_chain &) = delete;
+ queue_properties2_chain& operator=(const queue_properties2_chain &) = delete;
+ queue_properties2_chain(queue_properties2_chain &&) = delete;
+ queue_properties2_chain& operator=(queue_properties2_chain &&) = delete;
+ void* start_of_chain = nullptr;
+ VkQueueFamilyGlobalPriorityPropertiesKHR QueueFamilyGlobalPriorityPropertiesKHR{};
+#ifdef VK_ENABLE_BETA_EXTENSIONS
+ VkQueueFamilyQueryResultStatusProperties2KHR QueueFamilyQueryResultStatusProperties2KHR{};
+#endif // VK_ENABLE_BETA_EXTENSIONS
+#ifdef VK_ENABLE_BETA_EXTENSIONS
+ VkVideoQueueFamilyProperties2KHR VideoQueueFamilyProperties2KHR{};
+#endif // VK_ENABLE_BETA_EXTENSIONS
+ void initialize_chain() noexcept {
+ QueueFamilyGlobalPriorityPropertiesKHR.sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_KHR;
+#ifdef VK_ENABLE_BETA_EXTENSIONS
+ QueueFamilyQueryResultStatusProperties2KHR.sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_QUERY_RESULT_STATUS_PROPERTIES_2_KHR;
+#endif // VK_ENABLE_BETA_EXTENSIONS
+#ifdef VK_ENABLE_BETA_EXTENSIONS
+ VideoQueueFamilyProperties2KHR.sType = VK_STRUCTURE_TYPE_VIDEO_QUEUE_FAMILY_PROPERTIES_2_KHR;
+#endif // VK_ENABLE_BETA_EXTENSIONS
+ std::vector<VkBaseOutStructure*> chain_members;
+ chain_members.push_back(reinterpret_cast<VkBaseOutStructure*>(&QueueFamilyGlobalPriorityPropertiesKHR));
+#ifdef VK_ENABLE_BETA_EXTENSIONS
+ chain_members.push_back(reinterpret_cast<VkBaseOutStructure*>(&QueueFamilyQueryResultStatusProperties2KHR));
+#endif // VK_ENABLE_BETA_EXTENSIONS
+#ifdef VK_ENABLE_BETA_EXTENSIONS
+ chain_members.push_back(reinterpret_cast<VkBaseOutStructure*>(&VideoQueueFamilyProperties2KHR));
+#endif // VK_ENABLE_BETA_EXTENSIONS
+
+ for(size_t i = 0; i < chain_members.size() - 1; i++){
+ chain_members[i]->pNext = chain_members[i + 1];
+ }
+ if (chain_members.size() > 0) start_of_chain = chain_members[0];
+ };
+};
+void setup_queue_properties2_chain(VkQueueFamilyProperties2& start, std::unique_ptr<queue_properties2_chain>& chain){
+ chain = std::unique_ptr<queue_properties2_chain>(new queue_properties2_chain());
+ chain->initialize_chain();
+ start.pNext = chain->start_of_chain;
+};
void chain_iterator_phys_device_props2(Printer &p, AppInstance &inst, AppGpu &gpu, void * place, VulkanVersion version) {
while (place) {
struct VkBaseOutStructure *structure = (struct VkBaseOutStructure *)place;
@@ -3121,6 +3244,7 @@ void chain_iterator_phys_device_props2(Printer &p, AppInstance &inst, AppGpu &gp
}
place = structure->pNext;
}
+ p.UnsetSubHeader();
}
void chain_iterator_phys_device_mem_props2(Printer &p, AppGpu &gpu, void * place, VulkanVersion version) {
while (place) {
@@ -3134,6 +3258,7 @@ void chain_iterator_phys_device_mem_props2(Printer &p, AppGpu &gpu, void * place
}
place = structure->pNext;
}
+ p.UnsetSubHeader();
}
void chain_iterator_phys_device_features2(Printer &p, AppGpu &gpu, void * place, VulkanVersion version) {
while (place) {
@@ -3671,6 +3796,7 @@ void chain_iterator_phys_device_features2(Printer &p, AppGpu &gpu, void * place,
}
place = structure->pNext;
}
+ p.UnsetSubHeader();
}
void chain_iterator_surface_capabilities2(Printer &p, AppInstance &inst, AppGpu &gpu, void * place, VulkanVersion version) {
while (place) {
@@ -3698,6 +3824,7 @@ void chain_iterator_surface_capabilities2(Printer &p, AppInstance &inst, AppGpu
}
place = structure->pNext;
}
+ p.UnsetSubHeader();
}
void chain_iterator_format_properties2(Printer &p, AppGpu &gpu, void * place, VulkanVersion version) {
while (place) {
@@ -3724,6 +3851,37 @@ void chain_iterator_format_properties2(Printer &p, AppGpu &gpu, void * place, Vu
}
place = structure->pNext;
}
+ p.UnsetSubHeader();
+}
+void chain_iterator_queue_properties2(Printer &p, AppGpu &gpu, void * place, VulkanVersion version) {
+ while (place) {
+ struct VkBaseOutStructure *structure = (struct VkBaseOutStructure *)place;
+ p.SetSubHeader();
+ if (structure->sType == VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_KHR &&
+ (gpu.CheckPhysicalDeviceExtensionIncluded(VK_KHR_GLOBAL_PRIORITY_EXTENSION_NAME))) {
+ VkQueueFamilyGlobalPriorityPropertiesKHR* props = (VkQueueFamilyGlobalPriorityPropertiesKHR*)structure;
+ DumpVkQueueFamilyGlobalPriorityPropertiesKHR(p, "VkQueueFamilyGlobalPriorityPropertiesKHR", *props);
+ p.AddNewline();
+ }
+#ifdef VK_ENABLE_BETA_EXTENSIONS
+ if (structure->sType == VK_STRUCTURE_TYPE_QUEUE_FAMILY_QUERY_RESULT_STATUS_PROPERTIES_2_KHR &&
+ (gpu.CheckPhysicalDeviceExtensionIncluded(VK_KHR_VIDEO_QUEUE_EXTENSION_NAME))) {
+ VkQueueFamilyQueryResultStatusProperties2KHR* props = (VkQueueFamilyQueryResultStatusProperties2KHR*)structure;
+ DumpVkQueueFamilyQueryResultStatusProperties2KHR(p, "VkQueueFamilyQueryResultStatusProperties2KHR", *props);
+ p.AddNewline();
+ }
+#endif // VK_ENABLE_BETA_EXTENSIONS
+#ifdef VK_ENABLE_BETA_EXTENSIONS
+ if (structure->sType == VK_STRUCTURE_TYPE_VIDEO_QUEUE_FAMILY_PROPERTIES_2_KHR &&
+ (gpu.CheckPhysicalDeviceExtensionIncluded(VK_KHR_VIDEO_QUEUE_EXTENSION_NAME))) {
+ VkVideoQueueFamilyProperties2KHR* props = (VkVideoQueueFamilyProperties2KHR*)structure;
+ DumpVkVideoQueueFamilyProperties2KHR(p, "VkVideoQueueFamilyProperties2KHR", *props);
+ p.AddNewline();
+ }
+#endif // VK_ENABLE_BETA_EXTENSIONS
+ place = structure->pNext;
+ }
+ p.UnsetSubHeader();
}
bool operator==(const VkExtent2D & a, const VkExtent2D b);
bool operator==(const VkSurfaceCapabilities2EXT & a, const VkSurfaceCapabilities2EXT b);
diff --git a/vulkaninfo/outputprinter.h b/vulkaninfo/outputprinter.h
index a6ab6e32..2d4e97ac 100644
--- a/vulkaninfo/outputprinter.h
+++ b/vulkaninfo/outputprinter.h
@@ -253,11 +253,21 @@ class Printer {
return *this;
}
+ Printer &UnsetHeader() {
+ set_next_header = false;
+ return *this;
+ }
+
Printer &SetSubHeader() {
set_next_subheader = true;
return *this;
}
+ Printer &UnsetSubHeader() {
+ set_next_subheader = false;
+ return *this;
+ }
+
Printer &SetOpenDetails() {
set_details_open = true;
return *this;
diff --git a/vulkaninfo/vulkaninfo.cpp b/vulkaninfo/vulkaninfo.cpp
index 1c26bbd3..5c3e910f 100644
--- a/vulkaninfo/vulkaninfo.cpp
+++ b/vulkaninfo/vulkaninfo.cpp
@@ -330,7 +330,7 @@ void GpuDumpPropsJson(Printer &p, AppGpu &gpu) {
DumpVkPhysicalDeviceSparseProperties(p, "VkPhysicalDeviceSparseProperties", gpu.props.sparseProperties);
}
-void GpuDumpQueueProps(Printer &p, std::vector<SurfaceExtension> &surfaces, const AppQueueFamilyProperties &queue) {
+void GpuDumpQueueProps(Printer &p, AppGpu &gpu, std::vector<SurfaceExtension> &surfaces, const AppQueueFamilyProperties &queue) {
VkQueueFamilyProperties props = queue.props;
p.SetSubHeader().SetElementIndex(static_cast<int>(queue.queue_index));
ObjectWrapper obj_queue_props(p, "queueProperties");
@@ -355,6 +355,7 @@ void GpuDumpQueueProps(Printer &p, std::vector<SurfaceExtension> &surfaces, cons
p.PrintKeyString(surface.name, surface.supports_present ? "true" : "false", width);
}
}
+ chain_iterator_queue_properties2(p, gpu, queue.pNext, gpu.api_version);
p.AddNewline();
}
@@ -642,7 +643,7 @@ void DumpGpu(Printer &p, AppGpu &gpu, bool show_tooling_info, bool show_formats)
p.SetHeader();
ObjectWrapper obj_family_props(p, "VkQueueFamilyProperties");
for (const auto &queue_prop : gpu.extended_queue_props) {
- GpuDumpQueueProps(p, gpu.inst.surface_extensions, queue_prop);
+ GpuDumpQueueProps(p, gpu, gpu.inst.surface_extensions, queue_prop);
}
}
GpuDumpMemoryProps(p, gpu);
diff --git a/vulkaninfo/vulkaninfo.h b/vulkaninfo/vulkaninfo.h
index 1561f83c..f48c3b7a 100644
--- a/vulkaninfo/vulkaninfo.h
+++ b/vulkaninfo/vulkaninfo.h
@@ -481,13 +481,15 @@ struct phys_device_mem_props2_chain;
struct phys_device_features2_chain;
struct surface_capabilities2_chain;
struct format_properties2_chain;
+struct queue_properties2_chain;
-void setup_phys_device_props2_chain(VkPhysicalDeviceProperties2& start, std::unique_ptr<phys_device_props2_chain>& chain);
-void setup_phys_device_mem_props2_chain(VkPhysicalDeviceMemoryProperties2& start, std::unique_ptr<phys_device_mem_props2_chain>& chain);
-void setup_phys_device_features2_chain(VkPhysicalDeviceFeatures2& start, std::unique_ptr<phys_device_features2_chain>& chain);
-void setup_surface_capabilities2_chain(VkSurfaceCapabilities2KHR& start, std::unique_ptr<surface_capabilities2_chain>& chain);
-void setup_format_properties2_chain(VkFormatProperties2& start, std::unique_ptr<format_properties2_chain>& chain);
-
+void setup_phys_device_props2_chain(VkPhysicalDeviceProperties2 &start, std::unique_ptr<phys_device_props2_chain> &chain);
+void setup_phys_device_mem_props2_chain(VkPhysicalDeviceMemoryProperties2 &start,
+ std::unique_ptr<phys_device_mem_props2_chain> &chain);
+void setup_phys_device_features2_chain(VkPhysicalDeviceFeatures2 &start, std::unique_ptr<phys_device_features2_chain> &chain);
+void setup_surface_capabilities2_chain(VkSurfaceCapabilities2KHR &start, std::unique_ptr<surface_capabilities2_chain> &chain);
+void setup_format_properties2_chain(VkFormatProperties2 &start, std::unique_ptr<format_properties2_chain> &chain);
+void setup_queue_properties2_chain(VkQueueFamilyProperties2 &start, std::unique_ptr<queue_properties2_chain> &chain);
/* An ptional contains either a value or nothing. The optional asserts if a value is trying to be gotten but none exist.
* The interface is taken from C++17's <optional> with many aspects removed.
@@ -1369,14 +1371,6 @@ util::vulkaninfo_optional<ImageTypeSupport> FillImageTypeSupport(AppInstance &in
return {};
}
-// struct pNextChainInfos {
-// std::vector<pNextChainBuildingBlockInfo> phys_device_props2;
-// std::vector<pNextChainBuildingBlockInfo> phys_device_mem_props2;
-// std::vector<pNextChainBuildingBlockInfo> phys_device_features2;
-// std::vector<pNextChainBuildingBlockInfo> surface_capabilities2;
-// std::vector<pNextChainBuildingBlockInfo> format_properties2;
-// };
-
struct FormatRange {
// the Vulkan standard version that supports this format range, or 0 if non-standard
uint32_t minimum_instance_version;
@@ -1393,12 +1387,12 @@ struct FormatRange {
struct AppQueueFamilyProperties {
VkQueueFamilyProperties props;
uint32_t queue_index;
+ void *pNext = nullptr; // assumes the lifetime of the pNext chain outlives this object, eg parent object must keep both alive
bool is_present_platform_agnostic = true;
VkBool32 platforms_support_present = VK_FALSE;
-
AppQueueFamilyProperties(AppInstance &inst, VkPhysicalDevice physical_device, VkQueueFamilyProperties family_properties,
- uint32_t queue_index)
- : props(family_properties), queue_index(queue_index) {
+ uint32_t queue_index, void *pNext = nullptr)
+ : props(family_properties), queue_index(queue_index), pNext(pNext) {
for (auto &surface_ext : inst.surface_extensions) {
VkResult err = inst.ext_funcs.vkGetPhysicalDeviceSurfaceSupportKHR(physical_device, queue_index, surface_ext.surface,
&surface_ext.supports_present);
@@ -1423,6 +1417,7 @@ struct AppGpu {
VkPhysicalDeviceProperties2KHR props2{};
std::vector<VkQueueFamilyProperties> queue_props;
+ std::vector<VkQueueFamilyProperties2KHR> queue_props2;
std::vector<AppQueueFamilyProperties> extended_queue_props;
VkPhysicalDeviceMemoryProperties memory_props{};
@@ -1446,9 +1441,9 @@ struct AppGpu {
std::unique_ptr<phys_device_props2_chain> chain_for_phys_device_props2;
std::unique_ptr<phys_device_mem_props2_chain> chain_for_phys_device_mem_props2;
std::unique_ptr<phys_device_features2_chain> chain_for_phys_device_features2;
+ std::vector<std::unique_ptr<queue_properties2_chain>> chain_for_queue_props2;
- AppGpu(AppInstance &inst, uint32_t id, VkPhysicalDevice phys_device)
- : inst(inst), id(id), phys_device(phys_device) {
+ AppGpu(AppInstance &inst, uint32_t id, VkPhysicalDevice phys_device) : inst(inst), id(id), phys_device(phys_device) {
inst.dll.fp_vkGetPhysicalDeviceProperties(phys_device, &props);
// needs to find the minimum of the instance and device version, and use that to print the device info
@@ -1464,11 +1459,6 @@ struct AppGpu {
queue_props.resize(queue_count);
inst.dll.fp_vkGetPhysicalDeviceQueueFamilyProperties(phys_device, &queue_count, queue_props.data());
- int queue_index = 0;
- for (auto &queue_prop : queue_props) {
- extended_queue_props.push_back(AppQueueFamilyProperties(inst, phys_device, queue_prop, queue_index++));
- }
-
if (inst.CheckExtensionEnabled(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) {
// VkPhysicalDeviceProperties2
props2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR;
@@ -1487,6 +1477,30 @@ struct AppGpu {
setup_phys_device_features2_chain(features2, chain_for_phys_device_features2);
inst.ext_funcs.vkGetPhysicalDeviceFeatures2KHR(phys_device, &features2);
+
+ // std::vector<VkPhysicalDeviceQueueFamilyProperties2>
+ uint32_t queue_prop2_count = 0;
+ inst.ext_funcs.vkGetPhysicalDeviceQueueFamilyProperties2KHR(phys_device, &queue_prop2_count, nullptr);
+ queue_props2.resize(queue_prop2_count);
+ chain_for_queue_props2.resize(queue_prop2_count);
+ for (size_t i = 0; i < queue_props2.size(); i++) {
+ queue_props2[i].sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR;
+ setup_queue_properties2_chain(queue_props2[i], chain_for_queue_props2[i]);
+ }
+ inst.ext_funcs.vkGetPhysicalDeviceQueueFamilyProperties2KHR(phys_device, &queue_prop2_count, queue_props2.data());
+ }
+
+ // Use the queue_props2 if they exist, else fallback on vulkan 1.0 queue_props
+ int queue_index = 0;
+ if (queue_props2.size() > 0) {
+ for (auto &queue_prop : queue_props2) {
+ extended_queue_props.push_back(
+ AppQueueFamilyProperties(inst, phys_device, queue_prop.queueFamilyProperties, queue_index++, queue_prop.pNext));
+ }
+ } else {
+ for (auto &queue_prop : queue_props) {
+ extended_queue_props.push_back(AppQueueFamilyProperties(inst, phys_device, queue_prop, queue_index++, nullptr));
+ }
}
device_extensions = AppGetPhysicalDeviceLayerExtensions(nullptr);
@@ -1623,9 +1637,7 @@ struct AppGpu {
},
};
}
- ~AppGpu() {
- inst.dll.fp_vkDestroyDevice(dev, nullptr);
- }
+ ~AppGpu() { inst.dll.fp_vkDestroyDevice(dev, nullptr); }
AppGpu(const AppGpu &) = delete;
const AppGpu &operator=(const AppGpu &) = delete;