-
Notifications
You must be signed in to change notification settings - Fork 3
Labels
enhancementNew feature or requestNew feature or request
Description
Background
When running WebGL2 code or Khronos conformance tests in JSAR Runtime, the following error is encountered:
Uncaught Error: Failed to execute 'transformFeedbackVaryings' on 'WebGL2RenderingContext': Not implemented
This occurs when JS/WebGL2 code calls the API:
gl.transformFeedbackVaryings(program, ['gl_Position'], gl.INTERLEAVED_ATTRIBS);Impact
- Standard conformance tests requiring transform feedback fail to run in JSAR
- Popular libraries that use transform feedback (e.g., Three.js advanced rendering patterns, Babylon.js particle systems, GPU-based computation, etc.) fail or degrade
- Both classic and XR spatial apps depending on this API are blocked
Web Standard Reference
- WebGL 2.0 Specification §5.19.3 transformFeedbackVaryings
- Chromium implementation (WebGL2RenderingContextBase::TransformFeedbackVaryings)
- MDN docs - transformFeedbackVaryings
Root Cause
- The native C++ binding for
WebGL2RenderingContext.transformFeedbackVaryingsis missing or stubbed as "not implemented" in JSAR - No logic dispatching from JS layer to the actual OpenGL call (
glTransformFeedbackVaryings)
Acceptance Criteria
- Calling
gl.transformFeedbackVaryingsin JSAR WebGL2 context correctly dispatches to native and configures transform feedback as per spec - Conformance tests referencing this API pass
- Popular libraries relying on transform feedback work (Three.js, Babylon.js examples)
Implementation Guidance (C++)
- Add JS binding for
transformFeedbackVaryingsin WebGL2RenderingContext - Dispatch to corresponding OpenGL API:
void WebGL2RenderingContext::transformFeedbackVaryings(WebGLProgram* program, const std::vector<std::string>& varyings, GLenum bufferMode) {
// Convert string array to C array
std::vector<const char*> c_varyings;
for (const auto& v : varyings) {
c_varyings.push_back(v.c_str());
}
glTransformFeedbackVaryings(program->glObject(), c_varyings.size(), c_varyings.data(), bufferMode);
}- Update JS-to-native binding so the method is available on WebGL2RenderingContext
- Fails gracefully (throws per spec) if invoked on invalid program object
Relevant code location to update:
src/client/builtin_scene/webgl_rendering_context.cpp
Supporting this API is required for WebGL2 spec conformance and ecosystem compatibility.
Copilot
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request