-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow adding debug annotations to OpenGL objects, as well as defining GPU "zones" to achieve functionality very similar to Tracy, but on the GPU. #1845
base: master
Are you sure you want to change the base?
Conversation
Companion game PR is: beyond-all-reason/Beyond-All-Reason#4054 |
GLenum identifier = (GLenum)luaL_checkinteger(L, 1); | ||
if (identifier != GL_BUFFER && identifier != GL_SHADER && identifier != GL_PROGRAM && | ||
identifier != GL_VERTEX_ARRAY && identifier != GL_QUERY && identifier != GL_PROGRAM_PIPELINE && | ||
identifier != GL_TRANSFORM_FEEDBACK && identifier != GL_TEXTURE && identifier != GL_RENDERBUFFER && | ||
identifier != GL_FRAMEBUFFER) { | ||
return 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this snippet in the gameside PR:
local GL_PROGRAM = 0x82E2
gl.ObjectLabel(GL_PROGRAM, gl_program_id, self.shaderName)
Sounds bad if the game needs to know those magic 0x82E2
constants to use the function. Would be good if there were either appropriate named constants in LuaConstGL.cpp
(GL.PROGRAM
etc) or if this accepted a string ("program" etc).
glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH, &maxLength); | ||
|
||
if (strlen(message) >= maxLength) { | ||
luaL_error(L, "Message length exceeds GL_MAX_DEBUG_MESSAGE_LENGTH"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps just trim the message to the appropriate length? Otherwise a portable way of preventing this error (GL.MAX_DEBUG_MESSAGE_LENGTH
lua constant?) would be nice.
// Check that the GLuint name refers to a valid openGL object | ||
// Check that the label is a valid string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these "check this, check that" comments mean that the code is WIP and those checks should be added?
@@ -64,7 +64,8 @@ bool LuaVBOs::PushEntries(lua_State* L) | |||
"UnbindBufferRange", &LuaVBOImpl::UnbindBufferRange, | |||
|
|||
"DumpDefinition", &LuaVBOImpl::DumpDefinition, | |||
"GetBufferSize", &LuaVBOImpl::GetBufferSize | |||
"GetBufferSize", &LuaVBOImpl::GetBufferSize, | |||
"GetID", &LuaVBOImpl::GetID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice if there were getters for every relevant object type.
Implements #1833
Assists in assigning OpenGL id's to actual human readable names in performance debuggging.
IMPORTANT nVidia nSight 2022.04 was the only version that reliably worked for me.
New callouts:
gl.ObjectLabel(objectTypeIdentifier, objectID, name)
gl.PushDebugGroup(objectID, name, bool thirdparty = false)
gl.PopDebugGroup()
Results, with only some minor modifications to LuaShader.lua to label, push and pop things: