Skip to content

Commit fb86285

Browse files
committed
[*] Cleanup spdlog messages
1 parent 38955aa commit fb86285

File tree

16 files changed

+412
-415
lines changed

16 files changed

+412
-415
lines changed

example/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ int main(int argc, char *argv[]) {
2121

2222
spdlog::set_default_logger(vulkan_renderer_log);
2323

24-
spdlog::debug("Inexor vulkan-renderer, BUILD " + std::string(__DATE__) + ", " + __TIME__);
25-
spdlog::debug("Parsing command line arguments.");
24+
spdlog::trace("Inexor vulkan-renderer, BUILD " + std::string(__DATE__) + ", " + __TIME__);
25+
spdlog::trace("Parsing command line arguments");
2626

2727
std::unique_ptr<inexor::vulkan_renderer::Application> renderer;
2828

@@ -38,5 +38,5 @@ int main(int argc, char *argv[]) {
3838

3939
renderer->run();
4040
renderer->calculate_memory_budget();
41-
spdlog::debug("Window closed");
41+
spdlog::trace("Window closed");
4242
}

include/inexor/vulkan-renderer/wrapper/mesh_buffer.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ class MeshBuffer {
7474
std::size_t vertex_buffer_size = sizeof(VertexType) * vertex_count;
7575
std::size_t index_buffer_size = sizeof(IndexType) * index_count;
7676

77-
spdlog::debug("Creating vertex buffer of size {} for mesh {}.", vertex_buffer_size, name);
78-
spdlog::debug("Creating index buffer of size {} for mesh {}.", index_buffer_size, name);
77+
spdlog::trace("Creating vertex buffer of size {} for mesh {}", vertex_buffer_size, name);
78+
spdlog::trace("Creating index buffer of size {} for mesh {}", index_buffer_size, name);
7979
}
8080

8181
/// @brief Creates a mesh buffer of type VertexType without a corresponding index buffer by specifying the number of
@@ -96,7 +96,7 @@ class MeshBuffer {
9696

9797
std::size_t vertex_buffer_size = sizeof(VertexType) * vertex_count;
9898

99-
spdlog::debug("Creating vertex buffer of size {} for mesh {}.", vertex_buffer_size, name);
99+
spdlog::trace("Creating vertex buffer of size {} for mesh {}", vertex_buffer_size, name);
100100
}
101101

102102
/// @brief Constructs a mesh buffer of type VertexType with a corresponding index buffer of type IndexType.
@@ -110,8 +110,8 @@ class MeshBuffer {
110110
std::size_t vertex_buffer_size = sizeof(VertexType) * vertices.size();
111111
std::size_t index_buffer_size = sizeof(IndexType) * indices.size();
112112

113-
spdlog::debug("Creating vertex buffer of size {} for mesh {}.", vertex_buffer_size, name);
114-
spdlog::debug("Creating index buffer of size {} for mesh {}.", index_buffer_size, name);
113+
spdlog::trace("Creating vertex buffer of size {} for mesh {}", vertex_buffer_size, name);
114+
spdlog::trace("Creating index buffer of size {} for mesh {}", index_buffer_size, name);
115115

116116
// Not using an index buffer can decrease performance drastically!
117117
if (index_buffer_size == 0) {
@@ -148,7 +148,7 @@ class MeshBuffer {
148148
: MeshBuffer(device, name, vertices.size()) {
149149
std::size_t size_of_vertex_buffer = sizeof(VertexType) * vertices.size();
150150

151-
spdlog::debug("Creating vertex buffer of size {} for mesh {}.", size_of_vertex_buffer, name);
151+
spdlog::trace("Creating vertex buffer of size {} for mesh {}", size_of_vertex_buffer, name);
152152

153153
// Not using an index buffer can decrease performance drastically!
154154
spdlog::warn("Creating a vertex buffer without an index buffer!");

src/vulkan-renderer/application.cpp

Lines changed: 51 additions & 53 deletions
Large diffs are not rendered by default.

src/vulkan-renderer/imgui.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace inexor::vulkan_renderer {
1313
ImGUIOverlay::ImGUIOverlay(const wrapper::Device &device, const wrapper::Swapchain &swapchain,
1414
RenderGraph *render_graph, TextureResource *back_buffer)
1515
: m_device(device), m_swapchain(swapchain) {
16-
spdlog::debug("Creating ImGUI context");
16+
spdlog::trace("Creating ImGUI context");
1717
ImGui::CreateContext();
1818

1919
ImGuiStyle &style = ImGui::GetStyle();
@@ -37,7 +37,7 @@ ImGUIOverlay::ImGUIOverlay(const wrapper::Device &device, const wrapper::Swapcha
3737
ImGuiIO &io = ImGui::GetIO();
3838
io.FontGlobalScale = m_scale;
3939

40-
spdlog::debug("Loading ImGUI shaders");
40+
spdlog::trace("Loading ImGUI shaders");
4141
m_vertex_shader = std::make_unique<wrapper::Shader>(m_device, VK_SHADER_STAGE_VERTEX_BIT, "ImGUI vertex shader",
4242
"shaders/ui.vert.spv");
4343
m_fragment_shader = std::make_unique<wrapper::Shader>(m_device, VK_SHADER_STAGE_FRAGMENT_BIT,
@@ -49,7 +49,7 @@ ImGUIOverlay::ImGUIOverlay(const wrapper::Device &device, const wrapper::Swapcha
4949
constexpr const char *FONT_FILE_PATH = "assets/fonts/NotoSans-Bold.ttf";
5050
constexpr float FONT_SIZE = 18.0f;
5151

52-
spdlog::debug("Loading front '{}'", FONT_FILE_PATH);
52+
spdlog::trace("Loading front {}", FONT_FILE_PATH);
5353

5454
ImFont *font = io.Fonts->AddFontFromFileTTF(FONT_FILE_PATH, FONT_SIZE);
5555

@@ -59,10 +59,10 @@ ImGUIOverlay::ImGUIOverlay(const wrapper::Device &device, const wrapper::Swapcha
5959
io.Fonts->GetTexDataAsRGBA32(&font_texture_data, &font_texture_width, &font_texture_height);
6060

6161
if (font == nullptr || font_texture_data == nullptr) {
62-
spdlog::error("Unable to load font {}. Falling back to error texture.", FONT_FILE_PATH);
62+
spdlog::error("Unable to load font {}. Falling back to error texture", FONT_FILE_PATH);
6363
m_imgui_texture = std::make_unique<wrapper::GpuTexture>(m_device, wrapper::CpuTexture());
6464
} else {
65-
spdlog::debug("Creating ImGUI font texture");
65+
spdlog::trace("Creating ImGUI font texture");
6666

6767
// Our font textures always have 4 channels and a single mip level by definition.
6868
constexpr int FONT_TEXTURE_CHANNELS{4};

src/vulkan-renderer/io/nxoc_parser.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,27 +64,27 @@ std::shared_ptr<world::Cube> NXOCParser::deserialize_impl<0>(const ByteStream &s
6464

6565
ByteStream NXOCParser::serialize(const std::shared_ptr<const world::Cube> cube, const std::uint32_t version) {
6666
if (cube == nullptr) {
67-
throw std::invalid_argument("cube cannot be a nullptr.");
67+
throw std::invalid_argument("cube cannot be a nullptr");
6868
}
6969
switch (version) { // NOLINT
7070
case 0:
7171
return serialize_impl<0>(cube);
7272
default:
73-
throw IoException("Unsupported octree version.");
73+
throw IoException("Unsupported octree version");
7474
}
7575
}
7676

7777
std::shared_ptr<world::Cube> NXOCParser::deserialize(const ByteStream &stream) {
7878
ByteStreamReader reader(stream);
7979
if (reader.read<std::string>(13ull) != "Inexor Octree") {
80-
throw IoException("Wrong identifier.");
80+
throw IoException("Wrong identifier");
8181
}
8282
const auto version = reader.read<std::uint32_t>();
8383
switch (version) { // NOLINT
8484
case 0:
8585
return deserialize_impl<0>(stream);
8686
default:
87-
throw IoException("Unsupported octree version.");
87+
throw IoException("Unsupported octree version");
8888
}
8989
}
9090
} // namespace inexor::vulkan_renderer::io

src/vulkan-renderer/render_graph.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -399,20 +399,25 @@ void RenderGraph::compile(const RenderResource *target) {
399399
dfs(stage);
400400
}
401401

402-
m_log->debug("Final stage order:");
402+
m_log->trace("Final stage order:");
403403
for (auto *stage : m_stage_stack) {
404-
m_log->debug(" - {}", stage->m_name);
404+
m_log->trace(" - {}", stage->m_name);
405405
}
406406

407407
// Create physical resources. For now, each buffer or texture resource maps directly to either a VkBuffer or VkImage
408408
// respectively. Every physical resource also has a VmaAllocation.
409409
// TODO: Resource aliasing (i.e. reusing the same physical resource for multiple resources).
410+
m_log->trace("Allocating physical resource for buffers:");
411+
410412
for (auto &buffer_resource : m_buffer_resources) {
411-
m_log->trace("Allocating physical resource for buffer '{}'", buffer_resource->m_name);
413+
m_log->trace(" - {}", buffer_resource->m_name);
412414
buffer_resource->m_physical = std::make_shared<PhysicalBuffer>(m_device.allocator(), m_device.device());
413415
}
416+
417+
m_log->trace("Allocating physical resource for texture:");
418+
414419
for (auto &texture_resource : m_texture_resources) {
415-
m_log->trace("Allocating physical resource for texture '{}'", texture_resource->m_name);
420+
m_log->trace(" - {}", texture_resource->m_name);
416421
// Back buffer gets special handling.
417422
if (texture_resource->m_usage == TextureUsage::BACK_BUFFER) {
418423
// TODO: Move image views from wrapper::Swapchain to PhysicalBackBuffer.
@@ -481,12 +486,14 @@ void RenderGraph::compile(const RenderResource *target) {
481486
}
482487
}
483488

489+
m_log->trace("Allocating command buffers for stage:");
490+
484491
// Allocate command buffers and finished semaphore.
485492
for (const auto *stage : m_stage_stack) {
486493
auto &physical = *stage->m_physical;
487494
physical.m_finished_semaphore =
488495
std::make_unique<wrapper::Semaphore>(m_device, "Finished semaphore for stage " + stage->m_name);
489-
m_log->trace("Allocating command buffers for stage '{}'", stage->m_name);
496+
m_log->trace(" - {}", stage->m_name);
490497
for (std::uint32_t i = 0; i < m_swapchain.image_count(); i++) {
491498
physical.m_command_buffers.emplace_back(m_device, m_command_pool,
492499
"Command buffer for stage " + stage->m_name);

src/vulkan-renderer/renderer.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,29 +121,28 @@ void VulkanRenderer::render_frame() {
121121

122122
if (auto fps_value = m_fps_counter.update()) {
123123
m_window->set_title("Inexor Vulkan API renderer demo - " + std::to_string(*fps_value) + " FPS");
124-
spdlog::debug("FPS: {}, window size: {} x {}.", *fps_value, m_window->width(), m_window->height());
124+
spdlog::trace("FPS: {}, window size: {} x {}", *fps_value, m_window->width(), m_window->height());
125125
}
126126
}
127127

128128
void VulkanRenderer::calculate_memory_budget() {
129129
VmaStats memory_stats;
130130
vmaCalculateStats(m_device->allocator(), &memory_stats);
131131

132-
spdlog::debug("-------------VMA stats-------------");
133-
spdlog::debug("Number of `VkDeviceMemory` (physical memory) blocks allocated: {} still alive, {} in total",
134-
memory_stats.memoryHeap->blockCount, memory_stats.total.blockCount);
135-
spdlog::debug("Number of VmaAlllocation objects allocated (requested memory): {} still alive, {} in total",
136-
memory_stats.memoryHeap->allocationCount, memory_stats.total.allocationCount);
137-
spdlog::debug("Number of free ranges of memory between allocations: {}", memory_stats.memoryHeap->unusedRangeCount);
138-
spdlog::debug("Total number of bytes occupied by all allocations: {}", memory_stats.memoryHeap->usedBytes);
139-
spdlog::debug("Total number of bytes occupied by unused ranges: {}", memory_stats.memoryHeap->unusedBytes);
140-
spdlog::debug("memory_stats.memoryHeap->allocationSizeMin: {}", memory_stats.memoryHeap->allocationSizeMin);
141-
spdlog::debug("memory_stats.memoryHeap->allocationSizeAvg: {}", memory_stats.memoryHeap->allocationSizeAvg);
142-
spdlog::debug("memory_stats.memoryHeap->allocationSizeMax: {}", memory_stats.memoryHeap->allocationSizeMax);
143-
spdlog::debug("memory_stats.memoryHeap->unusedRangeSizeMin: {}", memory_stats.memoryHeap->unusedRangeSizeMin);
144-
spdlog::debug("memory_stats.memoryHeap->unusedRangeSizeAvg: {}", memory_stats.memoryHeap->unusedRangeSizeAvg);
145-
spdlog::debug("memory_stats.memoryHeap->unusedRangeSizeMax: {}", memory_stats.memoryHeap->unusedRangeSizeMax);
146-
spdlog::debug("-------------VMA stats-------------");
132+
spdlog::trace("Vulkan Memory Allocator statistics:");
133+
spdlog::trace(" total.blockCount: {}", memory_stats.total.blockCount);
134+
spdlog::trace(" total.allocationCount: {}", memory_stats.total.allocationCount);
135+
spdlog::trace(" memoryHeap->blockCount: {}", memory_stats.memoryHeap->blockCount);
136+
spdlog::trace(" memoryHeap->allocationCount: {}", memory_stats.memoryHeap->allocationCount);
137+
spdlog::trace(" memoryHeap->unusedRangeCount: {}", memory_stats.memoryHeap->unusedRangeCount);
138+
spdlog::trace(" memoryHeap->usedBytes: {}", memory_stats.memoryHeap->usedBytes);
139+
spdlog::trace(" memoryHeap->unusedBytes: {}", memory_stats.memoryHeap->unusedBytes);
140+
spdlog::trace(" memoryHeap->allocationSizeMin: {}", memory_stats.memoryHeap->allocationSizeMin);
141+
spdlog::trace(" memoryHeap->allocationSizeAvg: {}", memory_stats.memoryHeap->allocationSizeAvg);
142+
spdlog::trace(" memoryHeap->allocationSizeMax: {}", memory_stats.memoryHeap->allocationSizeMax);
143+
spdlog::trace(" memoryHeap->unusedRangeSizeMin: {}", memory_stats.memoryHeap->unusedRangeSizeMin);
144+
spdlog::trace(" memoryHeap->unusedRangeSizeAvg: {}", memory_stats.memoryHeap->unusedRangeSizeAvg);
145+
spdlog::trace(" memoryHeap->unusedRangeSizeMax: {}", memory_stats.memoryHeap->unusedRangeSizeMax);
147146

148147
char *vma_stats_string = nullptr;
149148
vmaBuildStatsString(m_device->allocator(), &vma_stats_string, VK_TRUE);
@@ -157,7 +156,7 @@ void VulkanRenderer::calculate_memory_budget() {
157156
}
158157

159158
VulkanRenderer::~VulkanRenderer() {
160-
spdlog::debug("Shutting down vulkan renderer");
159+
spdlog::trace("Shutting down vulkan renderer");
161160

162161
if (m_device == nullptr) {
163162
return;

0 commit comments

Comments
 (0)