Euphoria
opengl_utils.h
Go to the documentation of this file.
1#pragma once
2
3#include "dependency_glad.h"
4#include "base/size.h"
5
6namespace eu::render
7{
8
9
11
16
19
22
23void set_gl_viewport(const Size& sz);
24
25#if FF_HAS(ENABLE_GL_DEBUG)
26
27 enum class DebugLabelFor
28 {
29 Buffer,
30 Shader,
31 Program,
33 Query,
35 Sampler,
36 Texture,
39 };
40
41 void set_gl_debug_label(DebugLabelFor type, GLuint object, const std::string& label);
42 void set_gl_debug_label(DebugLabelFor type, GLuint object, std::string_view label);
43
44
45 #define SET_DEBUG_LABEL(ID, FOR) set_gl_debug_label(FOR, ID, debug_label)
46 #define SET_DEBUG_LABEL_NAMED(ID, FOR, NAME) set_gl_debug_label(FOR, ID, NAME)
47
48 // See opengl_labels.h for passing the labels/names
49
50 struct ScopedDebugGroup
51 {
52 explicit ScopedDebugGroup(const std::string& message, unsigned int id=0);
53 explicit ScopedDebugGroup(std::string_view message, unsigned int id=0);
55
57 ScopedDebugGroup(const ScopedDebugGroup&) = delete;
58 void operator=(ScopedDebugGroup&&) = delete;
59 void operator=(const ScopedDebugGroup&) = delete;
60 };
61
62 #define CONCAT_IMPL(x, y) x##y
63 #define CONCAT(x, y) CONCAT_IMPL(x, y)
64 #define SCOPED_DEBUG_GROUP(TEXT) [[maybe_unused]] const ScopedDebugGroup CONCAT(sc, __LINE__){TEXT}
65
66#else
67 constexpr void opengl_nop()
68 {
69 }
70
71 #define SET_DEBUG_LABEL(ID, FOR) opengl_nop()
72 #define SET_DEBUG_LABEL_NAMED(ID, FOR, NAME) opengl_nop()
73
74 #define SCOPED_DEBUG_GROUP(TEXT) opengl_nop()
75#endif
76
77
78}
void setup_opengl_debug()
u32 create_buffer()
void destroy_vertex_array(u32 vao)
GLuint gluint_from_int(int i)
GLsizei glsizei_from_sizet(std::size_t t)
void set_gl_viewport(const Size &sz)
void destroy_buffer(u32 vbo)
GLsizeiptr glsizeiptr_from_sizet(std::size_t t)
u32 create_vertex_array()
GLenum glenum_from_int(int i)
constexpr void opengl_nop()
std::uint32_t u32
Definition ints.h:14
A (inclusive) range between two values.
Definition range.h:19
a size
Definition size.h:11
"render to texture" feature
Definition texture.h:118