aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Giessen <charles@lunarg.com>2021-06-10 15:37:25 -0600
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2021-06-11 13:35:39 -0700
commitc2edea101c48fe75bd71e6437fd1098f9cea5973 (patch)
treeee6a08cd07582ef67e1d63ee5f2c082900b47fac
parentbbdf584b4f62718c4e3b3d844fe1b5893dce4112 (diff)
downloadusermoji-c2edea101c48fe75bd71e6437fd1098f9cea5973.tar.xz
vulkaninfo: Fix compiler warnings
Fixes the implicit conversion of int to size_t and hidden declarations. Change-Id: I98a3eeb76acfc4dffa0c6a06bb6e72931e4e16d6
-rw-r--r--vulkaninfo/outputprinter.h8
-rw-r--r--vulkaninfo/vulkaninfo.cpp60
2 files changed, 34 insertions, 34 deletions
diff --git a/vulkaninfo/outputprinter.h b/vulkaninfo/outputprinter.h
index 4f5af3ad..4169a238 100644
--- a/vulkaninfo/outputprinter.h
+++ b/vulkaninfo/outputprinter.h
@@ -388,12 +388,12 @@ class Printer {
break;
}
}
- void ArrayStart(std::string array_name, int32_t element_count = 0) {
+ void ArrayStart(std::string array_name, size_t element_count = 0) {
switch (output_type) {
case (OutputType::text): {
out << std::string(static_cast<size_t>(indents), '\t') << array_name << ":";
size_t underline_count = array_name.size() + 1;
- if (element_count >= 0) {
+ if (element_count > 0) {
out << " count = " << element_count;
underline_count += 9 + std::to_string(element_count).size();
}
@@ -410,7 +410,7 @@ class Printer {
out << "<details>";
}
out << "<summary>" << array_name;
- if (element_count >= 0) {
+ if (element_count > 0) {
out << ": count = <span class='val'>" << element_count << "</span>";
}
out << "</summary>\n";
@@ -725,7 +725,7 @@ class ObjectWrapper {
class ArrayWrapper {
public:
ArrayWrapper(Printer &p, std::string array_name, size_t element_count = 0) : p(p) {
- p.ArrayStart(array_name, static_cast<int32_t>(element_count));
+ p.ArrayStart(array_name, element_count);
}
~ArrayWrapper() { p.ArrayEnd(); }
diff --git a/vulkaninfo/vulkaninfo.cpp b/vulkaninfo/vulkaninfo.cpp
index acfd3402..c1ab4d4f 100644
--- a/vulkaninfo/vulkaninfo.cpp
+++ b/vulkaninfo/vulkaninfo.cpp
@@ -72,7 +72,7 @@ void DumpLayers(Printer &p, std::vector<LayerExtensionList> layers, const std::v
case OutputType::text:
case OutputType::html: {
p.SetHeader();
- ArrayWrapper arr(p, "Layers", layers.size());
+ ArrayWrapper arr_layers(p, "Layers", layers.size());
IndentWrapper indent(p);
for (auto &layer : layers) {
@@ -85,7 +85,7 @@ void DumpLayers(Printer &p, std::vector<LayerExtensionList> layers, const std::v
ObjectWrapper obj(p, header);
DumpExtensions(p, "Layer", layer.extension_properties);
- ArrayWrapper arr(p, "Devices", gpus.size());
+ ArrayWrapper arr_devices(p, "Devices", gpus.size());
for (auto &gpu : gpus) {
p.PrintKeyValue("GPU id", gpu->id, 0, gpu->props.deviceName);
auto exts = gpu->AppGetPhysicalDeviceLayerExtensions(props.layerName);
@@ -116,7 +116,7 @@ void DumpLayers(Printer &p, std::vector<LayerExtensionList> layers, const std::v
DumpExtensions(p, "Layer", layer.extension_properties);
ObjectWrapper obj_devices(p, "Devices");
for (auto &gpu : gpus) {
- ObjectWrapper obj(p, gpu->props.deviceName);
+ ObjectWrapper obj_gpu(p, gpu->props.deviceName);
p.PrintKeyValue("GPU id", gpu->id, 0, gpu->props.deviceName);
auto exts = gpu->AppGetPhysicalDeviceLayerExtensions(layer.layer_properties.layerName);
DumpExtensions(p, "Layer-Device", exts);
@@ -254,15 +254,15 @@ void DumpGroups(Printer &p, AppInstance &inst) {
}
p.SetHeader();
- ObjectWrapper obj(p, "Device Groups");
+ ObjectWrapper obj_device_groups(p, "Device Groups");
IndentWrapper indent(p);
int group_id = 0;
for (auto &group : groups) {
- ObjectWrapper obj(p, "Group " + std::to_string(group_id));
+ ObjectWrapper obj_group(p, "Group " + std::to_string(group_id));
auto group_props = GetGroupProps(inst, group);
{
- ObjectWrapper obj(p, "Properties");
+ ObjectWrapper obj_properties(p, "Properties");
{
ArrayWrapper arr(p, "physicalDevices", group.physicalDeviceCount);
int id = 0;
@@ -279,9 +279,9 @@ void DumpGroups(Printer &p, AppInstance &inst) {
p.PrintKeyString("Present Capabilities",
"Group does not support VK_KHR_device_group, skipping printing present capabilities");
} else {
- ObjectWrapper obj(p, "Present Capabilities");
+ ObjectWrapper obj_caps(p, "Present Capabilities");
for (uint32_t i = 0; i < group.physicalDeviceCount; i++) {
- ObjectWrapper obj(
+ ObjectWrapper obj_device(
p, std::string(group_props[i].deviceName) + " (ID: " + p.DecorateAsValue(std::to_string(i)) + ")");
ArrayWrapper arr(p, "Can present images from the following devices", group.physicalDeviceCount);
@@ -349,7 +349,7 @@ void GpuDumpPropsJson(Printer &p, AppGpu &gpu) {
void GpuDumpQueueProps(Printer &p, std::vector<SurfaceExtension> &surfaces, const AppQueueFamilyProperties &queue) {
VkQueueFamilyProperties props = queue.props;
p.SetSubHeader().SetElementIndex(static_cast<int>(queue.queue_index));
- ObjectWrapper obj(p, "queueProperties");
+ ObjectWrapper obj_queue_props(p, "queueProperties");
if (p.Type() == OutputType::vkconfig_output) {
DumpVkExtent3D(p, "minImageTransferGranularity", props.minImageTransferGranularity);
} else {
@@ -366,7 +366,7 @@ void GpuDumpQueueProps(Printer &p, std::vector<SurfaceExtension> &surfaces, cons
for (auto &surface : surfaces) {
if (surface.name.size() > width) width = surface.name.size();
}
- ObjectWrapper obj(p, "present support");
+ ObjectWrapper obj_present_support(p, "present support");
for (auto &surface : surfaces) {
p.PrintKeyString(surface.name, surface.supports_present ? "true" : "false", width);
}
@@ -416,14 +416,14 @@ std::string append_human_readible(VkDeviceSize memory) {
void GpuDumpMemoryProps(Printer &p, AppGpu &gpu) {
p.SetHeader();
- ObjectWrapper obj(p, "VkPhysicalDeviceMemoryProperties");
+ ObjectWrapper obj_mem_props(p, "VkPhysicalDeviceMemoryProperties");
IndentWrapper indent(p);
{
- ObjectWrapper obj(p, "memoryHeaps", gpu.memory_props.memoryHeapCount);
+ ObjectWrapper obj_mem_heaps(p, "memoryHeaps", gpu.memory_props.memoryHeapCount);
for (uint32_t i = 0; i < gpu.memory_props.memoryHeapCount; ++i) {
p.SetElementIndex(static_cast<int>(i));
- ObjectWrapper obj(p, "memoryHeaps");
+ ObjectWrapper obj_mem_heap(p, "memoryHeaps");
p.PrintKeyString("size", append_human_readible(gpu.memory_props.memoryHeaps[i].size), 6);
if (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_MEMORY_BUDGET_EXTENSION_NAME)) {
@@ -434,11 +434,11 @@ void GpuDumpMemoryProps(Printer &p, AppGpu &gpu) {
}
}
{
- ObjectWrapper obj(p, "memoryTypes", gpu.memory_props.memoryTypeCount);
+ ObjectWrapper obj_mem_types(p, "memoryTypes", gpu.memory_props.memoryTypeCount);
for (uint32_t i = 0; i < gpu.memory_props.memoryTypeCount; ++i) {
p.SetElementIndex(static_cast<int>(i));
- ObjectWrapper obj(p, "memoryTypes");
+ ObjectWrapper obj_mem_type(p, "memoryTypes");
p.PrintKeyValue("heapIndex", gpu.memory_props.memoryTypes[i].heapIndex, 13);
auto flags = gpu.memory_props.memoryTypes[i].propertyFlags;
@@ -450,7 +450,7 @@ void GpuDumpMemoryProps(Printer &p, AppGpu &gpu) {
// only linear and optimal tiling considered
for (auto &image_tiling : gpu.memory_image_support_types) {
p.SetOpenDetails();
- ArrayWrapper arr(p, VkImageTilingString(VkImageTiling(image_tiling.tiling)), -1);
+ ArrayWrapper arr(p, VkImageTilingString(VkImageTiling(image_tiling.tiling)), 0);
bool has_any_support_types = false;
bool regular = false;
bool transient = false;
@@ -493,7 +493,7 @@ void GpuDumpMemoryProps(Printer &p, AppGpu &gpu) {
}
void GpuDumpMemoryPropsJson(Printer &p, AppGpu &gpu) {
- ObjectWrapper obj(p, "VkPhysicalDeviceMemoryProperties");
+ ObjectWrapper obj_mem_props(p, "VkPhysicalDeviceMemoryProperties");
{
ArrayWrapper arr(p, "memoryHeaps", gpu.memory_props.memoryHeapCount);
for (uint32_t i = 0; i < gpu.memory_props.memoryHeapCount; ++i) {
@@ -574,8 +574,8 @@ void GpuDumpToolingInfo(Printer &p, AppGpu &gpu) {
void GpuDevDump(Printer &p, AppGpu &gpu) {
p.SetHeader();
- ObjectWrapper obj(p, "Format Properties");
- IndentWrapper indent(p);
+ ObjectWrapper obj_format_props(p, "Format Properties");
+ IndentWrapper indent_outer(p);
if (p.Type() == OutputType::text) {
auto fmtPropMap = FormatPropMap(gpu);
@@ -593,10 +593,10 @@ void GpuDevDump(Printer &p, AppGpu &gpu) {
}
p.SetElementIndex(counter++);
- ObjectWrapper obj(p, "Common Format Group");
- IndentWrapper indent(p);
+ ObjectWrapper obj_common_group(p, "Common Format Group");
+ IndentWrapper indent_inner(p);
{
- ArrayWrapper arr(p, "Formats", prop.second.size());
+ ArrayWrapper arr_formats(p, "Formats", prop.second.size());
for (auto &fmt : prop.second) {
p.SetAsType().PrintString(VkFormatString(fmt));
}
@@ -605,7 +605,7 @@ void GpuDevDump(Printer &p, AppGpu &gpu) {
p.AddNewline();
}
- ArrayWrapper arr(p, "Unsupported Formats", unsupported_formats.size());
+ ArrayWrapper arr_unsupported_formats(p, "Unsupported Formats", unsupported_formats.size());
for (auto &fmt : unsupported_formats) {
p.SetAsType().PrintString(VkFormatString(fmt));
}
@@ -648,7 +648,7 @@ void GpuDevDumpJson(Printer &p, AppGpu &gpu) {
// Print gpu info for text, html, & vkconfig_output
// Uses a seperate function than schema-json for clarity
void DumpGpu(Printer &p, AppGpu &gpu, bool show_formats) {
- ObjectWrapper obj(p, "GPU" + std::to_string(gpu.id));
+ ObjectWrapper obj_gpu(p, "GPU" + std::to_string(gpu.id));
IndentWrapper indent(p);
GpuDumpProps(p, gpu);
@@ -656,7 +656,7 @@ void DumpGpu(Printer &p, AppGpu &gpu, bool show_formats) {
p.AddNewline();
{
p.SetHeader();
- ObjectWrapper obj(p, "VkQueueFamilyProperties");
+ ObjectWrapper obj_family_props(p, "VkQueueFamilyProperties");
for (const auto &queue_prop : gpu.extended_queue_props) {
GpuDumpQueueProps(p, gpu.inst.surface_extensions, queue_prop);
}
@@ -745,11 +745,11 @@ void DumpSummaryGPU(Printer &p, AppGpu &gpu) {
while (place) {
struct VkStructureHeader *structure = (struct VkStructureHeader *)place;
if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES) {
- VkPhysicalDeviceDriverProperties *props = (VkPhysicalDeviceDriverProperties *)structure;
- DumpVkDriverId(p, "driverID", props->driverID, 18);
- p.PrintKeyString("driverName", props->driverName, 18);
- p.PrintKeyString("driverInfo", props->driverInfo, 18);
- DumpVkConformanceVersion(p, "conformanceVersion", props->conformanceVersion, 18);
+ VkPhysicalDeviceDriverProperties *driver_props = (VkPhysicalDeviceDriverProperties *)structure;
+ DumpVkDriverId(p, "driverID", driver_props->driverID, 18);
+ p.PrintKeyString("driverName", driver_props->driverName, 18);
+ p.PrintKeyString("driverInfo", driver_props->driverInfo, 18);
+ DumpVkConformanceVersion(p, "conformanceVersion", driver_props->conformanceVersion, 18);
}
place = structure->pNext;
}