ES3: Allow floating point blit conversions under extension.
If we support EXT_color_buffer_float, we should also allow blits to
and from float and fixed point data, according to the extension
spec.
BUG=angleproject:1243
TEST=dEQP-GLES3.functional.fbo.blit.*
Change-Id: I0957ac0647c94e38ebd67480c608eeb16c82dbf4
Reviewed-on: https://chromium-review.googlesource.com/316030
Tryjob-Request: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index baabae8..e9cd516 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -656,6 +656,7 @@
{
const gl::FramebufferAttachment *readColorBuffer = readFramebuffer->getReadColorbuffer();
const gl::FramebufferAttachment *drawColorBuffer = drawFramebuffer->getFirstColorbuffer();
+ const Extensions &extensions = context->getExtensions();
if (readColorBuffer && drawColorBuffer)
{
@@ -673,20 +674,45 @@
// 1) If the read buffer is fixed point format, the draw buffer must be as well
// 2) If the read buffer is an unsigned integer format, the draw buffer must be as well
// 3) If the read buffer is a signed integer format, the draw buffer must be as well
- if ( (readFormatInfo.componentType == GL_UNSIGNED_NORMALIZED || readFormatInfo.componentType == GL_SIGNED_NORMALIZED) &&
- !(drawFormatInfo.componentType == GL_UNSIGNED_NORMALIZED || drawFormatInfo.componentType == GL_SIGNED_NORMALIZED))
+ // Changes with EXT_color_buffer_float:
+ // Case 1) is changed to fixed point OR floating point
+ GLenum readComponentType = readFormatInfo.componentType;
+ GLenum drawComponentType = drawFormatInfo.componentType;
+ bool readFixedPoint = (readComponentType == GL_UNSIGNED_NORMALIZED ||
+ readComponentType == GL_SIGNED_NORMALIZED);
+ bool drawFixedPoint = (drawComponentType == GL_UNSIGNED_NORMALIZED ||
+ drawComponentType == GL_SIGNED_NORMALIZED);
+
+ if (extensions.colorBufferFloat)
+ {
+ bool readFixedOrFloat = (readFixedPoint || readComponentType == GL_FLOAT);
+ bool drawFixedOrFloat = (drawFixedPoint || drawComponentType == GL_FLOAT);
+
+ if (readFixedOrFloat != drawFixedOrFloat)
+ {
+ context->recordError(Error(GL_INVALID_OPERATION,
+ "If the read buffer contains fixed-point or "
+ "floating-point values, the draw buffer "
+ "must as well."));
+ return false;
+ }
+ }
+ else if (readFixedPoint != drawFixedPoint)
+ {
+ context->recordError(Error(GL_INVALID_OPERATION,
+ "If the read buffer contains fixed-point "
+ "values, the draw buffer must as well."));
+ return false;
+ }
+
+ if (readComponentType == GL_UNSIGNED_INT &&
+ drawComponentType != GL_UNSIGNED_INT)
{
context->recordError(Error(GL_INVALID_OPERATION));
return false;
}
- if (readFormatInfo.componentType == GL_UNSIGNED_INT && drawFormatInfo.componentType != GL_UNSIGNED_INT)
- {
- context->recordError(Error(GL_INVALID_OPERATION));
- return false;
- }
-
- if (readFormatInfo.componentType == GL_INT && drawFormatInfo.componentType != GL_INT)
+ if (readComponentType == GL_INT && drawComponentType != GL_INT)
{
context->recordError(Error(GL_INVALID_OPERATION));
return false;