regl icon indicating copy to clipboard operation
regl copied to clipboard

Extensions loaded previously may pollute new regl instance

Open rreusser opened this issue 4 years ago • 2 comments

I discovered while debugging strange test interactions in #474 that regl may perform incorrectly in the somewhat obscure corner case in which you:

  1. create a regl instance with the ANGLE_instanced_arrays extension
  2. perform instanced rendering
  3. create a new regl context using the same canvas element but without ANGLE_instanced_arrays
  4. 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.

rreusser avatar Sep 07 '19 20:09 rreusser

I'll take a shot at it

mikolalysenko avatar Mar 06 '20 12:03 mikolalysenko

@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

rreusser avatar Mar 06 '20 18:03 rreusser