mirror of
https://github.com/love2d/love.git
synced 2026-08-18 03:34:23 +02:00
disallow texture:replacePixels and non-canvas textures for depth/stencil pixel formats.
This commit is contained in:
@@ -284,6 +284,9 @@ Texture::Texture(Graphics *gfx, const Settings &settings, const Slices *slices)
|
||||
if (isCompressed() && renderTarget)
|
||||
throw love::Exception("Compressed textures cannot be render targets.");
|
||||
|
||||
if (isPixelFormatDepthStencil(format) && !renderTarget)
|
||||
throw love::Exception("Depth or stencil pixel formats are only supported with render target textures.");
|
||||
|
||||
for (PixelFormat viewformat : viewFormats)
|
||||
{
|
||||
if (getLinearPixelFormat(viewformat) == getLinearPixelFormat(format))
|
||||
@@ -582,6 +585,9 @@ void Texture::replacePixels(love::image::ImageDataBase *d, int slice, int mipmap
|
||||
if (getMSAA() > 1)
|
||||
throw love::Exception("replacePixels cannot be called on a MSAA Texture.");
|
||||
|
||||
if (isPixelFormatDepthStencil(format))
|
||||
throw love::Exception("replacePixels cannot be called on depth or stencil Textures.");
|
||||
|
||||
auto gfx = Module::getInstance<Graphics>(Module::M_GRAPHICS);
|
||||
if (gfx != nullptr && gfx->isRenderTargetActive(this))
|
||||
throw love::Exception("replacePixels cannot be called on this Texture while it's an active render target.");
|
||||
|
||||
Reference in New Issue
Block a user