Skip to content

Commit

Permalink
Make sure to unbind imported textures when destroying one
Browse files Browse the repository at this point in the history
fixes #7280
  • Loading branch information
pixelflinger committed Oct 27, 2023
1 parent 31a7502 commit e3e12db
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion filament/backend/src/opengl/OpenGLDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1464,9 +1464,9 @@ void OpenGLDriver::destroyTexture(Handle<HwTexture> th) {
DEBUG_MARKER()

if (th) {
auto& gl = mContext;
GLTexture* t = handle_cast<GLTexture*>(th);
if (UTILS_LIKELY(!t->gl.imported)) {
auto& gl = mContext;
if (UTILS_LIKELY(t->usage & TextureUsage::SAMPLEABLE)) {
gl.unbindTexture(t->gl.target, t->gl.id);
if (UTILS_UNLIKELY(t->hwStream)) {
Expand All @@ -1484,6 +1484,8 @@ void OpenGLDriver::destroyTexture(Handle<HwTexture> th) {
if (t->gl.sidecarRenderBufferMS) {
glDeleteRenderbuffers(1, &t->gl.sidecarRenderBufferMS);
}
} else {
gl.unbindTexture(t->gl.target, t->gl.id);
}
destruct(th, t);
}
Expand Down

0 comments on commit e3e12db

Please sign in to comment.