From db671c2ee40d4ff3c5956f849f69534800b71ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Thu, 31 Aug 2017 20:30:43 -0700 Subject: [PATCH] GL: Implemented setName. --- src/renderer_gl.cpp | 15 ++++++++++++++- src/renderer_gl.h | 8 ++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 3579fa468..c1182f355 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -2984,7 +2984,20 @@ namespace bgfx { namespace gl virtual void setName(Handle _handle, const char* _name) override { - BX_UNUSED(_handle, _name) + switch (_handle.type) + { + case Handle::Shader: + GL_CHECK(glObjectLabel(GL_SHADER, m_shaders[_handle.idx].m_id, -1, _name) ); + break; + + case Handle::Texture: + GL_CHECK(glObjectLabel(GL_TEXTURE, m_textures[_handle.idx].m_id, -1, _name) ); + break; + + default: + BX_CHECK(false, "Invalid handle type?! %d", _handle.type); + break; + } } void submitBlit(BlitState& _bs, uint16_t _view); diff --git a/src/renderer_gl.h b/src/renderer_gl.h index ead415b76..259993038 100644 --- a/src/renderer_gl.h +++ b/src/renderer_gl.h @@ -840,6 +840,14 @@ typedef uint64_t GLuint64; # define GL_UPPER_LEFT 0x8CA2 #endif // GL_UPPER_LEFT +#ifndef GL_SHADER +# define GL_SHADER 0x82E1 +#endif // GL_SHADER + +#ifndef GL_TEXTURE +# define GL_TEXTURE 0x1702 +#endif // GL_TEXTURE + // _KHR or _ARB... #define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 #define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243