Skip to content

WebGL2: gl.getInternalformatParameter is not implemented (TypeError) #413

@EndlessJour9527

Description

@EndlessJour9527

Bug Description

When running WebGL2 content or conformance tests in JSAR Runtime, the following error is triggered on code that calls:

gl.getInternalformatParameter(target, internalformat, pname);

Error:

Uncaught TypeError: gl.getInternalformatParameter is not a function

Spec Reference

Expected Behavior

gl.getInternalformatParameter() should be implemented and return correct internal format parameters.

  • Typical usage: querying support for texture formats, sample counts, etc.

Root Cause

  • JSAR does not currently implement the getInternalformatParameter function on the WebGL2RenderingContext binding.
  • Calls to this function yield a TypeError in JavaScript, breaking WebGL2 applications and test suites.

Acceptance Criteria

  • gl.getInternalformatParameter must be present and callable on all WebGL2 contexts.
  • The function should return correct values for supported targets/internalformats/pnames
  • Conformance test files calling this function pass

Implementation Guidance (C++)

Implement the binding for getInternalformatParameter:

JSValue WebGL2RenderingContext::getInternalformatParameter(GLenum target, GLenum internalformat, GLenum pname) {
    // Query underlying GL implementation
    GLint params[16] = {0};
    GLint numParams = 0;
    glGetInternalformativ(target, internalformat, pname, 16, params, &numParams);
    // Return as JS array or value as per WebGL2 spec
    // See Chromium/WebKit/Gecko implementations for details
}
  • See Chromium/WebKit code for native logic and error handling.
  • Update JS bindings so this function is exposed and documented as per spec.

Impact

  • Required for compatibility with WebGL2 applications, including Three.js/Babylon.js advanced rendering and all Khronos conformance tests.

Please prioritize as this blocks WebGL2 conformance and ecosystem compatibility.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions