summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-09 01:06:02 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-09 01:06:02 +0200
commit70dc294b8ac3a62b9c61a75e0aec3064eef72122 (patch)
treeb687d0676f90051dc35f6938b2c8c151f9ed6966
parent23529e7ab310764cdf1b99015fce0814b4955210 (diff)
a
-rw-r--r--main/debug.cpp26
-rw-r--r--src/wireframe-mesh.cpp9
2 files changed, 30 insertions, 5 deletions
diff --git a/main/debug.cpp b/main/debug.cpp
index ee160136..c7eeaebf 100644
--- a/main/debug.cpp
+++ b/main/debug.cpp
@@ -1,4 +1,5 @@
#include "app.hpp"
+#include <cstring>
#include <Magnum/GL/Renderer.h>
namespace Magnum::Examples {
@@ -14,15 +15,36 @@ using GL::DebugOutput;
void app::debug_callback(GL::DebugOutput::Source src, GL::DebugOutput::Type type, UnsignedInt id,
Severity severity, Containers::StringView str) const
{
+ static thread_local Magnum::Timeline t{};
+
[[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();
+ const Containers::ArrayView<const char> prefix{"Buffer detailed info: "};
+ if (!std::strncmp(str.data(), prefix.data(), prefix.size()-1))
+ str = str.exceptPrefix(prefix.size()-1);
+
+ switch (severity)
+ {
+ using enum GL::DebugOutput::Severity;
+ case Notification: std::fputs("[DEBUG] ", stdout); break;
+ case Low: std::fputs("[INFO ] ", stdout); break;
+ case Medium: std::fputs("[NOTICE] ", stdout); break;
+ case High: std::fputs("[ERROR] ", stdout); break;
+ default: std::fputs("[?????] ", stdout); break;
+ }
+
std::puts(str.data());
std::fflush(stdout);
std::fputs("", stdout); // put breakpoint here
+
+ if (severity != Severity::Notification)
+ std::abort();
+
+ std::fputs("", stdout); // put breakpoint here
}
static void _debug_callback(GL::DebugOutput::Source src, GL::DebugOutput::Type type, UnsignedInt id,
@@ -37,7 +59,9 @@ void* app::register_debug_callback()
GL::Renderer::setFeature(Feature::DebugOutputSynchronous, true);
GL::DebugOutput::setCallback(_debug_callback, this);
GL::DebugOutput::setEnabled(true);
- //GL::DebugOutput::setEnabled(Severity::Notification, false);
+
+ /* Disable rather spammy "Buffer detailed info" debug messages on NVidia drivers */
+ GL::DebugOutput::setEnabled(GL::DebugOutput::Source::Api, GL::DebugOutput::Type::Other, {131185}, false);
return nullptr;
}
diff --git a/src/wireframe-mesh.cpp b/src/wireframe-mesh.cpp
index 03378c02..843bc760 100644
--- a/src/wireframe-mesh.cpp
+++ b/src/wireframe-mesh.cpp
@@ -14,9 +14,10 @@ namespace Magnum::Examples::wireframe
GL::RectangleTexture wireframe::null::make_constant_texture()
{
- Trade::ImageData2D img{PixelStorage{}.setImageHeight(1).setRowLength(1),
- PixelFormat::RGBA8UI, {1, 1},
- Containers::Array<char>{Corrade::DirectInit, 4, (char)(unsigned char)255}};
+ const Vector4ub pixel{255, 255, 255, 255};
+ Trade::ImageData2D img{PixelStorage{}.setImageHeight(1).setRowLength(1).setAlignment(1),
+ PixelFormat::RGBA8Unorm, {1, 1}, {},
+ Containers::arrayView(&pixel, 1), {}, {}};
GL::RectangleTexture tex;
tex.setWrapping(GL::SamplerWrapping::ClampToEdge)
.setMagnificationFilter(GL::SamplerFilter::Nearest)
@@ -59,7 +60,7 @@ template <wireframe::traits T> void wireframe_mesh<T>::draw(tile_shader& shader,
{
GL::Renderer::setLineWidth(2);
_vertex_buffer.setData(x.make_vertex_array(), GL::BufferUsage::DynamicDraw);
- _texture.bind(0);
+ //_texture.bind(0);
shader.draw(_mesh);
}