From 3a672387e425db378e85622f9a7630d3e46da6c6 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Sun, 14 Apr 2024 11:31:46 -0300 Subject: [PATCH] Error if Texture:generateMipmaps is called on an active canvas. --- src/modules/graphics/Texture.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/graphics/Texture.cpp b/src/modules/graphics/Texture.cpp index edae44ff7..8fe4cb814 100644 --- a/src/modules/graphics/Texture.cpp +++ b/src/modules/graphics/Texture.cpp @@ -701,6 +701,10 @@ void Texture::generateMipmaps() if (!supportsGenerateMipmaps(err)) throw love::Exception("%s", err); + auto gfx = Module::getInstance(Module::M_GRAPHICS); + if (gfx != nullptr && gfx->isRenderTargetActive(this)) + throw love::Exception("generateMipmaps cannot be called on this Texture while it's an active render target."); + generateMipmapsInternal(); }