Skip to content

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 GraphicsObject if it has been destroyed.
  • It was previously possible for a GraphicsObject's internal platform resource to get destroyed without notifying the GraphicsObject of such happening. This could have resulted in the engine hanging on to garbage, which is bad.
  • Effect instances now build their underlying shader pipeline as-needed. This allows the same Effect instance 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, GuiRenderer would create a clone of the default UI shader to work around shared contexts breaking ConstantBuffer instances. This has been removed.
  • EffectConstantBuffer now 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.

Merge request reports

Loading