From 2a6bffaa5adb4ee73763f89e9fa7872d0fe9ccb8 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sun, 29 Mar 2015 23:51:08 -0300 Subject: [PATCH] Prevent sRGB and non-sRGB Canvas formats from being used together in multi-canvas rendering (MRTs), due to driver bugs. --- src/modules/graphics/opengl/Canvas.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/graphics/opengl/Canvas.cpp b/src/modules/graphics/opengl/Canvas.cpp index 5ed6f4d66..15c567653 100644 --- a/src/modules/graphics/opengl/Canvas.cpp +++ b/src/modules/graphics/opengl/Canvas.cpp @@ -433,8 +433,16 @@ void Canvas::startGrab(const std::vector &canvases) if (canvases[i]->getWidth() != width || canvases[i]->getHeight() != height) throw love::Exception("All canvases must have the same dimensions."); - if (canvases[i]->getTextureFormat() != format && !multiformatsupported) - throw love::Exception("This system doesn't support multi-canvas rendering with different canvas formats."); + Format otherformat = canvases[i]->getTextureFormat(); + + if (otherformat != format) + { + if (!multiformatsupported) + throw love::Exception("This system doesn't support multi-canvas rendering with different canvas formats."); + else if (otherformat == FORMAT_SRGB || format == FORMAT_SRGB) + // Driver bugs related to enabling GL_FRAMEBUFFER_SRGB... + throw love::Exception("sRGB and non-sRGB canvas formats cannot be mixed when using multi-canvas rendering."); + } if (canvases[i]->getMSAA() != 0) throw love::Exception("Multi-canvas rendering is not supported with MSAA.");