Fix GPU memory management
This merge request fixes severe stability and resource usage problems caused by a Ritchie trying to program a graphics renderer at 3 AM.
- Closing a window, previously, did not actually delete OpenGL resources on the engine side. Now, closing all windows sharing the same OpenGL context will result in that context's resources being destroyed.
- It is now possible to ask a
GraphicsObjectif it has been destroyed. - It was previously possible for a
GraphicsObject's internal platform resource to get destroyed without notifying theGraphicsObjectof such happening. This could have resulted in the engine hanging on to garbage, which is bad. -
Effectinstances now build their underlying shader pipeline as-needed. This allows the sameEffectinstance to be used across multiple graphics platforms, so long as the shader compiles on each. It also means the shader pipeline will not be allocated GPU-side until you actually use it. - Previously,
GuiRendererwould create a clone of the default UI shader to work around shared contexts breakingConstantBufferinstances. This has been removed. -
EffectConstantBuffernow allocates its GPU-side buffer as-needed, and will now upload CPU-side data as-needed. GPU-side constant buffer memory is no longer shared across multiple windows.