releaseTexture abstract method
Gives one back, rather than waiting for the whole device to go.
GraphicsDevice.dispose was the only release primitive there was, and
that is not enough for a renderer that reallocates. A window resize
remakes six or seven full-screen targets and empties this pool of every
spec it holds; changing one shadow setting remakes two atlases that are
75 MB each at the default tile. All of it was dropped rather than freed.
Where the collector is what frees a texture that is correct and this
method has nothing to do — but on WebGL2 a WebGLTexture the driver
holds is not a GC artefact, and nothing reclaims it unless something
calls gl.deleteTexture. A browser window dragged a few dozen times was
enough to show it.
A no-op is a correct implementation where dropping the last reference already frees, and is expected to say so rather than be left blank.
Afterwards the handle is spent. Releasing one twice, or one this allocator never made, is a caller mistake that a backend may refuse.
May come while submitted work still reads the texture: the device
defers the destruction until that work is done, by the rule
GraphicsDevice states for every release… member. The engine's
frames-in-flight ring keeps a pooled target from being reused while a
pass still samples it; freeing it is the device's to make safe.
Implementation
void releaseTexture(TextureHandle texture);