Skip to content
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

FR: glPushDebugGroup and glPopDebugGroup and glObjectLabel for nSight annotation from Lua and #1833

Open
Beherith opened this issue Dec 18, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Beherith
Copy link
Contributor

Beherith commented Dec 18, 2024

Would be neat to be able to assign which draw calls are using which GPU resources in nSight

https://docs.gl/gl4/glObjectLabel

As per GPT

glPushDebugGroup is a function in the OpenGL API that helps developers debug and profile OpenGL applications. It is part of the KHR_debug extension, which is integrated into the core OpenGL since version 4.3.

Purpose

glPushDebugGroup allows you to group a set of OpenGL commands into a named debug group. This helps in identifying and organizing sections of code in the debug output, making it easier to diagnose and analyze rendering issues.

Function Prototype

void glPushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message);

Parameters

  1. source: Specifies the source of the debug group. Common values include:

    • GL_DEBUG_SOURCE_APPLICATION: Indicates that the debug group is defined by the application.
    • GL_DEBUG_SOURCE_THIRD_PARTY: Indicates that the group is defined by external tools or libraries.
  2. id: A numeric identifier for the group. This can be any value that uniquely identifies the group within the scope of the source.

  3. length: The length of the message string. If this is -1, the string is assumed to be null-terminated.

  4. message: A human-readable string describing the debug group. This message is used in debugging tools or logs.

Example Usage

glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 1, -1, "Render Scene");

// OpenGL commands for rendering the scene
glDrawArrays(GL_TRIANGLES, 0, 36);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);

glPopDebugGroup(); // End of the debug group

Notes

  • Each glPushDebugGroup must be matched with a corresponding glPopDebugGroup.
  • The function adds a new debug group to the debug output stack. Groups can be nested for better organization.
  • Debug groups are particularly useful when analyzing rendering performance or diagnosing errors in tools like OpenGL Debug Output or profilers.

Benefits

  1. Organized Debugging: Clearly marks and groups commands for easier traceability.
  2. Better Profiling: Tools can provide insights into specific debug groups.
  3. Improved Diagnostics: Helps isolate and identify problematic sections of code.

Availability

  • OpenGL 4.3 or later.
  • Requires the KHR_debug extension in earlier versions of OpenGL (if supported).

By using glPushDebugGroup, you can make debugging and profiling OpenGL applications much more structured and efficient.

@Beherith Beherith added the enhancement New feature or request label Dec 18, 2024
@Beherith Beherith changed the title FR: glPushDebugGroup and glPopDebugGroup for nSight annotation from Lua FR: glPushDebugGroup and glPopDebugGroup and glObjectLabel for nSight annotation from Lua and Dec 18, 2024
@Beherith
Copy link
Contributor Author

Started work on this in a branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant