mosra / magnum

Lightweight and modular C++11 graphics middleware for games and data visualization
https://magnum.graphics/
Other
4.75k stars 439 forks source link

GL: new "angle-instanced-attributes-always-draw-instanced" workaround #539

Closed mosra closed 2 years ago

mosra commented 2 years ago

Because the bugs keep piling up faster than I'm able to find solutions, sigh.

The original problem, as reported by @kleisauke: Pressing S and shooting the first sphere in the web Bullet example gives a Vertex buffer is not big enough for the draw call. WebGL error -- an ANGLE-specific bug where instanced attributes don't get bounds-checked properly with non-instanced glDraw*(). The workaround is to use glDraw*Instanced() unconditionally if instanced attributes are present.

I'm hesitant to do this unconditionally because who knows what other bugs or perf drops on other implementations / ANGLE backends this would uncover.

The workaround implementation is correct and was verified to work, however I'm stuck on crafting a regression test case to prevent this from resurfacing again in the future. Things left to do:

mosra commented 2 years ago

Finished with great help from @pezcode (thanks!).