regl
regl copied to clipboard
Extensions loaded previously may pollute new regl instance
I discovered while debugging strange test interactions in #474 that regl may perform incorrectly in the somewhat obscure corner case in which you:
- create a regl instance with the
ANGLE_instanced_arraysextension - perform instanced rendering
- create a new regl context using the same canvas element but without
ANGLE_instanced_arrays - perform non-instanced rendering
The second regl instance knows nothing about the extension since you did not ask for it but still is subject to needing to maintain (or at least just unset) instanced rendering for the attributes.
This is pretty obscure and unlikely to cause real-world problems, but perhaps regl should query and register previously loaded extensions as available even if you did not ask for them.
I'll take a shot at it
@mikolalysenko I think it's almost entirely a non-issue since reusing a canvas element for different webgl contexts is a bit of a strange thing to do, though it's maybe not invalid. The place where it jumped out was in the test scripts, which almost exclusively do that. See:
https://github.com/regl-project/regl/blob/cadd226650d345ac3599b067ebfb848439dc4fd8/test/attribute-constants.js#L6-L18