summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-09 00:28:44 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-09 00:28:44 +0200
commit23529e7ab310764cdf1b99015fce0814b4955210 (patch)
treeeb815cdd6e5365602685f4e9a0a12cba8fd80f5f
parent07d8adea58ec5b6b51704be1caf84012b0049313 (diff)
a
-rw-r--r--main/app.hpp6
-rw-r--r--main/debug.cpp26
2 files changed, 21 insertions, 11 deletions
diff --git a/main/app.hpp b/main/app.hpp
index 6f7e518c..042a15ef 100644
--- a/main/app.hpp
+++ b/main/app.hpp
@@ -33,8 +33,8 @@ struct app final : Platform::Application
void update_window_scale(Vector2i window_size);
void viewportEvent(ViewportEvent& event) override;
void debug_callback(GL::DebugOutput::Source src, GL::DebugOutput::Type type, UnsignedInt id,
- GL::DebugOutput::Severity severity, const std::string& str) const;
- void register_debug_callback();
+ GL::DebugOutput::Severity severity, Containers::StringView str) const;
+ void* register_debug_callback();
enum class key : int {
camera_up, camera_left, camera_right, camera_down, camera_reset,
@@ -43,7 +43,7 @@ struct app final : Platform::Application
};
chunk make_test_chunk();
- const void* const _dummy = (register_debug_callback(), nullptr);
+ const void* const _dummy = register_debug_callback();
tile_shader _shader;
tile_atlas_ floor1 = loader.tile_atlas("share/game/images/metal1.tga", {2, 2});
tile_atlas_ floor2 = loader.tile_atlas("share/game/images/floor1.tga", {4, 4});
diff --git a/main/debug.cpp b/main/debug.cpp
index 7e7e3abf..ee160136 100644
--- a/main/debug.cpp
+++ b/main/debug.cpp
@@ -4,32 +4,42 @@
namespace Magnum::Examples {
using Feature = GL::Renderer::Feature;
-using Severity = GL::DebugOutput::Severity;
+using Source = GL::DebugOutput::Source;
using Type = GL::DebugOutput::Type;
+using Severity = GL::DebugOutput::Severity;
using GL::Renderer;
using GL::DebugOutput;
+// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
void app::debug_callback(GL::DebugOutput::Source src, GL::DebugOutput::Type type, UnsignedInt id,
- GL::DebugOutput::Severity severity, const std::string& str) const
+ Severity severity, Containers::StringView str) const
{
- std::fputs(str.c_str(), stdout);
- std::fputc('\n', stdout);
+ [[maybe_unused]] volatile auto _type = type;
+ [[maybe_unused]] volatile auto _id = id;
+ [[maybe_unused]] volatile auto _src = src;
+ [[maybe_unused]] volatile auto _severity = severity;
+ [[maybe_unused]] volatile const char* _str = str.data();
+
+ std::puts(str.data());
std::fflush(stdout);
- std::puts(""); // put breakpoint here
+ std::fputs("", stdout); // put breakpoint here
}
static void _debug_callback(GL::DebugOutput::Source src, GL::DebugOutput::Type type, UnsignedInt id,
- GL::DebugOutput::Severity severity, const std::string& str, const void* self)
+ GL::DebugOutput::Severity severity, Containers::StringView str, const void* self)
{
static_cast<const app*>(self)->debug_callback(src, type, id, severity, str);
}
-void app::register_debug_callback()
+void* app::register_debug_callback()
{
GL::Renderer::setFeature(Feature::DebugOutput, true);
GL::Renderer::setFeature(Feature::DebugOutputSynchronous, true);
GL::DebugOutput::setCallback(_debug_callback, this);
- GL::DebugOutput::setEnabled(Severity::High, true);
+ GL::DebugOutput::setEnabled(true);
+ //GL::DebugOutput::setEnabled(Severity::Notification, false);
+
+ return nullptr;
}
} // namespace Magnum::Examples