mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-03-09 23:14:46 +01:00
gl: Add support for named objects
This commit is contained in:
parent
14789b536f
commit
1e16b338b4
|
|
@ -259,6 +259,7 @@ OPENGL_PROC(PFNGLDELETESYNCPROC, DeleteSync);
|
|||
|
||||
// KHR_debug
|
||||
OPENGL_PROC(PFNGLDEBUGMESSAGECALLBACKPROC, DebugMessageCallback);
|
||||
OPENGL_PROC(PFNGLOBJECTLABELPROC, ObjectLabel);
|
||||
|
||||
// Immutable textures
|
||||
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
|
||||
static inline void push_debug_label(const char* label)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue