Move OpenGL framebuffer diagnostics

This commit is contained in:
2026-06-01 17:50:51 +02:00
parent 2e0ebd0e13
commit aa32c47e18
6 changed files with 63 additions and 18 deletions

View File

@@ -17,6 +17,14 @@ constexpr std::uint32_t gl_rgb8 = 0x8051U;
constexpr std::uint32_t gl_rgba8 = 0x8058U;
constexpr std::uint32_t gl_rgba32f = 0x8814U;
constexpr std::uint32_t gl_rgba16f = 0x881AU;
constexpr std::uint32_t gl_framebuffer_complete = 0x8CD5U;
constexpr std::uint32_t gl_framebuffer_incomplete_attachment = 0x8CD6U;
constexpr std::uint32_t gl_framebuffer_incomplete_missing_attachment = 0x8CD7U;
constexpr std::uint32_t gl_framebuffer_incomplete_draw_buffer = 0x8CDBU;
constexpr std::uint32_t gl_framebuffer_incomplete_read_buffer = 0x8CDCU;
constexpr std::uint32_t gl_framebuffer_unsupported = 0x8CDDU;
constexpr std::uint32_t gl_framebuffer_undefined = 0x8219U;
constexpr std::uint32_t gl_framebuffer_incomplete_multisample = 0x8D56U;
[[nodiscard]] bool contains(std::string_view text, std::string_view needle) noexcept
{
@@ -92,4 +100,28 @@ OpenGlPixelFormat texture_format_for_channel_count(std::uint32_t channel_count)
}
}
const char* framebuffer_status_name(std::uint32_t status) noexcept
{
switch (status) {
case gl_framebuffer_complete:
return "GL_FRAMEBUFFER_COMPLETE";
case gl_framebuffer_undefined:
return "GL_FRAMEBUFFER_UNDEFINED";
case gl_framebuffer_incomplete_attachment:
return "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT";
case gl_framebuffer_incomplete_missing_attachment:
return "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";
case gl_framebuffer_incomplete_draw_buffer:
return "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER";
case gl_framebuffer_incomplete_read_buffer:
return "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER";
case gl_framebuffer_unsupported:
return "GL_FRAMEBUFFER_UNSUPPORTED";
case gl_framebuffer_incomplete_multisample:
return "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE";
default:
return "UNKNOWN";
}
}
}