Euphoria
opengl_utils.h
Go to the documentation of this file.
1#pragma once
2
3#include "dependency_glad.h"
4#include "eu/base/size.h"
5
6namespace eu::render
7{
8
9
11
16
19
22
23void set_gl_viewport(const Size& sz);
24void set_gl_viewport(const Rect& r);
25
26#if FF_HAS(ENABLE_GL_DEBUG)
27
28 enum class DebugLabelFor
29 {
30 Buffer,
31 Shader,
32 Program,
34 Query,
36 Sampler,
37 Texture,
40 };
41
42 void set_gl_debug_label(DebugLabelFor type, GLuint object, const std::string& label);
43 void set_gl_debug_label(DebugLabelFor type, GLuint object, std::string_view label);
44
45
46 #define SET_DEBUG_LABEL(ID, FOR) set_gl_debug_label(FOR, ID, debug_label)
47 #define SET_DEBUG_LABEL_NAMED(ID, FOR, NAME) set_gl_debug_label(FOR, ID, NAME)
48
49 // See opengl_labels.h for passing the labels/names
50
51 struct ScopedDebugGroup
52 {
53 explicit ScopedDebugGroup(const std::string& message, unsigned int id=0);
54 explicit ScopedDebugGroup(std::string_view message, unsigned int id=0);
56
58 ScopedDebugGroup(const ScopedDebugGroup&) = delete;
59 void operator=(ScopedDebugGroup&&) = delete;
60 void operator=(const ScopedDebugGroup&) = delete;
61 };
62
63 #define CONCAT_IMPL(x, y) x##y
64 #define CONCAT(x, y) CONCAT_IMPL(x, y)
65 #define SCOPED_DEBUG_GROUP(TEXT) [[maybe_unused]] const ScopedDebugGroup CONCAT(sc, __LINE__){TEXT}
66
67#else
68 constexpr void opengl_nop()
69 {
70 }
71
72 #define SET_DEBUG_LABEL(ID, FOR) opengl_nop()
73 #define SET_DEBUG_LABEL_NAMED(ID, FOR, NAME) opengl_nop()
74
75 #define SCOPED_DEBUG_GROUP(TEXT) opengl_nop()
76#endif
77
78
79}
Definition ui.h:4
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:101