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.
This commit is contained in:
parent
330f7da746
commit
ec621a00bd
@ -138,9 +138,9 @@ as extensions until they become obsolete.
|
|||||||
|
|
||||||
An extension is defined by:
|
An extension is defined by:
|
||||||
|
|
||||||
- An extension name (e.g. `GL_ARB_debug_output`)
|
- An extension name (e.g. `GL_ARB_gl_spirv`)
|
||||||
- New OpenGL tokens (e.g. `GL_DEBUG_SEVERITY_HIGH_ARB`)
|
- New OpenGL tokens (e.g. `GL_SPIR_V_BINARY_ARB`)
|
||||||
- New OpenGL functions (e.g. `glGetDebugMessageLogARB`)
|
- New OpenGL functions (e.g. `glSpecializeShaderARB`)
|
||||||
|
|
||||||
Note the `ARB` affix, which stands for Architecture Review Board and is used
|
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
|
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.
|
booleans.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
if (GLAD_GL_ARB_debug_output)
|
if (GLAD_GL_ARB_gl_spirv)
|
||||||
{
|
{
|
||||||
// Use GL_ARB_debug_output
|
// Use GL_ARB_gl_spirv
|
||||||
}
|
}
|
||||||
@endcode
|
@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.
|
may not include the extensions you wish to use.
|
||||||
|
|
||||||
The header defines function pointer types for all functions of all extensions it
|
The header defines function pointer types for all functions of all extensions it
|
||||||
supports. These have names like `PFNGLGETDEBUGMESSAGELOGARBPROC` (for
|
supports. These have names like `PFNGLSPECIALIZESHADERARBPROC` (for
|
||||||
`glGetDebugMessageLogARB`), i.e. the name is made uppercase and `PFN` (pointer
|
`glSpecializeShaderARB`), i.e. the name is made uppercase and `PFN` (pointer
|
||||||
to function) and `PROC` (procedure) are added to the ends.
|
to function) and `PROC` (procedure) are added to the ends.
|
||||||
|
|
||||||
To include the extension header, define @ref GLFW_INCLUDE_GLEXT before including
|
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.
|
This is done with @ref glfwExtensionSupported.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
if (glfwExtensionSupported("GL_ARB_debug_output"))
|
if (glfwExtensionSupported("GL_ARB_gl_spirv"))
|
||||||
{
|
{
|
||||||
// The extension is supported by the current context
|
// 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.
|
retrieve pointers to these functions with @ref glfwGetProcAddress.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog = glfwGetProcAddress("glGetDebugMessageLogARB");
|
PFNGLSPECIALIZESHADERARBPROC pfnSpecializeShaderARB = glfwGetProcAddress("glSpecializeShaderARB");
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
In general, you should avoid giving the function pointer variables the (exact)
|
In general, you should avoid giving the function pointer variables the (exact)
|
||||||
@ -313,28 +313,28 @@ when used together.
|
|||||||
#define GLFW_INCLUDE_GLEXT
|
#define GLFW_INCLUDE_GLEXT
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
#define glGetDebugMessageLogARB pfnGetDebugMessageLog
|
#define glSpecializeShaderARB pfnSpecializeShaderARB
|
||||||
PFNGLGETDEBUGMESSAGELOGARBPROC pfnGetDebugMessageLog;
|
PFNGLSPECIALIZESHADERARBPROC pfnSpecializeShaderARB;
|
||||||
|
|
||||||
// Flag indicating whether the extension is supported
|
// Flag indicating whether the extension is supported
|
||||||
int has_ARB_debug_output = 0;
|
int has_ARB_gl_spirv = 0;
|
||||||
|
|
||||||
void load_extensions(void)
|
void load_extensions(void)
|
||||||
{
|
{
|
||||||
if (glfwExtensionSupported("GL_ARB_debug_output"))
|
if (glfwExtensionSupported("GL_ARB_gl_spirv"))
|
||||||
{
|
{
|
||||||
pfnGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGARBPROC)
|
pfnSpecializeShaderARB = (PFNGLSPECIALIZESHADERARBPROC)
|
||||||
glfwGetProcAddress("glGetDebugMessageLogARB");
|
glfwGetProcAddress("glSpecializeShaderARB");
|
||||||
has_ARB_debug_output = 1;
|
has_ARB_gl_spirv = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void some_function(void)
|
void some_function(void)
|
||||||
{
|
{
|
||||||
if (has_ARB_debug_output)
|
if (has_ARB_gl_spirv)
|
||||||
{
|
{
|
||||||
// Now the extension function can be called as usual
|
// Now the extension function can be called as usual
|
||||||
glGetDebugMessageLogARB(...);
|
glSpecializeShaderARB(...);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
Loading…
Reference in New Issue
Block a user