abandon

fun abandon()

Abandons all GPU resources and assumes the underlying backend 3D API context is no longer usable. Call this if you have lost the associated GPU context, and thus internal texture, buffer, etc. references/IDs are now invalid. Calling this ensures that the destructors of the context and any of its created resource objects will not make backend 3D API calls. Content rendered but not previously flushed may be lost. After this function is called all subsequent calls on the context will fail or be no-ops.

The typical use case for this function is that the underlying 3D context was lost and further API calls may crash.

For Vulkan, even if the device becomes lost, the VkQueue, VkDevice, or VkInstance used to create the context must be kept alive even after abandoning the context. Those objects must live for the lifetime of the context object itself. The reason for this is so that we can continue to delete any outstanding GrBackendTextures/RenderTargets which must be cleaned up even in a device lost state.