Browse Source

Error if Texture:generateMipmaps is called on an active canvas.

Sasha Szpakowski 1 year ago
parent
commit
3a672387e4
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/modules/graphics/Texture.cpp

+ 4 - 0
src/modules/graphics/Texture.cpp

@@ -701,6 +701,10 @@ void Texture::generateMipmaps()
 	if (!supportsGenerateMipmaps(err))
 	if (!supportsGenerateMipmaps(err))
 		throw love::Exception("%s", err);
 		throw love::Exception("%s", err);
 
 
+	auto gfx = Module::getInstance<Graphics>(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();
 	generateMipmapsInternal();
 }
 }