From 3e9d7a008869360dccbd8c812f4795afa7f8b416 Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Wed, 23 Apr 2025 18:31:19 -0500 Subject: vulkaninfo: Make Presentable Surfaces array unique Makes each JSON field unique in the Presentatble Surfaces array by appending the list of surfaces to the object name. --- vulkaninfo/vulkaninfo.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/vulkaninfo/vulkaninfo.cpp b/vulkaninfo/vulkaninfo.cpp index cec2e6c6..425172e9 100644 --- a/vulkaninfo/vulkaninfo.cpp +++ b/vulkaninfo/vulkaninfo.cpp @@ -220,7 +220,22 @@ void DumpSurfaceCapabilities(Printer &p, AppInstance &inst, AppGpu &gpu, AppSurf } void DumpSurface(Printer &p, AppInstance &inst, AppGpu &gpu, AppSurface &surface, std::set surface_types) { - ObjectWrapper obj(p, std::string("GPU id : ") + p.DecorateAsValue(std::to_string(gpu.id)) + " (" + gpu.props.deviceName + ")"); + std::string surface_type_list_str = ""; + if (surface_types.size() > 0) { + surface_type_list_str = " ["; + bool is_first = true; + for (auto &name : surface_types) { + if (!is_first) { + surface_type_list_str += ", "; + } else { + is_first = false; + } + surface_type_list_str += name; + } + surface_type_list_str += "]"; + } + ObjectWrapper obj(p, std::string("GPU id : ") + p.DecorateAsValue(std::to_string(gpu.id)) + " (" + gpu.props.deviceName + ")" + + surface_type_list_str); if (surface_types.size() == 0) { p.SetAsType().PrintKeyString("Surface type", "No type found"); -- cgit v1.2.3