Skip to content

Commit

Permalink
clean up setCanvas error checking code
Browse files Browse the repository at this point in the history
  • Loading branch information
slime73 committed Jul 15, 2024
1 parent 35e4435 commit bb5cea6
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/modules/graphics/Graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1045,28 +1045,12 @@ void Graphics::setRenderTargets(const RenderTargets &rts)
if (rtcount > capabilities.limits[LIMIT_RENDER_TARGETS])
throw love::Exception("This system can't simultaneously render to %d textures.", rtcount);

PixelFormat firstcolorformat = PIXELFORMAT_UNKNOWN;
if (!rts.colors.empty())
firstcolorformat = rts.colors[0].texture->getPixelFormat();

if (!firsttex->isRenderTarget())
throw love::Exception("Texture must be created as a canvas to be used in setCanvas.");

if (isPixelFormatDepthStencil(firstcolorformat))
throw love::Exception("Depth/stencil format textures must be used with the 'depthstencil' field of the table passed into setCanvas.");

if (firsttarget.mipmap < 0 || firsttarget.mipmap >= firsttex->getMipmapCount())
throw love::Exception("Invalid mipmap level %d.", firsttarget.mipmap + 1);

if (!firsttex->isValidSlice(firsttarget.slice, firsttarget.mipmap))
throw love::Exception("Invalid slice index: %d.", firsttarget.slice + 1);

bool hasSRGBtexture = isPixelFormatSRGB(firstcolorformat);
bool hasSRGBtexture = false;
int pixelw = firsttex->getPixelWidth(firsttarget.mipmap);
int pixelh = firsttex->getPixelHeight(firsttarget.mipmap);
int reqmsaa = firsttex->getRequestedMSAA();

for (int i = 1; i < rtcount; i++)
for (int i = 0; i < rtcount; i++)
{
Texture *c = rts.colors[i].texture;
PixelFormat format = c->getPixelFormat();
Expand Down

0 comments on commit bb5cea6

Please sign in to comment.