-
Notifications
You must be signed in to change notification settings - Fork 3
WebGL2: Implement gl.getParameter(gl.UNIFORM_BUFFER_OFFSET_ALIGNMENT) #415
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
Conversation
Co-authored-by: EndlessJour9527 <155411404+EndlessJour9527@users.noreply.github.com>
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.
Pull Request Overview
This PR implements support for gl.getParameter(gl.UNIFORM_BUFFER_OFFSET_ALIGNMENT) in WebGL2 contexts, fixing a conformance issue where the method previously returned undefined instead of the platform-specific alignment value.
- Queries the GL implementation for
GL_UNIFORM_BUFFER_OFFSET_ALIGNMENTduring context initialization - Stores and returns the value through the existing parameter query infrastructure
- Follows the established pattern used by other WebGL2 context parameters
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/renderer/render_api_opengles.cpp | Added glGetIntegerv query for GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT during WebGL2 context initialization |
| src/common/command_buffers/details/webgl_context_init.hpp | Added uniformBufferOffsetAlignment field to copy constructor and response structure |
| src/client/graphics/webgl_context.hpp | Added enum entry kUniformBufferOffsetAlignment and member variable declaration |
| src/client/graphics/webgl_context.cpp | Added initialization from response and return logic in getParameterV2() |
| src/client/script_bindings/webgl/webgl_rendering_context.cpp | Added case handler for WEBGL2_UNIFORM_BUFFER_OFFSET_ALIGNMENT in parameter retrieval |
gl.getParameter(gl.UNIFORM_BUFFER_OFFSET_ALIGNMENT)returnsundefinedinstead of the platform-specific alignment value (typically 256/512/1024). This breaks WebGL2 conformance tests and libraries using uniform buffer objects.Changes
Backend (renderer)
GL_UNIFORM_BUFFER_OFFSET_ALIGNMENTviaglGetIntegerv()during WebGL2 context initializationWebGL2ContextInitCommandBufferResponseClient (context)
WebGL2Context::uniformBufferOffsetAlignmentkUniformBufferOffsetAlignmenttoWebGL2IntegerParameterNameenumgetParameterV2()when requestedThe constant was already exported to JavaScript bindings; only the query/storage path was missing.
Example Usage
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.