-
Notifications
You must be signed in to change notification settings - Fork 3
feat(webgl): implement vertexAttrib[1234]f[v] vector methods #400
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
base: main
Are you sure you want to change the base?
Conversation
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 pull request adds support for WebGL vertexAttrib*fv functions (vector versions) to complement the existing scalar vertexAttrib*f functions. The implementation adds four new WebGL API methods: vertexAttrib1fv, vertexAttrib2fv, vertexAttrib3fv, and vertexAttrib4fv.
Key changes:
- Implements WebGL vector vertex attribute API functions (vertexAttrib1fv through vertexAttrib4fv)
- Adds command buffer support and OpenGL ES rendering backend handlers
- Includes minor formatting fixes for namespace closing comments across WebGL binding files
Reviewed Changes
Copilot reviewed 8 out of 24 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/renderer/render_api_opengles.cpp | Adds OpenGL handler functions for the four new vertexAttrib*fv commands |
| src/common/command_buffers/shared.hpp | Defines command buffer type enums for the new vertex attribute functions |
| src/common/command_buffers/details/vertex_attrib.hpp | Implements base class and request types for vector vertex attribute commands |
| src/client/script_bindings/webgl/webgl_rendering_context.hpp | Declares the four new vertexAttrib*fv methods in the WebGL context |
| src/client/script_bindings/webgl/webgl_rendering_context.cpp | Implements V8 JavaScript bindings with input validation for the new methods |
| src/client/graphics/webgl_context.hpp | Declares C++ API methods for vertexAttrib*fv with overloads |
| src/client/graphics/webgl_context.cpp | Implements the vertexAttrib*fv methods and command buffer request creation |
| src/client/script_bindings/webgl/*.{hpp,cpp} | Formatting fixes for namespace closing comments (8 files) |
| src/client/script_bindings/events/all_events.cpp | Minor formatting adjustment to function declaration |
| void vertexAttrib1fv(const WebGLAttribLocation &, const std::vector<float> values); | ||
| void vertexAttrib1fv(int index, const std::vector<float> values); | ||
| void vertexAttrib2fv(const WebGLAttribLocation &, const std::vector<float> values); | ||
| void vertexAttrib2fv(int index, const std::vector<float> values); | ||
| void vertexAttrib3fv(const WebGLAttribLocation &, const std::vector<float> values); | ||
| void vertexAttrib3fv(int index, const std::vector<float> values); | ||
| void vertexAttrib4fv(const WebGLAttribLocation &, const std::vector<float> values); | ||
| void vertexAttrib4fv(int index, const std::vector<float> values); |
Copilot
AI
Oct 29, 2025
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.
The values parameter should be passed by const reference (const std::vector<float> &values) instead of by value to avoid unnecessary copying of vector data.
| sendCommandBufferRequest(req); | ||
| } | ||
|
|
||
| void WebGLContext::vertexAttrib1fv(const WebGLAttribLocation &index, const vector<float> values) |
Copilot
AI
Oct 29, 2025
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.
The values parameter should be passed by const reference (const vector<float> &values) instead of by value to avoid unnecessary copying of vector data. This matches the pattern used elsewhere in the codebase and improves performance.
| sendCommandBufferRequest(req); | ||
| } | ||
|
|
||
| void WebGLContext::vertexAttrib1fv(int index, const vector<float> values) |
Copilot
AI
Oct 29, 2025
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.
The values parameter should be passed by const reference (const vector<float> &values) instead of by value to avoid unnecessary copying of vector data. This matches the pattern used elsewhere in the codebase and improves performance.
| void WebGLContext::vertexAttrib1fv(int index, const vector<float> values) | |
| void WebGLContext::vertexAttrib1fv(int index, const vector<float> &values) |
| sendCommandBufferRequest(req); | ||
| } | ||
|
|
||
| void WebGLContext::vertexAttrib2fv(const WebGLAttribLocation &index, const vector<float> values) |
Copilot
AI
Oct 29, 2025
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.
The values parameter should be passed by const reference (const vector<float> &values) instead of by value to avoid unnecessary copying of vector data. This matches the pattern used elsewhere in the codebase and improves performance.
| sendCommandBufferRequest(req); | ||
| } | ||
|
|
||
| void WebGLContext::vertexAttrib2fv(int index, const vector<float> values) |
Copilot
AI
Oct 29, 2025
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.
The values parameter should be passed by const reference (const vector<float> &values) instead of by value to avoid unnecessary copying of vector data. This matches the pattern used elsewhere in the codebase and improves performance.
| sendCommandBufferRequest(req); | ||
| } | ||
|
|
||
| void WebGLContext::vertexAttrib3fv(const WebGLAttribLocation &index, const vector<float> values) |
Copilot
AI
Oct 29, 2025
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.
The values parameter should be passed by const reference (const vector<float> &values) instead of by value to avoid unnecessary copying of vector data. This matches the pattern used elsewhere in the codebase and improves performance.
| void WebGLContext::vertexAttrib3fv(const WebGLAttribLocation &index, const vector<float> values) | |
| void WebGLContext::vertexAttrib3fv(const WebGLAttribLocation &index, const vector<float> &values) |
| sendCommandBufferRequest(req); | ||
| } | ||
|
|
||
| void WebGLContext::vertexAttrib3fv(int index, const vector<float> values) |
Copilot
AI
Oct 29, 2025
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.
The values parameter should be passed by const reference (const vector<float> &values) instead of by value to avoid unnecessary copying of vector data. This matches the pattern used elsewhere in the codebase and improves performance.
| sendCommandBufferRequest(req); | ||
| } | ||
|
|
||
| void WebGLContext::vertexAttrib4fv(const WebGLAttribLocation &index, const vector<float> values) |
Copilot
AI
Oct 29, 2025
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.
The values parameter should be passed by const reference (const vector<float> &values) instead of by value to avoid unnecessary copying of vector data. This matches the pattern used elsewhere in the codebase and improves performance.
| sendCommandBufferRequest(req); | ||
| } | ||
|
|
||
| void WebGLContext::vertexAttrib4fv(int index, const vector<float> values) |
Copilot
AI
Oct 29, 2025
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.
The values parameter should be passed by const reference (const vector<float> &values) instead of by value to avoid unnecessary copying of vector data. This matches the pattern used elsewhere in the codebase and improves performance.
| void WebGLContext::vertexAttrib4fv(int index, const vector<float> values) | |
| void WebGLContext::vertexAttrib4fv(int index, const vector<float>& values) |
26886da to
844a23f
Compare
Adds missing WebGL 1.0
vertexAttrib[1234]fvmethods that accept Float32Array or array arguments for setting vertex attribute values.Changes
Command Buffer Layer
COMMAND_BUFFER_VERTEX_ATTRIB_[1-4]FV_REQtypesVertexAttrib[1-4]fvCommandBufferRequestclasses using template patternGraphics API
vertexAttrib[1-4]fv(index, values)overloads toWebGLContextstd::vector<float>and forward to command bufferJavaScript Bindings
vertexAttrib1fv,vertexAttrib2fv,vertexAttrib3fv,vertexAttrib4fvonWebGLRenderingContextFloat32Arrayand regular arrays viaGetFloatValuesFromValueRenderer
OnVertexAttrib[1-4]fvhandlers callingglVertexAttrib[1-4]fvUsage
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.