-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Background
When running sdk/tests/conformance2/attribs/gl-vertex-attrib.html from the EndlessJour9527/WebGL test suite in JSAR Runtime, the following error is encountered:
Uncaught TypeError: gl.getVertexAttrib is not a function
This is a critical WebGL API required by the WebGL specification and by a number of Khronos conformance tests (see WebGL 2.0 spec: getVertexAttrib).
Task
Implement the family of getVertexAttrib APIs so that JSAR correctly passes conformance tests such as:
- gl.getVertexAttrib
- gl.getVertexAttribOffset
- gl.getVertexAttribPointer
Minimal required functionality
- All variants for querying attribute state must be provided and match WebGL 1/2 and Khronos test expectations
- Accepts all standard parameters: index, pname
- Handles edge cases required for test coverage
Reference:
- Khronos WebGL2 Test: gl-vertex-attrib.html
- WebGL2 spec section 5.14.9
- Example Chromium implementation: chromium/src/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.cc
Acceptance Criteria
- Passing the following conformance test file:
sdk/tests/conformance2/attribs/gl-vertex-attrib.htmlfrom EndlessJour9527/WebGL - Returns correct results for all valid function calls
- Throws appropriate exceptions for invalid parameters as per the spec
Implementation Hints (C++)
Implement in C++:
// WebGLRenderingContext getVertexAttrib implementation
void WebGLRenderingContext::getVertexAttrib(GLuint index, GLenum pname, ...) {
// Reference: https://registry.khronos.org/webgl/specs/latest/2.0/#5.14.9
// Add switch/case for each valid pname
switch (pname) {
case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
// Return enabled state
break;
case GL_VERTEX_ATTRIB_ARRAY_SIZE:
// Return size
break;
// ... handle other cases
default:
// Throw exception for invalid pname
break;
}
}Related files to update are in src/client/builtin_scene/webgl_rendering_context.cpp.
See also JSAR documentation for WebGL 2.0 support and internal architecture documentation.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request