Skip to content
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

feat(webgl): Add WEBGL1 extensions to forced WebGL2 contexts #2092

Merged
merged 4 commits into from
May 23, 2024

Conversation

ibgreen
Copy link
Collaborator

@ibgreen ibgreen commented Apr 30, 2024

For #

Background

  • To maximize compatibility when attaching older WebGL libraries via WebGL2 context forcing.

Change List

  • Support WebGL1 extensions on WebGL2 contexts.
  • Move force function into WebGLAdapter

@ibgreen
Copy link
Collaborator Author

ibgreen commented Apr 30, 2024

@birkskyum

prototype.getContext = prototype.originalGetContext;
prototype.originalGetContext = undefined;
return;
enforceWebGL2(enforce: boolean = true, adapters: Adapter[] = []): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does a user register an adapter? Or are the necessary adapters already registered by default?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9.1 will update registerDevices -> registerAdapters

luma.registerAdapters(adapters?: (typeof Device)[]): void;
luma.registerAdapters(adapters?: Adapter[]): void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between a Device class and an Adapter?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • A Device is a wrapper around a WebGL context or GPUDevice that lets you create resources and query limits and features.
  • An adapter is a factory that lets you create Device's for a specific backend API.

@ibgreen ibgreen marked this pull request as ready for review April 30, 2024 19:48
@ibgreen ibgreen merged commit 0ab7e1e into master May 23, 2024
1 check passed
@ibgreen ibgreen deleted the ib/webgl1-extensions branch May 23, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants