From 29c8ab38222e06358045a559ad6baecb3ebbbd63 Mon Sep 17 00:00:00 2001 From: Jeremy Kniager Date: Mon, 25 Feb 2019 13:29:36 -0700 Subject: [PATCH] vulkaninfo: Revert "Fix Issue 136" This reverts commit 607c301efbb2ee5228f8ddc8eb7500f11dedecbd. --- vulkaninfo/vulkaninfo.c | 83 +++++++------------------------------------------ 1 file changed, 11 insertions(+), 72 deletions(-) diff --git a/vulkaninfo/vulkaninfo.c b/vulkaninfo/vulkaninfo.c index b6463b2..e5b3bb2 100644 --- a/vulkaninfo/vulkaninfo.c +++ b/vulkaninfo/vulkaninfo.c @@ -112,13 +112,6 @@ struct LayerExtensionList { VkExtensionProperties *extension_properties; }; -struct SurfaceNameWHandle { - const char *name; - VkSurfaceKHR surface; - struct SurfaceNameWHandle *pNextSurface; - VkBool32 present_support; -}; - struct AppInstance { VkInstance instance; uint32_t instance_version; @@ -153,7 +146,6 @@ struct AppInstance { VkSharedPresentSurfaceCapabilitiesKHR shared_surface_capabilities; VkSurfaceCapabilities2EXT surface_capabilities2_ext; - struct SurfaceNameWHandle *surface_chain; VkSurfaceKHR surface; int width, height; @@ -868,8 +860,6 @@ static void AppCreateInstance(struct AppInstance *inst) { inst->vulkan_minor = VK_VERSION_MINOR(inst->instance_version); inst->vulkan_patch = VK_VERSION_PATCH(VK_HEADER_VERSION); - inst->surface_chain = NULL; - AppGetInstanceExtensions(inst); const VkDebugReportCallbackCreateInfoEXT dbg_info = {.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT, @@ -1163,13 +1153,6 @@ static void AppDestroyWin32Window(struct AppInstance *inst) { DestroyWindow(inst static void AppDestroySurface(struct AppInstance *inst) { // same for all platforms vkDestroySurfaceKHR(inst->instance, inst->surface, NULL); } - -static void AppDestroySurfaceChain(struct AppInstance *inst) { // same for all platforms - for (struct SurfaceNameWHandle *surface_stuff = inst->surface_chain; surface_stuff != NULL; - surface_stuff = surface_stuff->pNextSurface) { - vkDestroySurfaceKHR(inst->instance, surface_stuff->surface, NULL); - } -} #endif //----------------------------XCB---------------------------- @@ -1929,29 +1912,9 @@ static void AppDumpSurfaceExtension(struct AppInstance *inst, struct AppGpu *gpu return; } - if (inst->surface) { - AppDestroySurface(inst); - } - surface_extension->create_window(inst); - surface_extension->create_surface(inst); - - struct SurfaceNameWHandle *cur = inst->surface_chain; - if (cur == NULL) { - cur = (struct SurfaceNameWHandle *)malloc(sizeof(struct SurfaceNameWHandle)); - inst->surface_chain = cur; - } else { - for (; cur->pNextSurface != NULL; cur = cur->pNextSurface) { - } - cur->pNextSurface = (struct SurfaceNameWHandle *)malloc(sizeof(struct SurfaceNameWHandle)); - cur = cur->pNextSurface; - } - cur->name = surface_extension->name; - cur->surface = inst->surface; - cur->pNextSurface = NULL; - cur->present_support = VK_FALSE; - for (uint32_t i = 0; i < gpu_count; ++i) { + surface_extension->create_surface(inst); if (html_output) { fprintf(out, "\t\t\t\t
GPU id :
%u
(%s)
\n", i, gpus[i].props.deviceName); @@ -1971,7 +1934,6 @@ static void AppDumpSurfaceExtension(struct AppInstance *inst, struct AppGpu *gpu printf("\n"); } } - inst->surface = VK_NULL_HANDLE; surface_extension->destroy_window(inst); } @@ -4498,9 +4460,9 @@ static void AppGpuDumpQueueProps(const struct AppGpu *gpu, uint32_t id, FILE *ou props = *props_const; } - for (struct SurfaceNameWHandle *surface_stuff = gpu->inst->surface_chain; surface_stuff != NULL; - surface_stuff = surface_stuff->pNextSurface) { - VkResult err = vkGetPhysicalDeviceSurfaceSupportKHR(gpu->obj, id, surface_stuff->surface, &surface_stuff->present_support); + VkBool32 supports_present = VK_FALSE; + if (gpu->inst->surface) { + VkResult err = vkGetPhysicalDeviceSurfaceSupportKHR(gpu->obj, id, gpu->inst->surface, &supports_present); if (err) ERR_EXIT(err); } @@ -4542,13 +4504,8 @@ static void AppGpuDumpQueueProps(const struct AppGpu *gpu, uint32_t id, FILE *ou "class='val'>%d,
%d
)
\n", props.minImageTransferGranularity.width, props.minImageTransferGranularity.height, props.minImageTransferGranularity.depth); - fprintf(out, "\t\t\t\t\t\t
present support\n"); - for (struct SurfaceNameWHandle *surface_stuff = gpu->inst->surface_chain; surface_stuff != NULL; - surface_stuff = surface_stuff->pNextSurface) { - fprintf(out, "\t\t\t\t\t\t\t
%s =
%s
\n", - surface_stuff->name, surface_stuff->present_support ? "true" : "false"); - } - fprintf(out, "\t\t\t\t\t\t
\n"); + fprintf(out, "\t\t\t\t\t\t
present support =
%s
\n", + supports_present ? "true" : "false"); fprintf(out, "\t\t\t\t\t\n"); } else if (human_readable_output) { printf("\n"); @@ -4556,11 +4513,7 @@ static void AppGpuDumpQueueProps(const struct AppGpu *gpu, uint32_t id, FILE *ou printf("\ttimestampValidBits = %u\n", props.timestampValidBits); printf("\tminImageTransferGranularity = (%d, %d, %d)\n", props.minImageTransferGranularity.width, props.minImageTransferGranularity.height, props.minImageTransferGranularity.depth); - printf("\tpresent support:\n"); - for (struct SurfaceNameWHandle *surface_stuff = gpu->inst->surface_chain; surface_stuff != NULL; - surface_stuff = surface_stuff->pNextSurface) { - printf("\t\t%s = %s\n", surface_stuff->name, surface_stuff->present_support ? "true" : "false"); - } + printf("\tpresent support = %s\n", supports_present ? "true" : "false"); } if (json_output) { printf("\t\t{\n"); @@ -4572,16 +4525,7 @@ static void AppGpuDumpQueueProps(const struct AppGpu *gpu, uint32_t id, FILE *ou printf("\t\t\t\"queueCount\": %u,\n", props.queueCount); printf("\t\t\t\"queueFlags\": %u,\n", props.queueFlags); printf("\t\t\t\"timestampValidBits\": %u,\n", props.timestampValidBits); - printf("\t\t\t\"present_support\": {\n"); - for (struct SurfaceNameWHandle *surface_stuff = gpu->inst->surface_chain; surface_stuff != NULL; - surface_stuff = surface_stuff->pNextSurface) { - if (surface_stuff->pNextSurface) { - printf("\t\t\t\t\"%s\" : %u,\n", surface_stuff->name, surface_stuff->present_support); - } else { - printf("\t\t\t\t\"%s\" : %u\n", surface_stuff->name, surface_stuff->present_support); - } - } - printf("\t\t\t}\n"); + printf("\t\t\t\"present_support\": %s\n", supports_present ? "\"true\"" : "\"false\""); printf("\t\t}"); } @@ -4902,13 +4846,8 @@ static void AppGroupDump(const VkPhysicalDeviceGroupProperties *group, const uin .physicalDeviceCount = group->physicalDeviceCount, .pPhysicalDevices = group->physicalDevices}; - float queue_priority = 1.0f; - - VkDeviceQueueCreateInfo q_ci = {.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, - .pNext = NULL, - .queueFamilyIndex = 0, - .queueCount = 1, - .pQueuePriorities = &queue_priority}; + VkDeviceQueueCreateInfo q_ci = { + .sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, .pNext = NULL, .queueFamilyIndex = 0, .queueCount = 1}; VkDeviceCreateInfo device_ci = {.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, .pNext = &dg_ci, @@ -5407,7 +5346,7 @@ int main(int argc, char **argv) { free(gpus); free(objs); - AppDestroySurfaceChain(&inst); + AppDestroySurface(&inst); AppDestroyInstance(&inst); if (html_output) { -- 2.7.4