Multi-canvas rendering (love.graphics.setCanvas with multiple canvases) now allows canvases with different formats, if the system supports it. Added 'multicanvasformats' to the table returned by love.graphics.getSupported.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2015-03-02 23:43:09 -04:00
parent 3ced9ca38f
commit 275a9a300f
5 changed files with 54 additions and 42 deletions
+11 -4
View File
@@ -416,19 +416,21 @@ void Canvas::startGrab(const std::vector<Canvas *> &canvases)
throw love::Exception("Multi-canvas rendering is not supported on this system.");
if ((int) canvases.size() + 1 > gl.getMaxRenderTargets())
throw love::Exception("This system can't simultaniously render to %d canvases.", canvases.size()+1);
throw love::Exception("This system can't simultaneously render to %d canvases.", canvases.size()+1);
if (actual_samples != 0)
throw love::Exception("Multi-canvas rendering is not supported with MSAA.");
}
bool multiformatsupported = isMultiFormatMultiCanvasSupported();
for (size_t i = 0; i < canvases.size(); i++)
{
if (canvases[i]->getWidth() != width || canvases[i]->getHeight() != height)
throw love::Exception("All canvas arguments must have the same dimensions.");
throw love::Exception("All canvases must have the same dimensions.");
if (canvases[i]->getTextureFormat() != format)
throw love::Exception("All canvas arguments must have the same texture format.");
if (canvases[i]->getTextureFormat() != format && !multiformatsupported)
throw love::Exception("This system doesn't support multi-canvas rendering with different canvas formats.");
if (canvases[i]->getMSAA() != 0)
throw love::Exception("Multi-canvas rendering is not supported with MSAA.");
@@ -785,6 +787,11 @@ bool Canvas::isMultiCanvasSupported()
return gl.getMaxRenderTargets() >= 4;
}
bool Canvas::isMultiFormatMultiCanvasSupported()
{
return isMultiCanvasSupported() && (GLAD_ES_VERSION_3_0 || GLAD_VERSION_3_0 || GLAD_ARB_framebuffer_object);
}
bool Canvas::supportedFormats[] = {false};
bool Canvas::checkedFormats[] = {false};
+1
View File
@@ -119,6 +119,7 @@ public:
static bool isSupported();
static bool isMultiCanvasSupported();
static bool isMultiFormatMultiCanvasSupported();
static bool isFormatSupported(Format format);
static Canvas *current;
+2
View File
@@ -1336,6 +1336,8 @@ bool Graphics::isSupported(Support feature) const
{
case SUPPORT_MULTI_CANVAS:
return Canvas::isMultiCanvasSupported();
case SUPPORT_MULTI_CANVAS_FORMATS:
return Canvas::isMultiFormatMultiCanvasSupported();
case SUPPORT_SRGB:
// sRGB support for the screen is guaranteed if it's supported as a
// Canvas format.