From ec621a00bd96cbc41a7e1f630adf155ae2d08267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 12 Apr 2021 00:00:40 +0200 Subject: [PATCH] Replace GL_ARB_debug_output in context guide New code should use GL_KHR_debug instead but it's not as good an example to use in this case as the symbols it adds has no suffixes. --- docs/context.dox | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/context.dox b/docs/context.dox index dd952122..c51e268c 100644 --- a/docs/context.dox +++ b/docs/context.dox @@ -138,9 +138,9 @@ as extensions until they become obsolete. An extension is defined by: -- An extension name (e.g. `GL_ARB_debug_output`) -- New OpenGL tokens (e.g. `GL_DEBUG_SEVERITY_HIGH_ARB`) -- New OpenGL functions (e.g. `glGetDebugMessageLogARB`) +- An extension name (e.g. `GL_ARB_gl_spirv`) +- New OpenGL tokens (e.g. `GL_SPIR_V_BINARY_ARB`) +- New OpenGL functions (e.g. `glSpecializeShaderARB`) Note the `ARB` affix, which stands for Architecture Review Board and is used for official extensions. The extension above was created by the ARB, but there @@ -225,9 +225,9 @@ To check whether a specific extension is supported, use the `GLAD_GL_xxx` booleans. @code -if (GLAD_GL_ARB_debug_output) +if (GLAD_GL_ARB_gl_spirv) { - // Use GL_ARB_debug_output + // Use GL_ARB_gl_spirv } @endcode @@ -259,8 +259,8 @@ included in your development environment may be several years out of date and may not include the extensions you wish to use. The header defines function pointer types for all functions of all extensions it -supports. These have names like `PFNGLGETDEBUGMESSAGELOGARBPROC` (for -`glGetDebugMessageLogARB`), i.e. the name is made uppercase and `PFN` (pointer +supports. These have names like `PFNGLSPECIALIZESHADERARBPROC` (for +`glSpecializeShaderARB`), i.e. the name is made uppercase and `PFN` (pointer to function) and `PROC` (procedure) are added to the ends. To include the extension header, define @ref GLFW_INCLUDE_GLEXT before including @@ -280,7 +280,7 @@ is necessary to check at run-time whether the context supports the extension. This is done with @ref glfwExtensionSupported. @code -if (glfwExtensionSupported("GL_ARB_debug_output")) +if (glfwExtensionSupported("GL_ARB_gl_spirv")) { // The extension is supported by the current context } @@ -299,7 +299,7 @@ your operating system, making it necessary to fetch them at run time. You can retrieve pointers to these functions with @ref glfwGetProcAddress. @code -PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog = glfwGetProcAddress("glGetDebugMessageLogARB"); +PFNGLSPECIALIZESHADERARBPROC pfnSpecializeShaderARB = glfwGetProcAddress("glSpecializeShaderARB"); @endcode In general, you should avoid giving the function pointer variables the (exact) @@ -313,28 +313,28 @@ when used together. #define GLFW_INCLUDE_GLEXT #include -#define glGetDebugMessageLogARB pfnGetDebugMessageLog -PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog; +#define glSpecializeShaderARB pfnSpecializeShaderARB +PFNGLSPECIALIZESHADERARBPROC pfnSpecializeShaderARB; // Flag indicating whether the extension is supported -int has_ARB_debug_output = 0; +int has_ARB_gl_spirv = 0; void load_extensions(void) { - if (glfwExtensionSupported("GL_ARB_debug_output")) + if (glfwExtensionSupported("GL_ARB_gl_spirv")) { - pfnGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGARBPROC) - glfwGetProcAddress("glGetDebugMessageLogARB"); - has_ARB_debug_output = 1; + pfnSpecializeShaderARB = (PFNGLSPECIALIZESHADERARBPROC) + glfwGetProcAddress("glSpecializeShaderARB"); + has_ARB_gl_spirv = 1; } } void some_function(void) { - if (has_ARB_debug_output) + if (has_ARB_gl_spirv) { // Now the extension function can be called as usual - glGetDebugMessageLogARB(...); + glSpecializeShaderARB(...); } } @endcode