gl: Add support for named objects
This commit is contained in:
@@ -259,6 +259,7 @@ OPENGL_PROC(PFNGLDELETESYNCPROC, DeleteSync);
|
|||||||
|
|
||||||
// KHR_debug
|
// KHR_debug
|
||||||
OPENGL_PROC(PFNGLDEBUGMESSAGECALLBACKPROC, DebugMessageCallback);
|
OPENGL_PROC(PFNGLDEBUGMESSAGECALLBACKPROC, DebugMessageCallback);
|
||||||
|
OPENGL_PROC(PFNGLOBJECTLABELPROC, ObjectLabel);
|
||||||
|
|
||||||
// Immutable textures
|
// Immutable textures
|
||||||
OPENGL_PROC(PFNGLTEXSTORAGE1DPROC, TexStorage1D);
|
OPENGL_PROC(PFNGLTEXSTORAGE1DPROC, TexStorage1D);
|
||||||
|
|||||||
@@ -76,6 +76,26 @@ namespace gl
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <GLenum Ns>
|
||||||
|
struct named_object
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
GLuint m_id = GL_NONE;
|
||||||
|
std::string m_name = "Unnamed";
|
||||||
|
|
||||||
|
public:
|
||||||
|
void set_name(std::string_view name)
|
||||||
|
{
|
||||||
|
m_name = name.data();
|
||||||
|
glObjectLabel(Ns, m_id, name.length(), name.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string_view name() const
|
||||||
|
{
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Very useful util when capturing traces with RenderDoc
|
// Very useful util when capturing traces with RenderDoc
|
||||||
static inline void push_debug_label(const char* label)
|
static inline void push_debug_label(const char* label)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user