diff --git a/MobileGL/Defines.h b/MobileGL/Defines.h index ea85b845..0a671d58 100644 --- a/MobileGL/Defines.h +++ b/MobileGL/Defines.h @@ -43,6 +43,7 @@ #define MOBILEGL_LOG_ENABLE_CONSOLE 0 #define MOBILEGL_LOG_ENABLE_FILE 1 #define MOBILEGL_LOG_ENABLE_ANDROID 1 +#define MOBILEGL_ENABLE_SCOPE_MARKER 1 // Require C++23 // Clang/Android NDK still doesn't have support for that :( diff --git a/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp b/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp index 31f7315b..640dc33a 100644 --- a/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp +++ b/MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp @@ -597,6 +597,9 @@ namespace MobileGL::MG_Backend::DirectGLES { } void Clear(GLbitfield mask) { +#if MOBILEGL_LOG_ACTIVE_LEVEL <= MOBILEGL_LOG_LEVEL_DEBUG && MOBILEGL_ENABLE_SCOPE_MARKER + DebugImpl::OpenGLScopeMarker marker(__func__); +#endif TextureImpl::SyncNeccessaryTextures(); FramebufferImpl::SyncCurrentFBO(); RenderStateImpl::SyncRenderState(); @@ -607,18 +610,27 @@ namespace MobileGL::MG_Backend::DirectGLES { } void DrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices) { +#if MOBILEGL_LOG_ACTIVE_LEVEL <= MOBILEGL_LOG_LEVEL_DEBUG && MOBILEGL_ENABLE_SCOPE_MARKER + DebugImpl::OpenGLScopeMarker marker(__func__); +#endif DrawSyncBit syncBit = DrawSyncBit::IndexBuffer; PrepareForDraw(syncBit); MG_External::GLES::glDrawElements(mode, count, type, indices); } void DrawArrays(GLenum mode, GLint first, GLsizei count) { +#if MOBILEGL_LOG_ACTIVE_LEVEL <= MOBILEGL_LOG_LEVEL_DEBUG && MOBILEGL_ENABLE_SCOPE_MARKER + DebugImpl::OpenGLScopeMarker marker(__func__); +#endif DrawSyncBit syncBit = DrawSyncBit::None; PrepareForDraw(syncBit); MG_External::GLES::glDrawArrays(mode, first, count); } void DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLint basevertex) { +#if MOBILEGL_LOG_ACTIVE_LEVEL <= MOBILEGL_LOG_LEVEL_DEBUG && MOBILEGL_ENABLE_SCOPE_MARKER + DebugImpl::OpenGLScopeMarker marker(__func__); +#endif DrawSyncBit syncBit = DrawSyncBit::IndexBuffer; PrepareForDraw(syncBit); MG_External::GLES::glDrawElementsBaseVertex(mode, count, type, indices, basevertex); @@ -626,6 +638,9 @@ namespace MobileGL::MG_Backend::DirectGLES { void MultiDrawElements(GLenum mode, const GLsizei* count, GLenum type, const GLvoid* const* indices, GLsizei drawcount) { +#if MOBILEGL_LOG_ACTIVE_LEVEL <= MOBILEGL_LOG_LEVEL_DEBUG && MOBILEGL_ENABLE_SCOPE_MARKER + DebugImpl::OpenGLScopeMarker marker(__func__); +#endif DrawSyncBit syncBit = DrawSyncBit::IndexBuffer; PrepareForDraw(syncBit); @@ -636,6 +651,9 @@ namespace MobileGL::MG_Backend::DirectGLES { void MultiDrawElementsBaseVertex(GLenum mode, const GLsizei* count, GLenum type, const GLvoid* const* indices, GLsizei drawcount, const GLint* basevertex) { +#if MOBILEGL_LOG_ACTIVE_LEVEL <= MOBILEGL_LOG_LEVEL_DEBUG && MOBILEGL_ENABLE_SCOPE_MARKER + DebugImpl::OpenGLScopeMarker marker(__func__); +#endif DrawSyncBit syncBit = DrawSyncBit::IndexBuffer; PrepareForDraw(syncBit); @@ -645,6 +663,9 @@ namespace MobileGL::MG_Backend::DirectGLES { } void MultiDrawElementsIndirect(GLenum mode, GLenum type, const void* indirect, GLsizei drawcount, GLsizei stride) { +#if MOBILEGL_LOG_ACTIVE_LEVEL <= MOBILEGL_LOG_LEVEL_DEBUG && MOBILEGL_ENABLE_SCOPE_MARKER + DebugImpl::OpenGLScopeMarker marker(__func__); +#endif DrawSyncBit syncBit = DrawSyncBit::IndexBuffer | DrawSyncBit::IndirectBuffer; PrepareForDraw(syncBit); @@ -656,6 +677,9 @@ namespace MobileGL::MG_Backend::DirectGLES { } void MultiDrawArraysIndirect(GLenum mode, const void* indirect, GLsizei drawcount, GLsizei stride) { +#if MOBILEGL_LOG_ACTIVE_LEVEL <= MOBILEGL_LOG_LEVEL_DEBUG && MOBILEGL_ENABLE_SCOPE_MARKER + DebugImpl::OpenGLScopeMarker marker(__func__); +#endif DrawSyncBit syncBit = DrawSyncBit::IndirectBuffer; PrepareForDraw(syncBit); @@ -730,6 +754,9 @@ namespace MobileGL::MG_Backend::DirectGLES { void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { +#if MOBILEGL_LOG_ACTIVE_LEVEL <= MOBILEGL_LOG_LEVEL_DEBUG && MOBILEGL_ENABLE_SCOPE_MARKER + DebugImpl::OpenGLScopeMarker marker(__func__); +#endif DebugImpl::ErrorLopper errorLopper; TextureImpl::SyncNeccessaryTextures(); @@ -891,6 +918,9 @@ namespace MobileGL::MG_Backend::DirectGLES { void CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { +#if MOBILEGL_LOG_ACTIVE_LEVEL <= MOBILEGL_LOG_LEVEL_DEBUG && MOBILEGL_ENABLE_SCOPE_MARKER + DebugImpl::OpenGLScopeMarker marker(__func__); +#endif DebugImpl::ErrorLopper errorLopper; MGLOG_D("%s: Backend", __func__); @@ -968,6 +998,9 @@ namespace MobileGL::MG_Backend::DirectGLES { } void GenerateMipmap(GLenum target) { +#if MOBILEGL_LOG_ACTIVE_LEVEL <= MOBILEGL_LOG_LEVEL_DEBUG && MOBILEGL_ENABLE_SCOPE_MARKER + DebugImpl::OpenGLScopeMarker marker(__func__); +#endif auto unitIndex = MG_State::pGLContext->GetActiveTextureUnit(); auto& unit = MG_State::pGLContext->GetTextureUnitObject(unitIndex); auto& slot = unit.GetBindingSlot(MG_Util::ConvertGLEnumToTextureTarget(target));