From 3c1755eba71064ee0331f39b8e1ac9851b778da7 Mon Sep 17 00:00:00 2001 From: assiduous Date: Sun, 12 Nov 2023 14:36:43 -0800 Subject: [PATCH] TextureBaseGL::CopyData: fixed issue with binding texture to 0 target --- Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp | 2 ++ Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp index f210f0d70..30a7bd96a 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp @@ -213,6 +213,8 @@ void GLContextState::SetActiveTexture(Int32 Index) void GLContextState::BindTexture(Int32 Index, GLenum BindTarget, const GLObjectWrappers::GLTextureObj& TexObj) { + VERIFY_EXPR(BindTarget != 0); + if (Index < 0) { Index += m_Caps.MaxCombinedTexUnits; diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp index b064afd01..1f96c17b7 100644 --- a/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp @@ -728,7 +728,9 @@ void TextureBaseGL::CopyData(DeviceContextGLImpl* pDeviceCtxGL, // Invalidate FBO as we used glBindFramebuffer directly GLState.InvalidateFBO(); - GLState.BindTexture(-1, GetBindTarget(), GLObjectWrappers::GLTextureObj::Null()); + if (!UseBlitFramebuffer) + GLState.BindTexture(-1, GetBindTarget(), GLObjectWrappers::GLTextureObj::Null()); + pDeviceCtxGL->CommitRenderTargets(); } }