Skip to content

Commit febb3bd

Browse files
vulkaninfo: Use volk for function loading
Make use of the volk library to fascilitate function loading.
1 parent 75f8d93 commit febb3bd

File tree

3 files changed

+101
-320
lines changed

3 files changed

+101
-320
lines changed

vulkaninfo/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ endif()
109109
target_link_libraries(vulkaninfo PRIVATE
110110
Vulkan::Headers
111111
${CMAKE_DL_LIBS}
112+
volk::volk_headers
112113
)
113114

114115
if(WIN32)

vulkaninfo/vulkaninfo.cpp

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,15 @@ void DumpSurfaceCapabilities(Printer &p, AppInstance &inst, AppGpu &gpu, AppSurf
194194
surface_caps2.sType = VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR;
195195
surface_caps2.pNext = &SurfacePresentScalingCapabilitiesEXT;
196196

197-
VkResult err =
198-
inst.ext_funcs.vkGetPhysicalDeviceSurfaceCapabilities2KHR(gpu.phys_device, &surface_info, &surface_caps2);
197+
VkResult err = vkGetPhysicalDeviceSurfaceCapabilities2KHR(gpu.phys_device, &surface_info, &surface_caps2);
199198
if (err != VK_SUCCESS) {
200199
continue;
201200
}
202201

203202
std::vector<VkPresentModeKHR> compatible_present_modes{SurfacePresentModeCompatibilityEXT.presentModeCount};
204203
SurfacePresentModeCompatibilityEXT.pPresentModes = compatible_present_modes.data();
205204

206-
err = inst.ext_funcs.vkGetPhysicalDeviceSurfaceCapabilities2KHR(gpu.phys_device, &surface_info, &surface_caps2);
205+
err = vkGetPhysicalDeviceSurfaceCapabilities2KHR(gpu.phys_device, &surface_info, &surface_caps2);
207206

208207
if (err == VK_SUCCESS) {
209208
ObjectWrapper present_mode_obj(p, VkPresentModeKHRString(mode));
@@ -355,12 +354,12 @@ void GetAndDumpHostImageCopyPropertiesEXT(Printer &p, AppGpu &gpu) {
355354
VkPhysicalDeviceProperties2KHR props2{};
356355
props2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR;
357356
props2.pNext = static_cast<void *>(&host_image_copy_properties_ext);
358-
gpu.inst.ext_funcs.vkGetPhysicalDeviceProperties2KHR(gpu.phys_device, &props2);
357+
vkGetPhysicalDeviceProperties2KHR(gpu.phys_device, &props2);
359358
std::vector<VkImageLayout> src_layouts(host_image_copy_properties_ext.copySrcLayoutCount);
360359
host_image_copy_properties_ext.pCopySrcLayouts = src_layouts.data();
361360
std::vector<VkImageLayout> dst_layouts(host_image_copy_properties_ext.copyDstLayoutCount);
362361
host_image_copy_properties_ext.pCopyDstLayouts = dst_layouts.data();
363-
gpu.inst.ext_funcs.vkGetPhysicalDeviceProperties2KHR(gpu.phys_device, &props2);
362+
vkGetPhysicalDeviceProperties2KHR(gpu.phys_device, &props2);
364363
DumpVkPhysicalDeviceHostImageCopyPropertiesEXT(p, "VkPhysicalDeviceHostImageCopyPropertiesEXT", host_image_copy_properties_ext);
365364
}
366365

@@ -722,7 +721,7 @@ void DumpGpuProfileCapabilities(Printer &p, AppGpu &gpu) {
722721
format_props2.formatProperties = formats.props;
723722
std::unique_ptr<format_properties2_chain> chain_for_format_props2;
724723
setup_format_properties2_chain(format_props2, chain_for_format_props2, gpu);
725-
gpu.inst.ext_funcs.vkGetPhysicalDeviceFormatProperties2KHR(gpu.phys_device, fmt, &format_props2);
724+
vkGetPhysicalDeviceFormatProperties2KHR(gpu.phys_device, fmt, &format_props2);
726725
chain_iterator_format_properties2(p, gpu, format_props2.pNext);
727726
}
728727
already_printed_formats.insert(fmt);
@@ -935,21 +934,28 @@ const char *help_message_body =
935934
"[-o <filename>, --output <filename>]\n"
936935
" Print output to a new file whose name is specified by filename.\n"
937936
" File will be written to the current working directory.\n"
938-
"[--text] Produce a text version of " APP_SHORT_NAME " output to stdout. This is\n"
937+
"[--text] Produce a text version of " APP_SHORT_NAME
938+
" output to stdout. This is\n"
939939
" the default output.\n"
940-
"[--html] Produce an html version of " APP_SHORT_NAME " output, saved as\n"
941-
" \"" APP_SHORT_NAME ".html\" in the directory in which the command\n"
940+
"[--html] Produce an html version of " APP_SHORT_NAME
941+
" output, saved as\n"
942+
" \"" APP_SHORT_NAME
943+
".html\" in the directory in which the command\n"
942944
" is run.\n"
943-
"[-j, --json] Produce a json version of " APP_SHORT_NAME " output conforming to the Vulkan\n"
945+
"[-j, --json] Produce a json version of " APP_SHORT_NAME
946+
" output conforming to the Vulkan\n"
944947
" Profiles schema, saved as \n"
945-
" \"VP_" APP_UPPER_CASE_NAME "_[DEVICE_NAME]_[DRIVER_VERSION].json\"\n"
948+
" \"VP_" APP_UPPER_CASE_NAME
949+
"_[DEVICE_NAME]_[DRIVER_VERSION].json\"\n"
946950
" of the first gpu in the system.\n"
947951
"[-j=<gpu-number>, --json=<gpu-number>]\n"
948952
" For a multi-gpu system, a single gpu can be targetted by\n"
949953
" specifying the gpu-number associated with the gpu of \n"
950954
" interest. This number can be determined by running\n"
951-
" " APP_SHORT_NAME " without any options specified.\n"
952-
"[--show-tool-props] Show the active VkPhysicalDeviceToolPropertiesEXT that " APP_SHORT_NAME " finds.\n"
955+
" " APP_SHORT_NAME
956+
" without any options specified.\n"
957+
"[--show-tool-props] Show the active VkPhysicalDeviceToolPropertiesEXT that " APP_SHORT_NAME
958+
" finds.\n"
953959
"[--show-formats] Display the format properties of each physical device.\n"
954960
" Note: This only affects text output.\n";
955961

@@ -1191,8 +1197,7 @@ int main(int argc, char **argv) {
11911197
try {
11921198
// check if the surface is supported by the physical device before adding it to the list
11931199
VkBool32 supported = VK_FALSE;
1194-
VkResult err = instance.ext_funcs.vkGetPhysicalDeviceSurfaceSupportKHR(gpu->phys_device, 0,
1195-
surface_extension.surface, &supported);
1200+
VkResult err = vkGetPhysicalDeviceSurfaceSupportKHR(gpu->phys_device, 0, surface_extension.surface, &supported);
11961201
if (err != VK_SUCCESS || supported == VK_FALSE) continue;
11971202

11981203
surfaces.push_back(

0 commit comments

Comments
 (0)