diff options
| author | Charles Giessen <charles@lunarg.com> | 2020-01-22 13:40:13 -0700 |
|---|---|---|
| committer | Charles Giessen <46324611+charles-lunarg@users.noreply.github.com> | 2020-01-22 15:45:52 -0700 |
| commit | aaba1e4e6aec7701e7ee95dd54634e8f2a7806ea (patch) | |
| tree | 4245010386a72c67f03add6ff794d1886b98f632 | |
| parent | ca9b61a4455f41399df2985692912dd3cb06b695 (diff) | |
| download | usermoji-aaba1e4e6aec7701e7ee95dd54634e8f2a7806ea.tar.xz | |
vulkaninfo: erroneous presentation surfaces
In the commit to reduce unecessary surfaces being listed where only the surface extension differed, the which gpu the surface was using wasn't considered, creating
a matrix of surfaces, when there should of been only 1. This fixes it by making
sure to only collate surface extensions if they share a GPU.
Change-Id: Ib0d17a229713b3e4cec6f2885f81c96c5232ee0b
| -rw-r--r-- | vulkaninfo/vulkaninfo.cpp | 34 | ||||
| -rw-r--r-- | vulkaninfo/vulkaninfo.h | 3 |
2 files changed, 21 insertions, 16 deletions
diff --git a/vulkaninfo/vulkaninfo.cpp b/vulkaninfo/vulkaninfo.cpp index 02cd7cd0..717360ed 100644 --- a/vulkaninfo/vulkaninfo.cpp +++ b/vulkaninfo/vulkaninfo.cpp @@ -194,9 +194,9 @@ struct SurfaceTypeGroup { }; bool operator==(AppSurface const &a, AppSurface const &b) { - return a.surf_present_modes == b.surf_present_modes && a.surf_formats == b.surf_formats && a.surf_formats2 == b.surf_formats2 && - a.surface_capabilities == b.surface_capabilities && a.surface_capabilities2_khr == b.surface_capabilities2_khr && - a.surface_capabilities2_ext == b.surface_capabilities2_ext; + return a.phys_device == b.phys_device && a.surf_present_modes == b.surf_present_modes && a.surf_formats == b.surf_formats && + a.surf_formats2 == b.surf_formats2 && a.surface_capabilities == b.surface_capabilities && + a.surface_capabilities2_khr == b.surface_capabilities2_khr && a.surface_capabilities2_ext == b.surface_capabilities2_ext; } void DumpPresentableSurfaces(Printer &p, AppInstance &inst, const std::vector<std::unique_ptr<AppGpu>> &gpus, @@ -206,20 +206,24 @@ void DumpPresentableSurfaces(Printer &p, AppInstance &inst, const std::vector<st std::vector<SurfaceTypeGroup> surface_list; for (auto &surface : surfaces) { - for (auto &gpu : gpus) { - auto exists = surface_list.end(); - for (auto it = surface_list.begin(); it != surface_list.end(); it++) { - // This uses a custom comparator to check if the surfaces have the same values - if (it->gpu == gpu.get() && *(it->surface) == *(surface.get())) { - exists = it; - break; - } + auto exists = surface_list.end(); + for (auto it = surface_list.begin(); it != surface_list.end(); it++) { + // check for duplicat surfaces that differ only by the surface extension + if (*(it->surface) == *(surface.get())) { + exists = it; + break; } - if (exists != surface_list.end()) { - exists->surface_types.insert(surface.get()->surface_extension.name); - } else { - surface_list.push_back({surface.get(), gpu.get(), {surface.get()->surface_extension.name}}); + } + if (exists != surface_list.end()) { + exists->surface_types.insert(surface.get()->surface_extension.name); + } else { + // find surface.phys_device's corresponding AppGpu + AppGpu *corresponding_gpu = nullptr; + for (auto &gpu : gpus) { + if (gpu->phys_device == surface->phys_device) corresponding_gpu = gpu.get(); } + if (corresponding_gpu != nullptr) + surface_list.push_back({surface.get(), corresponding_gpu, {surface.get()->surface_extension.name}}); } } for (auto &group : surface_list) { diff --git a/vulkaninfo/vulkaninfo.h b/vulkaninfo/vulkaninfo.h index 42ad3f3e..7add1ca5 100644 --- a/vulkaninfo/vulkaninfo.h +++ b/vulkaninfo/vulkaninfo.h @@ -902,6 +902,7 @@ void SetupWindowExtensions(AppInstance &inst) { class AppSurface { public: AppInstance &inst; + VkPhysicalDevice phys_device; SurfaceExtension surface_extension; std::vector<VkPresentModeKHR> surf_present_modes; @@ -915,7 +916,7 @@ class AppSurface { AppSurface(AppInstance &inst, VkPhysicalDevice phys_device, SurfaceExtension surface_extension, std::vector<pNextChainBuildingBlockInfo> &sur_extension_pNextChain) - : inst(inst), surface_extension(surface_extension) { + : inst(inst), phys_device(phys_device), surface_extension(surface_extension) { uint32_t present_mode_count = 0; VkResult error = inst.vkGetPhysicalDeviceSurfacePresentModesKHR(phys_device, surface_extension.surface, &present_mode_count, nullptr); |
