Loading...
Searching...
No Matches
diagnostic.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_GLF_DIAGNOSTIC_H
8#define PXR_IMAGING_GLF_DIAGNOSTIC_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/imaging/glf/api.h"
14#include "pxr/imaging/garch/glApi.h"
16
17#include <string>
18#include <cstdint>
19
20PXR_NAMESPACE_OPEN_SCOPE
21
22
26#define GLF_POST_PENDING_GL_ERRORS() \
27 GlfPostPendingGLErrors(__ARCH_PRETTY_FUNCTION__, __LINE__)
28
30GLF_API
31void GlfPostPendingGLErrors(std::string const & where = std::string(), int line = 0);
32
35GLF_API
37
41GLF_API
43 GLenum source, GLenum type, GLuint id, GLenum severity,
44 GLsizei length, char const * message, GLvoid const * userParam);
45
47GLF_API
48char const * GlfDebugEnumToString(GLenum debugEnum);
49
51#define GLF_GROUP_FUNCTION() \
52 GlfDebugGroup __glf_group_function(__ARCH_PRETTY_FUNCTION__)
53
55#define GLF_GROUP_SCOPE(str) \
56 GlfDebugGroup __glf_group_scope(str)
57
68 public:
70 GLF_API
71 GlfDebugGroup(char const *message);
72
74 GLF_API
76
77 GlfDebugGroup() = delete;
78 GlfDebugGroup(GlfDebugGroup const&) = delete;
79 GlfDebugGroup& operator =(GlfDebugGroup const&) = delete;
80};
81
83GLF_API
84void GlfDebugLabelBuffer(GLuint id, char const *label);
85
87GLF_API
88void GlfDebugLabelShader(GLuint id, char const *label);
89
91GLF_API
92void GlfDebugLabelProgram(GLuint id, char const *label);
93
99public:
100 GLF_API
102 GLF_API
104
111 GLF_API
112 void Begin(GLenum target);
113
117 GLF_API
119
123 GLF_API
125
129 GLF_API
131
133 GLF_API
134 void End();
135
138 GLF_API
139 int64_t GetResult();
140
143 GLF_API
145
146 GlfGLQueryObject(GlfGLQueryObject const&) = delete;
147 GlfGLQueryObject& operator =(GlfGLQueryObject const&) = delete;
148private:
149 GLuint _id;
150 GLenum _target;
151};
152
153
154PXR_NAMESPACE_CLOSE_SCOPE
155
156#endif
Low-level utilities for informing users of various internal and external diagnostic conditions.
Represents a GL debug group in Glf.
Definition: diagnostic.h:67
GLF_API GlfDebugGroup(char const *message)
Pushes a new debug group onto the GL api debug trace stack.
GLF_API ~GlfDebugGroup()
Pops a debug group off the GL api debug trace stack.
Represents a GL query object in Glf.
Definition: diagnostic.h:98
GLF_API void BeginPrimitivesGenerated()
equivalent to Begin(GL_PRIMITIVES_GENERATED).
GLF_API void Begin(GLenum target)
Begin query for the given target target has to be one of GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED,...
GLF_API int64_t GetResult()
Return the query result (synchronous) stalls CPU until the result becomes available.
GLF_API int64_t GetResultNoWait()
Return the query result (asynchronous) returns 0 if the result hasn't been available.
GLF_API void End()
End query.
GLF_API void BeginSamplesPassed()
equivalent to Begin(GL_SAMPLES_PASSED).
GLF_API void BeginTimeElapsed()
equivalent to Begin(GL_TIME_ELAPSED).
GLF_API void GlfDebugLabelBuffer(GLuint id, char const *label)
Label a buffer object to improve tracing in the debug output.
GLF_API void GlfDebugLabelProgram(GLuint id, char const *label)
Label a program object to improve tracing in the debug output.
GLF_API char const * GlfDebugEnumToString(GLenum debugEnum)
Returns a string representation of debug output enum values.
GLF_API void GlfRegisterDefaultDebugOutputMessageCallback()
Registers GlfDefaultDebugOutputMessageCallback as the debug message callback for the current GL conte...
GLF_API void GlfDefaultDebugOutputMessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, char const *message, GLvoid const *userParam)
A GL debug output message callback method which posts diagnostic errors for messages of type DEBUG_TY...
GLF_API void GlfPostPendingGLErrors(std::string const &where=std::string(), int line=0)
Posts diagnostic errors for all GL errors in the current context.
GLF_API void GlfDebugLabelShader(GLuint id, char const *label)
Label a shader object to improve tracing in the debug output.