summaryrefslogtreecommitdiffstats
path: root/xbmc/utils/GLUtils.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
commitc04dcc2e7d834218ef2d4194331e383402495ae1 (patch)
tree7333e38d10d75386e60f336b80c2443c1166031d /xbmc/utils/GLUtils.h
parentInitial commit. (diff)
downloadkodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz
kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/utils/GLUtils.h')
-rw-r--r--xbmc/utils/GLUtils.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/xbmc/utils/GLUtils.h b/xbmc/utils/GLUtils.h
new file mode 100644
index 0000000..5c36030
--- /dev/null
+++ b/xbmc/utils/GLUtils.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+// GL Error checking macro
+// this function is useful for tracking down GL errors, which otherwise
+// just result in undefined behavior and can be difficult to track down.
+//
+// Just call it 'VerifyGLState()' after a sequence of GL calls
+//
+// if GL_DEBUGGING and HAS_GL are defined, the function checks
+// for GL errors and prints the current state of the various matrices;
+// if not it's just an empty inline stub, and thus won't affect performance
+// and will be optimized out.
+
+#include "system_gl.h"
+
+namespace KODI
+{
+namespace UTILS
+{
+namespace GL
+{
+void GlErrorCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam);
+
+int glFormatElementByteCount(GLenum format);
+
+enum class ColorChannel
+{
+ A,
+ R,
+ G,
+ B,
+};
+
+uint8_t GetChannelFromARGB(const ColorChannel colorChannel, const uint32_t argb);
+}
+}
+}
+
+void _VerifyGLState(const char* szfile, const char* szfunction, int lineno);
+#if defined(GL_DEBUGGING) && (defined(HAS_GL) || defined(HAS_GLES))
+#define VerifyGLState() _VerifyGLState(__FILE__, __FUNCTION__, __LINE__)
+#else
+#define VerifyGLState()
+#endif
+
+void LogGraphicsInfo();