浏览代码

added debug-event-markers for opengl so that you're able to set markers for renderdoc or other gpu debuggers what your program is currently doing

pull/420/head
user 7 年前
父节点
当前提交
0e18b14605
共有 3 个文件被更改,包括 36 次插入0 次删除
  1. +25
    -0
      src/external/glad.h
  2. +8
    -0
      src/rlgl.c
  3. +3
    -0
      src/rlgl.h

+ 25
- 0
src/external/glad.h 查看文件

@ -3446,6 +3446,19 @@ typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC)(GLenum sfactorRGB, GLenum
GLAPI PFNGLBLENDFUNCSEPARATEEXTPROC glad_glBlendFuncSeparateEXT;
#define glBlendFuncSeparateEXT glad_glBlendFuncSeparateEXT
#endif
#ifndef GL_EXT_debug_marker
#define GL_EXT_debug_marker 1
GLAPI int GLAD_GL_EXT_debug_marker;
typedef void (APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC)(GLsizei length, const GLchar *marker);
GLAPI PFNGLINSERTEVENTMARKEREXTPROC glad_glInsertEventMarkerEXT;
#define glInsertEventMarkerEXT glad_glInsertEventMarkerEXT
typedef void (APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC)(GLsizei length, const GLchar *marker);
GLAPI PFNGLPUSHGROUPMARKEREXTPROC glad_glPushGroupMarkerEXT;
#define glPushGroupMarkerEXT glad_glPushGroupMarkerEXT
typedef void (APIENTRYP PFNGLPOPGROUPMARKEREXTPROC)(void);
GLAPI PFNGLPOPGROUPMARKEREXTPROC glad_glPopGroupMarkerEXT;
#define glPopGroupMarkerEXT glad_glPopGroupMarkerEXT
#endif
#ifndef GL_EXT_framebuffer_blit
#define GL_EXT_framebuffer_blit 1
GLAPI int GLAD_GL_EXT_framebuffer_blit;
@ -4209,6 +4222,7 @@ int GLAD_GL_ARB_vertex_shader;
int GLAD_GL_ARB_vertex_attrib_binding;
int GLAD_GL_ARB_vertex_program;
int GLAD_GL_EXT_texture_compression_s3tc;
int GLAD_GL_EXT_debug_marker;
int GLAD_GL_EXT_texture_swizzle;
int GLAD_GL_ARB_texture_multisample;
int GLAD_GL_ARB_texture_rg;
@ -4391,6 +4405,9 @@ PFNGLGETVARIANTARRAYOBJECTIVATIPROC glad_glGetVariantArrayObjectivATI;
PFNGLBLENDCOLOREXTPROC glad_glBlendColorEXT;
PFNGLBLENDEQUATIONSEPARATEEXTPROC glad_glBlendEquationSeparateEXT;
PFNGLBLENDFUNCSEPARATEEXTPROC glad_glBlendFuncSeparateEXT;
PFNGLINSERTEVENTMARKEREXTPROC glad_glInsertEventMarkerEXT;
PFNGLPUSHGROUPMARKEREXTPROC glad_glPushGroupMarkerEXT;
PFNGLPOPGROUPMARKEREXTPROC glad_glPopGroupMarkerEXT;
PFNGLBLITFRAMEBUFFEREXTPROC glad_glBlitFramebufferEXT;
PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glad_glRenderbufferStorageMultisampleEXT;
PFNGLISRENDERBUFFEREXTPROC glad_glIsRenderbufferEXT;
@ -5190,6 +5207,12 @@ static void load_GL_EXT_blend_func_separate(GLADloadproc load) {
if(!GLAD_GL_EXT_blend_func_separate) return;
glad_glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC)load("glBlendFuncSeparateEXT");
}
static void load_GL_EXT_debug_marker(GLADloadproc load) {
if(!GLAD_GL_EXT_debug_marker) return;
glad_glInsertEventMarkerEXT = (PFNGLINSERTEVENTMARKEREXTPROC)load("glInsertEventMarkerEXT");
glad_glPushGroupMarkerEXT = (PFNGLPUSHGROUPMARKEREXTPROC)load("glPushGroupMarkerEXT");
glad_glPopGroupMarkerEXT = (PFNGLPOPGROUPMARKEREXTPROC)load("glPopGroupMarkerEXT");
}
static void load_GL_EXT_framebuffer_blit(GLADloadproc load) {
if(!GLAD_GL_EXT_framebuffer_blit) return;
glad_glBlitFramebufferEXT = (PFNGLBLITFRAMEBUFFEREXTPROC)load("glBlitFramebufferEXT");
@ -5316,6 +5339,7 @@ static int find_extensionsGL(void) {
GLAD_GL_EXT_blend_color = has_ext("GL_EXT_blend_color");
GLAD_GL_EXT_blend_equation_separate = has_ext("GL_EXT_blend_equation_separate");
GLAD_GL_EXT_blend_func_separate = has_ext("GL_EXT_blend_func_separate");
GLAD_GL_EXT_debug_marker = has_ext("GL_EXT_debug_marker");
GLAD_GL_EXT_framebuffer_blit = has_ext("GL_EXT_framebuffer_blit");
GLAD_GL_EXT_framebuffer_multisample = has_ext("GL_EXT_framebuffer_multisample");
GLAD_GL_EXT_framebuffer_multisample_blit_scaled = has_ext("GL_EXT_framebuffer_multisample_blit_scaled");
@ -5430,6 +5454,7 @@ int gladLoadGLLoader(GLADloadproc load) {
load_GL_EXT_blend_color(load);
load_GL_EXT_blend_equation_separate(load);
load_GL_EXT_blend_func_separate(load);
load_GL_EXT_debug_marker(load);
load_GL_EXT_framebuffer_blit(load);
load_GL_EXT_framebuffer_multisample(load);
load_GL_EXT_framebuffer_object(load);

+ 8
- 0
src/rlgl.c 查看文件

@ -307,6 +307,8 @@ static PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays;
//static PFNGLISVERTEXARRAYOESPROC glIsVertexArray; // NOTE: Fails in WebGL, omitted
#endif
static bool debugMarkerSupported = false;
// Compressed textures support flags
static bool texCompDXTSupported = false; // DDS texture compression support
static bool texNPOTSupported = false; // NPOT textures full support
@ -1135,6 +1137,10 @@ void rlglInit(int width, int height)
glGetFloatv(0x84FF, &maxAnisotropicLevel); // GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
}
if(strcmp(extList[i], (const char *)"GL_EXT_debug_marker") == 0) {
debugMarkerSupported = true;
}
// Clamp mirror wrap mode supported
if (strcmp(extList[i], (const char *)"GL_EXT_texture_mirror_clamp") == 0) texClampMirrorSupported = true;
}
@ -1160,6 +1166,8 @@ void rlglInit(int width, int height)
if (texAnisotropicFilterSupported) TraceLog(LOG_INFO, "[EXTENSION] Anisotropic textures filtering supported (max: %.0fX)", maxAnisotropicLevel);
if (texClampMirrorSupported) TraceLog(LOG_INFO, "[EXTENSION] Clamp mirror wrap texture mode supported");
if (debugMarkerSupported) TraceLog(LOG_INFO, "[EXTENSION] Debug Marker supported");
// Initialize buffers, default shaders and default textures
//----------------------------------------------------------

+ 3
- 0
src/rlgl.h 查看文件

@ -440,6 +440,9 @@ void rlUpdateMesh(Mesh mesh, int buffer, int numVertex); // Update ve
void rlDrawMesh(Mesh mesh, Material material, Matrix transform); // Draw a 3d mesh with material and transform
void rlUnloadMesh(Mesh *mesh); // Unload mesh data from CPU and GPU
// Debug Marker for Analysis
void rlSetMarker(const char *text);
// NOTE: There is a set of shader related functions that are available to end user,
// to avoid creating function wrappers through core module, they have been directly declared in raylib.h

正在加载...
取消
保存