mirror of https://github.com/bjornbytes/lovr.git
Native textures don't destroy their handles;
If a Texture is created from a handle, that means someone else created it, so we expect them to destroy it. We were always destroying handles, and I guess this was usually okay because glDeleteTextures is idempotent. However, we're seeing a crash in the Oculus driver when OVR is torn down. Presumably it is trying to access its swapchain textures after we destroyed them. Not sure why this wasn't an observable issue before, maybe it's a new regression. Still, it makes sense to only delete the GL texture handle if we were the one that created it. We don't need to check this for the renderbuffer since we always own those.
This commit is contained in:
parent
51f81c9db6
commit
25bb12d07c
|
@ -1740,7 +1740,7 @@ Texture* lovrTextureCreateFromHandle(uint32_t handle, TextureType type, uint32_t
|
|||
|
||||
void lovrTextureDestroy(void* ref) {
|
||||
Texture* texture = ref;
|
||||
glDeleteTextures(1, &texture->id);
|
||||
if (!texture->native) glDeleteTextures(1, &texture->id);
|
||||
glDeleteRenderbuffers(1, &texture->msaaId);
|
||||
lovrGpuDestroySyncResource(texture, texture->incoherent);
|
||||
state.stats.textureMemory -= getTextureMemorySize(texture);
|
||||
|
|
Loading…
Reference in New Issue