aboutsummaryrefslogtreecommitdiff
path: root/vulkaninfo/vulkaninfo.cpp
diff options
context:
space:
mode:
authorCharles Giessen <charles@lunarg.com>2020-01-22 13:40:13 -0700
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2020-01-22 15:45:52 -0700
commitaaba1e4e6aec7701e7ee95dd54634e8f2a7806ea (patch)
tree4245010386a72c67f03add6ff794d1886b98f632 /vulkaninfo/vulkaninfo.cpp
parentca9b61a4455f41399df2985692912dd3cb06b695 (diff)
downloadusermoji-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
Diffstat (limited to 'vulkaninfo/vulkaninfo.cpp')
-rw-r--r--vulkaninfo/vulkaninfo.cpp34
1 files changed, 19 insertions, 15 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) {