From 813c9d1781bff7ee8460576f821f7f08cf1c9723 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Thu, 30 Dec 2021 19:25:10 -0400 Subject: [PATCH] Fix GL version check for arbitrary texture-to-buffer copy support. love never creates a GL4.5 context, so we also need to check for the extension that provides the same functionality. --- src/modules/graphics/opengl/OpenGL.cpp | 2 +- src/modules/graphics/opengl/Texture.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/graphics/opengl/OpenGL.cpp b/src/modules/graphics/opengl/OpenGL.cpp index 8f85184ac..b4e898cda 100644 --- a/src/modules/graphics/opengl/OpenGL.cpp +++ b/src/modules/graphics/opengl/OpenGL.cpp @@ -1541,7 +1541,7 @@ bool OpenGL::isCopyBufferToTextureSupported() const bool OpenGL::isCopyTextureToBufferSupported() const { // Requires glGetTextureSubImage support. - return GLAD_VERSION_4_5; + return GLAD_VERSION_4_5 || GLAD_ARB_get_texture_sub_image; } bool OpenGL::isCopyRenderTargetToBufferSupported() const diff --git a/src/modules/graphics/opengl/Texture.cpp b/src/modules/graphics/opengl/Texture.cpp index a0e7be0a4..dbfa81925 100644 --- a/src/modules/graphics/opengl/Texture.cpp +++ b/src/modules/graphics/opengl/Texture.cpp @@ -563,7 +563,7 @@ void Texture::copyToBuffer(love::graphics::Buffer *dest, int slice, int mipmap, // treating the pointer as a byte offset. uint8 *byteoffset = (uint8 *)(ptrdiff_t)destoffset; - if (GLAD_VERSION_4_5) + if (gl.isCopyTextureToBufferSupported()) { if (isCompressed()) glGetCompressedTextureSubImage(texture, mipmap, rect.x, rect.y, slice, rect.w, rect.h, 1, size, byteoffset);