Skip to content

WebGL2 context.getParameter returns "undefined" instead of expected types/values for boolean and type checks #421

@EndlessJour9527

Description

@EndlessJour9527

Problem

Some calls to context.getParameter() in the WebGL2 context in JSAR are returning the wrong JS type or an invalid value in critical conformance cases. For example:

  • getParameter(context.RASTERIZER_DISCARD) should return a boolean (false by default), but is undefined
  • getParameter(context.SAMPLE_ALPHA_TO_COVERAGE) and getParameter(context.SAMPLE_COVERAGE) should return booleans
  • getParameter(context.MAX_3D_TEXTURE_SIZE), getParameter(context.UNIFORM_BUFFER_OFFSET_ALIGNMENT), and similar should be non-undefined numbers (integer >= minimum)
  • Certain parameters are NOT being returned as instances of Number or Boolean as required, but are undefined or wrong type

Notable FAIL cases

  • context.getParameter(context.MAX_3D_TEXTURE_SIZE) should be >= 256. Was undefined
  • context.getParameter(context.MAX_3D_TEXTURE_SIZE) is not an instance of Number
  • context.getParameter(context.UNIFORM_BUFFER_OFFSET_ALIGNMENT) should be >= 1. Was undefined
  • context.getParameter(context.UNIFORM_BUFFER_OFFSET_ALIGNMENT) is not an instance of Number
  • context.getParameter(context.RASTERIZER_DISCARD) should be false (boolean) Was undefined
  • Similar errors on other boolean/numeric parameters

Expected Behavior

All type checks per WebGL2 and WebGL1 spec should pass: the returned value should always be of the correct type (Boolean, Number) and value as defined. Never undefined.

Impact

  • Fails conformance and type safety tests
  • Might break application logic depending on typeof/value checks

References

Suggested Actions

  • Audit getParameter implementation for value and type safety
  • Match Chromium mapping for Number and Boolean return values
  • Expand regression tests for typeof/instance conformance

Category: WebGL2 API type & value conformance

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions