diff --git a/src/gl/renderer/gl_postprocess.cpp b/src/gl/renderer/gl_postprocess.cpp index a53067d8be..5f523e9eb7 100644 --- a/src/gl/renderer/gl_postprocess.cpp +++ b/src/gl/renderer/gl_postprocess.cpp @@ -59,6 +59,7 @@ #include "gl/system/gl_interface.h" #include "gl/system/gl_framebuffer.h" #include "gl/system/gl_cvars.h" +#include "gl/system/gl_debug.h" #include "gl/renderer/gl_lightdata.h" #include "gl/renderer/gl_renderstate.h" #include "gl/renderer/gl_renderbuffers.h" @@ -127,6 +128,8 @@ void FGLRenderer::BloomScene() if (!gl_bloom || !FGLRenderBuffers::IsEnabled() || gl_fixedcolormap != CM_DEFAULT) return; + FGLDebug::PushGroup("BloomScene"); + FGLPostProcessState savedState; const float blurAmount = gl_bloom_amount; @@ -196,6 +199,8 @@ void FGLRenderer::BloomScene() mBloomCombineShader->BloomTexture.Set(0); RenderScreenQuad(); glViewport(mScreenViewport.left, mScreenViewport.top, mScreenViewport.width, mScreenViewport.height); + + FGLDebug::PopGroup(); } //----------------------------------------------------------------------------- @@ -209,6 +214,8 @@ void FGLRenderer::TonemapScene() if (gl_tonemap == 0 || !FGLRenderBuffers::IsEnabled()) return; + FGLDebug::PushGroup("TonemapScene"); + FGLPostProcessState savedState; mBuffers->BindNextFB(); @@ -218,6 +225,8 @@ void FGLRenderer::TonemapScene() mTonemapShader->Exposure.Set(mCameraExposure); RenderScreenQuad(); mBuffers->NextTexture(); + + FGLDebug::PopGroup(); } //----------------------------------------------------------------------------- @@ -231,6 +240,8 @@ void FGLRenderer::LensDistortScene() if (gl_lens == 0 || !FGLRenderBuffers::IsEnabled()) return; + FGLDebug::PushGroup("LensDistortScene"); + float k[4] = { gl_lens_k, @@ -272,6 +283,8 @@ void FGLRenderer::LensDistortScene() glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); mBuffers->NextTexture(); + + FGLDebug::PopGroup(); } //----------------------------------------------------------------------------- @@ -283,6 +296,7 @@ void FGLRenderer::LensDistortScene() void FGLRenderer::CopyToBackbuffer(const GL_IRECT *bounds, bool applyGamma) { m2DDrawer->Flush(); // draw all pending 2D stuff before copying the buffer + FGLDebug::PushGroup("CopyToBackbuffer"); if (FGLRenderBuffers::IsEnabled()) { FGLPostProcessState savedState; @@ -327,6 +341,7 @@ void FGLRenderer::CopyToBackbuffer(const GL_IRECT *bounds, bool applyGamma) FGLPostProcessState savedState; ClearBorders(); } + FGLDebug::PopGroup(); } //----------------------------------------------------------------------------- diff --git a/src/gl/renderer/gl_renderbuffers.cpp b/src/gl/renderer/gl_renderbuffers.cpp index a3433c075d..7abd6d85c3 100644 --- a/src/gl/renderer/gl_renderbuffers.cpp +++ b/src/gl/renderer/gl_renderbuffers.cpp @@ -47,6 +47,7 @@ #include "gl/system/gl_interface.h" #include "gl/system/gl_framebuffer.h" #include "gl/system/gl_cvars.h" +#include "gl/system/gl_debug.h" #include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_renderbuffers.h" #include "w_wad.h" @@ -195,18 +196,18 @@ void FGLRenderBuffers::CreateScene(int width, int height, int samples) ClearScene(); if (samples > 1) - mSceneMultisample = CreateRenderBuffer(GetHdrFormat(), samples, width, height); + mSceneMultisample = CreateRenderBuffer("SceneMultisample", GetHdrFormat(), samples, width, height); if ((gl.flags & RFL_NO_DEPTHSTENCIL) != 0) { - mSceneDepth = CreateRenderBuffer(GL_DEPTH_COMPONENT24, samples, width, height); - mSceneStencil = CreateRenderBuffer(GL_STENCIL_INDEX8, samples, width, height); - mSceneFB = CreateFrameBuffer(samples > 1 ? mSceneMultisample : mPipelineTexture[0], mSceneDepth, mSceneStencil, samples > 1); + mSceneDepth = CreateRenderBuffer("SceneDepth", GL_DEPTH_COMPONENT24, samples, width, height); + mSceneStencil = CreateRenderBuffer("SceneStencil", GL_STENCIL_INDEX8, samples, width, height); + mSceneFB = CreateFrameBuffer("SceneFB", samples > 1 ? mSceneMultisample : mPipelineTexture[0], mSceneDepth, mSceneStencil, samples > 1); } else { - mSceneDepthStencil = CreateRenderBuffer(GL_DEPTH24_STENCIL8, samples, width, height); - mSceneFB = CreateFrameBuffer(samples > 1 ? mSceneMultisample : mPipelineTexture[0], mSceneDepthStencil, samples > 1); + mSceneDepthStencil = CreateRenderBuffer("SceneDepthStencil", GL_DEPTH24_STENCIL8, samples, width, height); + mSceneFB = CreateFrameBuffer("SceneFB", samples > 1 ? mSceneMultisample : mPipelineTexture[0], mSceneDepthStencil, samples > 1); } } @@ -222,8 +223,8 @@ void FGLRenderBuffers::CreatePipeline(int width, int height) for (int i = 0; i < NumPipelineTextures; i++) { - mPipelineTexture[i] = Create2DTexture(GetHdrFormat(), width, height); - mPipelineFB[i] = CreateFrameBuffer(mPipelineTexture[i]); + mPipelineTexture[i] = Create2DTexture("PipelineTexture", GetHdrFormat(), width, height); + mPipelineFB[i] = CreateFrameBuffer("PipelineFB", mPipelineTexture[i]); } } @@ -249,10 +250,10 @@ void FGLRenderBuffers::CreateBloom(int width, int height) level.Width = MAX(bloomWidth / 2, 1); level.Height = MAX(bloomHeight / 2, 1); - level.VTexture = Create2DTexture(GetHdrFormat(), level.Width, level.Height); - level.HTexture = Create2DTexture(GetHdrFormat(), level.Width, level.Height); - level.VFramebuffer = CreateFrameBuffer(level.VTexture); - level.HFramebuffer = CreateFrameBuffer(level.HTexture); + level.VTexture = Create2DTexture("Bloom.VTexture", GetHdrFormat(), level.Width, level.Height); + level.HTexture = Create2DTexture("Bloom.HTexture", GetHdrFormat(), level.Width, level.Height); + level.VFramebuffer = CreateFrameBuffer("Bloom.VFramebuffer", level.VTexture); + level.HFramebuffer = CreateFrameBuffer("Bloom.HFramebuffer", level.HTexture); bloomWidth = level.Width; bloomHeight = level.Height; @@ -276,12 +277,13 @@ GLuint FGLRenderBuffers::GetHdrFormat() // //========================================================================== -GLuint FGLRenderBuffers::Create2DTexture(GLuint format, int width, int height) +GLuint FGLRenderBuffers::Create2DTexture(const FString &name, GLuint format, int width, int height) { GLuint type = (format == GL_RGBA16) ? GL_UNSIGNED_SHORT : GL_UNSIGNED_BYTE; GLuint handle = 0; glGenTextures(1, &handle); glBindTexture(GL_TEXTURE_2D, handle); + FGLDebug::LabelObject(GL_TEXTURE, handle, name); glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, GL_RGBA, type, nullptr); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -296,23 +298,25 @@ GLuint FGLRenderBuffers::Create2DTexture(GLuint format, int width, int height) // //========================================================================== -GLuint FGLRenderBuffers::CreateRenderBuffer(GLuint format, int width, int height) +GLuint FGLRenderBuffers::CreateRenderBuffer(const FString &name, GLuint format, int width, int height) { GLuint handle = 0; glGenRenderbuffers(1, &handle); glBindRenderbuffer(GL_RENDERBUFFER, handle); + FGLDebug::LabelObject(GL_RENDERBUFFER, handle, name); glRenderbufferStorage(GL_RENDERBUFFER, format, width, height); return handle; } -GLuint FGLRenderBuffers::CreateRenderBuffer(GLuint format, int samples, int width, int height) +GLuint FGLRenderBuffers::CreateRenderBuffer(const FString &name, GLuint format, int samples, int width, int height) { if (samples <= 1) - return CreateRenderBuffer(format, width, height); + return CreateRenderBuffer(name, format, width, height); GLuint handle = 0; glGenRenderbuffers(1, &handle); glBindRenderbuffer(GL_RENDERBUFFER, handle); + FGLDebug::LabelObject(GL_RENDERBUFFER, handle, name); glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, format, width, height); return handle; } @@ -323,22 +327,24 @@ GLuint FGLRenderBuffers::CreateRenderBuffer(GLuint format, int samples, int widt // //========================================================================== -GLuint FGLRenderBuffers::CreateFrameBuffer(GLuint colorbuffer) +GLuint FGLRenderBuffers::CreateFrameBuffer(const FString &name, GLuint colorbuffer) { GLuint handle = 0; glGenFramebuffers(1, &handle); glBindFramebuffer(GL_FRAMEBUFFER, handle); + FGLDebug::LabelObject(GL_FRAMEBUFFER, handle, name); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorbuffer, 0); CheckFrameBufferCompleteness(); ClearFrameBuffer(); return handle; } -GLuint FGLRenderBuffers::CreateFrameBuffer(GLuint colorbuffer, GLuint depthstencil, bool colorIsARenderBuffer) +GLuint FGLRenderBuffers::CreateFrameBuffer(const FString &name, GLuint colorbuffer, GLuint depthstencil, bool colorIsARenderBuffer) { GLuint handle = 0; glGenFramebuffers(1, &handle); glBindFramebuffer(GL_FRAMEBUFFER, handle); + FGLDebug::LabelObject(GL_FRAMEBUFFER, handle, name); if (colorIsARenderBuffer) glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorbuffer); else @@ -349,11 +355,12 @@ GLuint FGLRenderBuffers::CreateFrameBuffer(GLuint colorbuffer, GLuint depthstenc return handle; } -GLuint FGLRenderBuffers::CreateFrameBuffer(GLuint colorbuffer, GLuint depth, GLuint stencil, bool colorIsARenderBuffer) +GLuint FGLRenderBuffers::CreateFrameBuffer(const FString &name, GLuint colorbuffer, GLuint depth, GLuint stencil, bool colorIsARenderBuffer) { GLuint handle = 0; glGenFramebuffers(1, &handle); glBindFramebuffer(GL_FRAMEBUFFER, handle); + FGLDebug::LabelObject(GL_FRAMEBUFFER, handle, name); if (colorIsARenderBuffer) glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorbuffer); else diff --git a/src/gl/renderer/gl_renderbuffers.h b/src/gl/renderer/gl_renderbuffers.h index 0a604766d2..9402d93968 100644 --- a/src/gl/renderer/gl_renderbuffers.h +++ b/src/gl/renderer/gl_renderbuffers.h @@ -47,12 +47,12 @@ private: void CreateScene(int width, int height, int samples); void CreatePipeline(int width, int height); void CreateBloom(int width, int height); - GLuint Create2DTexture(GLuint format, int width, int height); - GLuint CreateRenderBuffer(GLuint format, int width, int height); - GLuint CreateRenderBuffer(GLuint format, int samples, int width, int height); - GLuint CreateFrameBuffer(GLuint colorbuffer); - GLuint CreateFrameBuffer(GLuint colorbuffer, GLuint depthstencil, bool colorIsARenderBuffer); - GLuint CreateFrameBuffer(GLuint colorbuffer, GLuint depth, GLuint stencil, bool colorIsARenderBuffer); + GLuint Create2DTexture(const FString &name, GLuint format, int width, int height); + GLuint CreateRenderBuffer(const FString &name, GLuint format, int width, int height); + GLuint CreateRenderBuffer(const FString &name, GLuint format, int samples, int width, int height); + GLuint CreateFrameBuffer(const FString &name, GLuint colorbuffer); + GLuint CreateFrameBuffer(const FString &name, GLuint colorbuffer, GLuint depthstencil, bool colorIsARenderBuffer); + GLuint CreateFrameBuffer(const FString &name, GLuint colorbuffer, GLuint depth, GLuint stencil, bool colorIsARenderBuffer); void CheckFrameBufferCompleteness(); void ClearFrameBuffer(); void DeleteTexture(GLuint &handle); diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index 8c4baee602..9d2276b527 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -54,6 +54,7 @@ #include "gl/system/gl_interface.h" #include "gl/system/gl_framebuffer.h" #include "gl/system/gl_cvars.h" +#include "gl/system/gl_debug.h" #include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_lightdata.h" #include "gl/renderer/gl_renderstate.h" @@ -131,6 +132,7 @@ void FGLRenderer::Initialize(int width, int height) { glGenVertexArrays(1, &mVAOID); glBindVertexArray(mVAOID); + FGLDebug::LabelObject(GL_VERTEX_ARRAY, mVAOID, "FGLRenderer.mVAOID"); } else mVAOID = 0; @@ -366,9 +368,13 @@ void FGLRenderer::FlushTextures() bool FGLRenderer::StartOffscreen() { - if (mFBID == 0) glGenFramebuffers(1, &mFBID); + bool firstBind = (mFBID == 0); + if (mFBID == 0) + glGenFramebuffers(1, &mFBID); glGetIntegerv(GL_FRAMEBUFFER_BINDING, &mOldFBID); glBindFramebuffer(GL_FRAMEBUFFER, mFBID); + if (firstBind) + FGLDebug::LabelObject(GL_FRAMEBUFFER, mFBID, "OffscreenFB"); return true; } diff --git a/src/gl/shaders/gl_shader.cpp b/src/gl/shaders/gl_shader.cpp index cce8c6563a..d0cc5ef3f3 100644 --- a/src/gl/shaders/gl_shader.cpp +++ b/src/gl/shaders/gl_shader.cpp @@ -50,6 +50,7 @@ #include "cmdlib.h" #include "gl/system/gl_interface.h" +#include "gl/system/gl_debug.h" #include "gl/data/gl_data.h" #include "gl/data/gl_matrix.h" #include "gl/renderer/gl_renderer.h" @@ -179,6 +180,8 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char * hVertProg = glCreateShader(GL_VERTEX_SHADER); hFragProg = glCreateShader(GL_FRAGMENT_SHADER); + FGLDebug::LabelObject(GL_SHADER, hVertProg, vert_prog_lump); + FGLDebug::LabelObject(GL_SHADER, hFragProg, frag_prog_lump); int vp_size = (int)vp_comb.Len(); int fp_size = (int)fp_comb.Len(); @@ -193,6 +196,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char * glCompileShader(hFragProg); hShader = glCreateProgram(); + FGLDebug::LabelObject(GL_PROGRAM, hShader, name); glAttachShader(hShader, hVertProg); glAttachShader(hShader, hFragProg); diff --git a/src/gl/shaders/gl_shaderprogram.cpp b/src/gl/shaders/gl_shaderprogram.cpp index bed4a2e295..63ce092614 100644 --- a/src/gl/shaders/gl_shaderprogram.cpp +++ b/src/gl/shaders/gl_shaderprogram.cpp @@ -46,6 +46,7 @@ #include "vectors.h" #include "gl/system/gl_interface.h" #include "gl/system/gl_cvars.h" +#include "gl/system/gl_debug.h" #include "gl/shaders/gl_shaderprogram.h" #include "w_wad.h" #include "i_system.h" @@ -107,6 +108,8 @@ void FShaderProgram::Compile(ShaderType type, const char *name, const FString &c const auto &handle = mShaders[type]; + FGLDebug::LabelObject(GL_SHADER, handle, name); + FString patchedCode = PatchShader(type, code, defines, maxGlslVersion); int lengths[1] = { (int)patchedCode.Len() }; const char *sources[1] = { patchedCode.GetChars() }; @@ -147,6 +150,7 @@ void FShaderProgram::SetFragDataLocation(int index, const char *name) void FShaderProgram::Link(const char *name) { + FGLDebug::LabelObject(GL_PROGRAM, mProgram, name); glLinkProgram(mProgram); GLint status = 0; diff --git a/src/gl/system/gl_debug.cpp b/src/gl/system/gl_debug.cpp index 984893ddc0..3653567522 100644 --- a/src/gl/system/gl_debug.cpp +++ b/src/gl/system/gl_debug.cpp @@ -63,6 +63,52 @@ void FGLDebug::Update() OutputMessageLog(); } +//----------------------------------------------------------------------------- +// +// Label objects so they are referenced by name in debug messages and in +// OpenGL debuggers (renderdoc) +// +//----------------------------------------------------------------------------- + +void FGLDebug::LabelObject(GLenum type, GLuint handle, const FString &name) +{ + if (gl_debug_level != 0) + { + glObjectLabel(type, handle, (GLsizei)name.Len(), name.GetChars()); + } +} + +void FGLDebug::LabelObjectPtr(void *ptr, const FString &name) +{ + if (gl_debug_level != 0) + { + glObjectPtrLabel(ptr, (GLsizei)name.Len(), name.GetChars()); + } +} + +//----------------------------------------------------------------------------- +// +// Marks which render pass/group is executing commands so that debuggers can +// display this information +// +//----------------------------------------------------------------------------- + +void FGLDebug::PushGroup(const FString &name) +{ + if (gl_debug_level != 0) + { + glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, (GLsizei)name.Len(), name.GetChars()); + } +} + +void FGLDebug::PopGroup() +{ + if (gl_debug_level != 0) + { + glPopDebugGroup(); + } +} + //----------------------------------------------------------------------------- // // Turns on synchronous debugging on and off based on gl_debug_breakpoint @@ -160,6 +206,9 @@ void FGLDebug::OutputMessageLog() void FGLDebug::PrintMessage(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message) { + if (type == GL_DEBUG_TYPE_PUSH_GROUP || type == GL_DEBUG_TYPE_POP_GROUP) + return; + static int messagesPrinted = 0; messagesPrinted++; if (messagesPrinted == 50) diff --git a/src/gl/system/gl_debug.h b/src/gl/system/gl_debug.h index ce919cebd3..2401ba5cc4 100644 --- a/src/gl/system/gl_debug.h +++ b/src/gl/system/gl_debug.h @@ -11,6 +11,12 @@ class FGLDebug public: void Update(); + static void LabelObject(GLenum type, GLuint handle, const FString &name); + static void LabelObjectPtr(void *ptr, const FString &name); + + static void PushGroup(const FString &name); + static void PopGroup(); + private: void SetupBreakpointMode(); void UpdateLoggingLevel(); diff --git a/src/gl/system/gl_wipe.cpp b/src/gl/system/gl_wipe.cpp index c6c09b5519..0fbf3cd140 100644 --- a/src/gl/system/gl_wipe.cpp +++ b/src/gl/system/gl_wipe.cpp @@ -153,7 +153,7 @@ bool OpenGLFrameBuffer::WipeStartScreen(int type) const auto &viewport = GLRenderer->mScreenViewport; wipestartscreen = new FHardwareTexture(viewport.width, viewport.height, true); - wipestartscreen->CreateTexture(NULL, viewport.width, viewport.height, 0, false, 0); + wipestartscreen->CreateTexture(NULL, viewport.width, viewport.height, 0, false, 0, "WipeStartScreen"); GLRenderer->mSamplerManager->Bind(0, CLAMP_NOFILTER, -1); GLRenderer->mSamplerManager->Bind(1, CLAMP_NONE, -1); glFinish(); @@ -193,7 +193,7 @@ void OpenGLFrameBuffer::WipeEndScreen() const auto &viewport = GLRenderer->mScreenViewport; wipeendscreen = new FHardwareTexture(viewport.width, viewport.height, true); - wipeendscreen->CreateTexture(NULL, viewport.width, viewport.height, 0, false, 0); + wipeendscreen->CreateTexture(NULL, viewport.width, viewport.height, 0, false, 0, "WipeEndScreen"); GLRenderer->mSamplerManager->Bind(0, CLAMP_NOFILTER, -1); glFinish(); wipeendscreen->Bind(0, false, false); @@ -565,7 +565,7 @@ bool OpenGLFrameBuffer::Wiper_Burn::Run(int ticks, OpenGLFrameBuffer *fb) // Burn the new screen on top of it. fb->wipeendscreen->Bind(0, 0, false); - BurnTexture->CreateTexture(rgb_buffer, WIDTH, HEIGHT, 1, true, 0); + BurnTexture->CreateTexture(rgb_buffer, WIDTH, HEIGHT, 1, true, 0, "BurnTexture"); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); gl_RenderState.SetEffect(EFF_NONE); diff --git a/src/gl/textures/gl_hwtexture.cpp b/src/gl/textures/gl_hwtexture.cpp index 7d9d754fd9..73c4e7b36e 100644 --- a/src/gl/textures/gl_hwtexture.cpp +++ b/src/gl/textures/gl_hwtexture.cpp @@ -48,6 +48,7 @@ #include "gl/system/gl_interface.h" #include "gl/system/gl_cvars.h" +#include "gl/system/gl_debug.h" #include "gl/renderer/gl_renderer.h" #include "gl/textures/gl_material.h" @@ -184,7 +185,7 @@ void FHardwareTexture::Resize(int width, int height, unsigned char *src_data, un // //=========================================================================== -unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int h, int texunit, bool mipmap, int translation) +unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int h, int texunit, bool mipmap, int translation, const FString &name) { int rh,rw; int texformat=TexFormat[gl_texture_format]; @@ -198,6 +199,7 @@ unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int if (glTex->glTexID==0) glGenTextures(1,&glTex->glTexID); if (texunit != 0) glActiveTexture(GL_TEXTURE0+texunit); glBindTexture(GL_TEXTURE_2D, glTex->glTexID); + FGLDebug::LabelObject(GL_TEXTURE, glTex->glTexID, name); lastbound[texunit] = glTex->glTexID; if (!buffer) diff --git a/src/gl/textures/gl_hwtexture.h b/src/gl/textures/gl_hwtexture.h index 6b01fb437c..9b7028f8cd 100644 --- a/src/gl/textures/gl_hwtexture.h +++ b/src/gl/textures/gl_hwtexture.h @@ -77,7 +77,7 @@ public: void BindToFrameBuffer(); unsigned int Bind(int texunit, int translation, bool needmipmap); - unsigned int CreateTexture(unsigned char * buffer, int w, int h, int texunit, bool mipmap, int translation); + unsigned int CreateTexture(unsigned char * buffer, int w, int h, int texunit, bool mipmap, int translation, const FString &name); void Clean(bool all); void CleanUnused(SpriteHits &usedtranslations); diff --git a/src/gl/textures/gl_material.cpp b/src/gl/textures/gl_material.cpp index 6a579b0d53..8e0ab73e69 100644 --- a/src/gl/textures/gl_material.cpp +++ b/src/gl/textures/gl_material.cpp @@ -337,7 +337,7 @@ const FHardwareTexture *FGLTexture::Bind(int texunit, int clampmode, int transla } tex->ProcessData(buffer, w, h, false); } - if (!hwtex->CreateTexture(buffer, w, h, texunit, needmipmap, translation)) + if (!hwtex->CreateTexture(buffer, w, h, texunit, needmipmap, translation, "FGLTexture.Bind")) { // could not create texture delete[] buffer; diff --git a/src/gl/textures/gl_samplers.cpp b/src/gl/textures/gl_samplers.cpp index cee2fd894f..64674e63c8 100644 --- a/src/gl/textures/gl_samplers.cpp +++ b/src/gl/textures/gl_samplers.cpp @@ -42,6 +42,7 @@ #include "gl/system/gl_interface.h" #include "gl/system/gl_cvars.h" +#include "gl/system/gl_debug.h" #include "gl/renderer/gl_renderer.h" #include "gl_samplers.h" #include "gl_material.h" @@ -67,6 +68,13 @@ FSamplerManager::FSamplerManager() glSamplerParameteri(mSamplers[3], GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glSamplerParameteri(mSamplers[4], GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glSamplerParameteri(mSamplers[4], GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + for (int i = 0; i < 7; i++) + { + FString name; + name.Format("mSamplers[%d]", i); + FGLDebug::LabelObject(GL_SAMPLER, mSamplers[i], name); + } } }