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
Context cleanup #1298
Context cleanup #1298
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I like that we move the headless dependencies code out of the "production" modules, but still keep some support for testing.
If someone wants to use headless in production, I assume it is still possible for the app to import headless gl and call instrumentContext
? Is it worth mentioning that somewhere?
This is in preparation to move context creation utilities into gltools.
Thanks, great prep diff that allows an observer like me to track the changes.
Just a thought: is your ambition to keep all code that annotates/modifies/instruments the gl context inside gltools? I don't recall exactly but there might some of that inside the webgl module. If it was possible to keep that complexity inside one module, that would be a good thing...
This is how I did it for luma's testing: https://github.com/uber/luma.gl/pull/1298/files#diff-ff7a789f8c4b8ed72b4cf337a0102c19R23-R29
Good call. I'll make a note to add something to the developer guide or maybe in the "low-level" tutorial.
I think so. A lot of this was in the "context" part of the webgl module, which I'm hoping is now simple enough to move to gltools without much trouble. Other than that I'm not sure what fits. Maybe also the environment checks like |
Yes. Aldo those are duplicated in basically all our repos. At one point, had created a wip But that is borderline, it is nice to share these, but also nice not to have to have a dependency for such a basic thing. Though there are some more sophisticated things like |
This is in preparation to move context creation utilities into gltools.
The biggest change is that
createGLContext
no longer attempts to create a headless context. To simplify testing, I've movedcreateHeadlessContext
andcreateTestContext
intotest-utils
.Other smaller changes:
getPageLoadPromise
is now a method onAnimationLoop
, the only place it was used.WebGL2RenderingContext
andImage
polyfills are inwebgl/init
(don't love this as place for them).setContextDefaults
anddestroyGLContext
as the former can easily be managed by the application without setting global state, and the latter only handled headless cases and wasn't actually used anywhere.