Commit f0e3c19a by Olli Etuaho Committed by Commit Bot

Add error messages for BlitFramebuffer related errors

These are particularly helpful when debugging multiview rendering that requires a framebuffer blit. Existing blitFramebuffer error message strings are moved to ErrorStrings.h. BUG=angleproject:1617 TEST=angle_end2end_tests Change-Id: I6e8b45355045d80abf044714ac4b9d818c53bf46 Reviewed-on: https://chromium-review.googlesource.com/1175125 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 3fd614d0
...@@ -17,6 +17,58 @@ ...@@ -17,6 +17,58 @@
namespace gl namespace gl
{ {
ERRMSG(BlitDimensionsOutOfRange, "BlitFramebuffer dimensions out of 32-bit integer range."); ERRMSG(BlitDimensionsOutOfRange, "BlitFramebuffer dimensions out of 32-bit integer range.");
ERRMSG(BlitExtensionDepthStencilWholeBufferBlit,
"Only whole-buffer depth and stencil blits are supported by this extension.");
ERRMSG(BlitExtensionFormatMismatch,
"Attempting to blit and the read and draw buffer formats don't match.");
ERRMSG(BlitExtensionFromInvalidAttachmentType,
"Blits are only supported from 2D texture, renderbuffer or default framebuffer attachments "
"in this extension.");
ERRMSG(BlitExtensionLinear, "Linear blit not supported in this extension.");
ERRMSG(BlitExtensionMultisampledDepthOrStencil,
"Multisampled depth/stencil blit is not supported by this extension.");
ERRMSG(BlitExtensionMultisampledWholeBufferBlit,
"Only whole-buffer blit is supported from a multisampled read buffer in this extension.");
ERRMSG(BlitExtensionNotAvailable, "Blit extension not available.");
ERRMSG(BlitExtensionScaleOrFlip,
"Scaling and flipping in BlitFramebufferANGLE not supported by this implementation.");
ERRMSG(BlitExtensionToInvalidAttachmentType,
"Blits are only supported to 2D texture, renderbuffer or default framebuffer attachments in "
"this extension.");
ERRMSG(BlitFeedbackLoop, "Blit feedback loop: the read and draw framebuffers are the same.");
ERRMSG(BlitFramebufferMissing, "Read and draw framebuffers must both exist for a blit to succeed.");
ERRMSG(BlitFromMultiview, "Attempt to read from a multi-view framebuffer.");
ERRMSG(BlitDepthOrStencilFormatMismatch,
"Depth/stencil buffer format combination not allowed for blit.");
ERRMSG(BlitIntegerWithLinearFilter,
"Cannot use GL_LINEAR filter when blitting a integer framebuffer.");
ERRMSG(BlitInvalidFilter, "Invalid blit filter.");
ERRMSG(BlitInvalidMask, "Invalid blit mask.");
ERRMSG(BlitMissingColor,
"Attempt to read from a missing color attachment of a complete framebuffer.");
ERRMSG(BlitMissingDepthOrStencil,
"Attempt to read from a missing depth/stencil attachment of a complete framebuffer.");
ERRMSG(BlitOnlyNearestForNonColor,
"Only nearest filtering can be used when blitting buffers other than the color buffer.");
ERRMSG(BlitToMultiview, "Attempt to write to a multi-view framebuffer.");
ERRMSG(BlitTypeMismatchFixedOrFloat,
"If the read buffer contains fixed-point or floating-point values, the draw buffer must as "
"well.");
ERRMSG(BlitTypeMismatchFixedPoint,
"If the read buffer contains fixed-point values, the draw buffer must as well.");
ERRMSG(BlitTypeMismatchSignedInteger,
"If the read buffer contains signed integer values the draw buffer must as well.");
ERRMSG(BlitTypeMismatchUnsignedInteger,
"If the read buffer contains unsigned integer values the draw buffer must as well.");
ERRMSG(BlitMultisampledBoundsMismatch,
"Attempt to blit from a multisampled framebuffer and the bounds don't match with the draw "
"framebuffer.");
ERRMSG(BlitMultisampledFormatOrBoundsMismatch,
"Attempt to blit from a multisampled framebuffer and the bounds or format of the color "
"buffer don't match with the draw framebuffer.");
ERRMSG(BlitSameImageColor, "Read and write color attachments cannot be the same image.");
ERRMSG(BlitSameImageDepthOrStencil,
"Read and write depth stencil attachments cannot be the same image.");
ERRMSG(BufferBoundForTransformFeedback, "Buffer is bound for transform feedback."); ERRMSG(BufferBoundForTransformFeedback, "Buffer is bound for transform feedback.");
ERRMSG(BufferNotBound, "A buffer must be bound."); ERRMSG(BufferNotBound, "A buffer must be bound.");
ERRMSG(CompressedTextureDimensionsMustMatchData, ERRMSG(CompressedTextureDimensionsMustMatchData,
...@@ -108,6 +160,7 @@ ERRMSG(InvalidMemoryBarrierBit, "Invalid memory barrier bit."); ...@@ -108,6 +160,7 @@ ERRMSG(InvalidMemoryBarrierBit, "Invalid memory barrier bit.");
ERRMSG(InvalidMipLevel, "Level of detail outside of range."); ERRMSG(InvalidMipLevel, "Level of detail outside of range.");
ERRMSG(InvalidMultitextureUnit, ERRMSG(InvalidMultitextureUnit,
"Specified unit must be in [GL_TEXTURE0, GL_TEXTURE0 + GL_MAX_TEXTURE_UNITS)"); "Specified unit must be in [GL_TEXTURE0, GL_TEXTURE0 + GL_MAX_TEXTURE_UNITS)");
ERRMSG(InvalidMultisampledFramebufferOperation, "Invalid operation on multisampled framebuffer");
ERRMSG(InvalidName, "Invalid name."); ERRMSG(InvalidName, "Invalid name.");
ERRMSG(InvalidNameCharacters, "Name contains invalid characters."); ERRMSG(InvalidNameCharacters, "Name contains invalid characters.");
ERRMSG(InvalidPname, "Invalid pname."); ERRMSG(InvalidPname, "Invalid pname.");
......
...@@ -1206,13 +1206,13 @@ bool ValidateBlitFramebufferParameters(Context *context, ...@@ -1206,13 +1206,13 @@ bool ValidateBlitFramebufferParameters(Context *context,
case GL_LINEAR: case GL_LINEAR:
break; break;
default: default:
context->handleError(InvalidEnum()); ANGLE_VALIDATION_ERR(context, InvalidEnum(), BlitInvalidFilter);
return false; return false;
} }
if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)) != 0) if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)) != 0)
{ {
context->handleError(InvalidValue()); ANGLE_VALIDATION_ERR(context, InvalidValue(), BlitInvalidMask);
return false; return false;
} }
...@@ -1220,7 +1220,7 @@ bool ValidateBlitFramebufferParameters(Context *context, ...@@ -1220,7 +1220,7 @@ bool ValidateBlitFramebufferParameters(Context *context,
// color buffer, leaving only nearest being unfiltered from above // color buffer, leaving only nearest being unfiltered from above
if ((mask & ~GL_COLOR_BUFFER_BIT) != 0 && filter != GL_NEAREST) if ((mask & ~GL_COLOR_BUFFER_BIT) != 0 && filter != GL_NEAREST)
{ {
context->handleError(InvalidOperation()); ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitOnlyNearestForNonColor);
return false; return false;
} }
...@@ -1230,7 +1230,7 @@ bool ValidateBlitFramebufferParameters(Context *context, ...@@ -1230,7 +1230,7 @@ bool ValidateBlitFramebufferParameters(Context *context,
if (!readFramebuffer || !drawFramebuffer) if (!readFramebuffer || !drawFramebuffer)
{ {
context->handleError(InvalidFramebufferOperation()); ANGLE_VALIDATION_ERR(context, InvalidFramebufferOperation(), BlitFramebufferMissing);
return false; return false;
} }
...@@ -1246,7 +1246,7 @@ bool ValidateBlitFramebufferParameters(Context *context, ...@@ -1246,7 +1246,7 @@ bool ValidateBlitFramebufferParameters(Context *context,
if (readFramebuffer->id() == drawFramebuffer->id()) if (readFramebuffer->id() == drawFramebuffer->id())
{ {
context->handleError(InvalidOperation()); ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitFeedbackLoop);
return false; return false;
} }
...@@ -1306,47 +1306,45 @@ bool ValidateBlitFramebufferParameters(Context *context, ...@@ -1306,47 +1306,45 @@ bool ValidateBlitFramebufferParameters(Context *context,
if (readFixedOrFloat != drawFixedOrFloat) if (readFixedOrFloat != drawFixedOrFloat)
{ {
context->handleError(InvalidOperation() ANGLE_VALIDATION_ERR(context, InvalidOperation(),
<< "If the read buffer contains fixed-point or " BlitTypeMismatchFixedOrFloat);
"floating-point values, the draw buffer must "
"as well.");
return false; return false;
} }
} }
else if (readFixedPoint != drawFixedPoint) else if (readFixedPoint != drawFixedPoint)
{ {
context->handleError(InvalidOperation() ANGLE_VALIDATION_ERR(context, InvalidOperation(),
<< "If the read buffer contains fixed-point values, " BlitTypeMismatchFixedPoint);
"the draw buffer must as well.");
return false; return false;
} }
if (readComponentType == GL_UNSIGNED_INT && if (readComponentType == GL_UNSIGNED_INT &&
drawComponentType != GL_UNSIGNED_INT) drawComponentType != GL_UNSIGNED_INT)
{ {
context->handleError(InvalidOperation()); ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitTypeMismatchUnsignedInteger);
return false; return false;
} }
if (readComponentType == GL_INT && drawComponentType != GL_INT) if (readComponentType == GL_INT && drawComponentType != GL_INT)
{ {
context->handleError(InvalidOperation()); ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitTypeMismatchSignedInteger);
return false; return false;
} }
if (readColorBuffer->getSamples() > 0 && if (readColorBuffer->getSamples() > 0 &&
(!Format::EquivalentForBlit(readFormat, drawFormat) || !sameBounds)) (!Format::EquivalentForBlit(readFormat, drawFormat) || !sameBounds))
{ {
context->handleError(InvalidOperation()); ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitMultisampledFormatOrBoundsMismatch);
return false; return false;
} }
if (context->getExtensions().webglCompatibility && if (context->getExtensions().webglCompatibility &&
*readColorBuffer == *attachment) *readColorBuffer == *attachment)
{ {
context->handleError( ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitSameImageColor);
InvalidOperation()
<< "Read and write color attachments cannot be the same image.");
return false; return false;
} }
} }
...@@ -1356,7 +1354,7 @@ bool ValidateBlitFramebufferParameters(Context *context, ...@@ -1356,7 +1354,7 @@ bool ValidateBlitFramebufferParameters(Context *context,
readFormat.info->componentType == GL_UNSIGNED_INT) && readFormat.info->componentType == GL_UNSIGNED_INT) &&
filter == GL_LINEAR) filter == GL_LINEAR)
{ {
context->handleError(InvalidOperation()); ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitIntegerWithLinearFilter);
return false; return false;
} }
} }
...@@ -1366,9 +1364,7 @@ bool ValidateBlitFramebufferParameters(Context *context, ...@@ -1366,9 +1364,7 @@ bool ValidateBlitFramebufferParameters(Context *context,
// situation is an application error that would lead to a crash in ANGLE. // situation is an application error that would lead to a crash in ANGLE.
else if (drawFramebuffer->hasEnabledDrawBuffer()) else if (drawFramebuffer->hasEnabledDrawBuffer())
{ {
context->handleError( ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitMissingColor);
InvalidOperation()
<< "Attempt to read from a missing color attachment of a complete framebuffer.");
return false; return false;
} }
} }
...@@ -1388,30 +1384,28 @@ bool ValidateBlitFramebufferParameters(Context *context, ...@@ -1388,30 +1384,28 @@ bool ValidateBlitFramebufferParameters(Context *context,
{ {
if (!Format::EquivalentForBlit(readBuffer->getFormat(), drawBuffer->getFormat())) if (!Format::EquivalentForBlit(readBuffer->getFormat(), drawBuffer->getFormat()))
{ {
context->handleError(InvalidOperation()); ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitDepthOrStencilFormatMismatch);
return false; return false;
} }
if (readBuffer->getSamples() > 0 && !sameBounds) if (readBuffer->getSamples() > 0 && !sameBounds)
{ {
context->handleError(InvalidOperation()); ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitMultisampledBoundsMismatch);
return false; return false;
} }
if (context->getExtensions().webglCompatibility && *readBuffer == *drawBuffer) if (context->getExtensions().webglCompatibility && *readBuffer == *drawBuffer)
{ {
context->handleError( ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitSameImageDepthOrStencil);
InvalidOperation()
<< "Read and write depth stencil attachments cannot be the same image.");
return false; return false;
} }
} }
// WebGL 2.0 BlitFramebuffer when blitting from a missing attachment // WebGL 2.0 BlitFramebuffer when blitting from a missing attachment
else if (drawBuffer) else if (drawBuffer)
{ {
context->handleError(InvalidOperation() << "Attempt to read from a missing " ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitMissingDepthOrStencil);
"depth/stencil attachment of a "
"complete framebuffer.");
return false; return false;
} }
} }
...@@ -1424,14 +1418,12 @@ bool ValidateBlitFramebufferParameters(Context *context, ...@@ -1424,14 +1418,12 @@ bool ValidateBlitFramebufferParameters(Context *context,
// views in the current read framebuffer is more than one. // views in the current read framebuffer is more than one.
if (readFramebuffer->readDisallowedByMultiview()) if (readFramebuffer->readDisallowedByMultiview())
{ {
context->handleError(InvalidFramebufferOperation() ANGLE_VALIDATION_ERR(context, InvalidFramebufferOperation(), BlitFromMultiview);
<< "Attempt to read from a multi-view framebuffer.");
return false; return false;
} }
if (drawFramebuffer->getMultiviewLayout() != GL_NONE) if (drawFramebuffer->getMultiviewLayout() != GL_NONE)
{ {
context->handleError(InvalidFramebufferOperation() ANGLE_VALIDATION_ERR(context, InvalidFramebufferOperation(), BlitToMultiview);
<< "Attempt to write to a multi-view framebuffer.");
return false; return false;
} }
...@@ -6368,7 +6360,7 @@ bool ValidateFramebufferNotMultisampled(Context *context, Framebuffer *framebuff ...@@ -6368,7 +6360,7 @@ bool ValidateFramebufferNotMultisampled(Context *context, Framebuffer *framebuff
{ {
if (framebuffer->getSamples(context) != 0) if (framebuffer->getSamples(context) != 0)
{ {
context->handleError(InvalidOperation()); ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidMultisampledFramebufferOperation);
return false; return false;
} }
return true; return true;
......
...@@ -2440,22 +2440,20 @@ bool ValidateBlitFramebufferANGLE(Context *context, ...@@ -2440,22 +2440,20 @@ bool ValidateBlitFramebufferANGLE(Context *context,
{ {
if (!context->getExtensions().framebufferBlit) if (!context->getExtensions().framebufferBlit)
{ {
context->handleError(InvalidOperation() << "Blit extension not available."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitExtensionNotAvailable);
return false; return false;
} }
if (srcX1 - srcX0 != dstX1 - dstX0 || srcY1 - srcY0 != dstY1 - dstY0) if (srcX1 - srcX0 != dstX1 - dstX0 || srcY1 - srcY0 != dstY1 - dstY0)
{ {
// TODO(jmadill): Determine if this should be available on other implementations. // TODO(jmadill): Determine if this should be available on other implementations.
context->handleError(InvalidOperation() << "Scaling and flipping in " ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitExtensionScaleOrFlip);
"BlitFramebufferANGLE not supported by this "
"implementation.");
return false; return false;
} }
if (filter == GL_LINEAR) if (filter == GL_LINEAR)
{ {
context->handleError(InvalidEnum() << "Linear blit not supported in this extension"); ANGLE_VALIDATION_ERR(context, InvalidEnum(), BlitExtensionLinear);
return false; return false;
} }
...@@ -2474,7 +2472,8 @@ bool ValidateBlitFramebufferANGLE(Context *context, ...@@ -2474,7 +2472,8 @@ bool ValidateBlitFramebufferANGLE(Context *context,
readColorAttachment->type() != GL_RENDERBUFFER && readColorAttachment->type() != GL_RENDERBUFFER &&
readColorAttachment->type() != GL_FRAMEBUFFER_DEFAULT) readColorAttachment->type() != GL_FRAMEBUFFER_DEFAULT)
{ {
context->handleError(InvalidOperation()); ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitExtensionFromInvalidAttachmentType);
return false; return false;
} }
...@@ -2490,7 +2489,8 @@ bool ValidateBlitFramebufferANGLE(Context *context, ...@@ -2490,7 +2489,8 @@ bool ValidateBlitFramebufferANGLE(Context *context,
attachment->type() != GL_RENDERBUFFER && attachment->type() != GL_RENDERBUFFER &&
attachment->type() != GL_FRAMEBUFFER_DEFAULT) attachment->type() != GL_FRAMEBUFFER_DEFAULT)
{ {
context->handleError(InvalidOperation()); ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitExtensionToInvalidAttachmentType);
return false; return false;
} }
...@@ -2498,7 +2498,8 @@ bool ValidateBlitFramebufferANGLE(Context *context, ...@@ -2498,7 +2498,8 @@ bool ValidateBlitFramebufferANGLE(Context *context,
if (!Format::EquivalentForBlit(attachment->getFormat(), if (!Format::EquivalentForBlit(attachment->getFormat(),
readColorAttachment->getFormat())) readColorAttachment->getFormat()))
{ {
context->handleError(InvalidOperation()); ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitExtensionFormatMismatch);
return false; return false;
} }
} }
...@@ -2509,7 +2510,8 @@ bool ValidateBlitFramebufferANGLE(Context *context, ...@@ -2509,7 +2510,8 @@ bool ValidateBlitFramebufferANGLE(Context *context,
IsPartialBlit(context, readColorAttachment, drawColorAttachment, srcX0, srcY0, IsPartialBlit(context, readColorAttachment, drawColorAttachment, srcX0, srcY0,
srcX1, srcY1, dstX0, dstY0, dstX1, dstY1)) srcX1, srcY1, dstX0, dstY0, dstX1, dstY1))
{ {
context->handleError(InvalidOperation()); ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitExtensionMultisampledWholeBufferBlit);
return false; return false;
} }
} }
...@@ -2532,15 +2534,15 @@ bool ValidateBlitFramebufferANGLE(Context *context, ...@@ -2532,15 +2534,15 @@ bool ValidateBlitFramebufferANGLE(Context *context,
dstX0, dstY0, dstX1, dstY1)) dstX0, dstY0, dstX1, dstY1))
{ {
// only whole-buffer copies are permitted // only whole-buffer copies are permitted
context->handleError(InvalidOperation() << "Only whole-buffer depth and " ANGLE_VALIDATION_ERR(context, InvalidOperation(),
"stencil blits are supported by " BlitExtensionDepthStencilWholeBufferBlit);
"this extension.");
return false; return false;
} }
if (readBuffer->getSamples() != 0 || drawBuffer->getSamples() != 0) if (readBuffer->getSamples() != 0 || drawBuffer->getSamples() != 0)
{ {
context->handleError(InvalidOperation()); ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitExtensionMultisampledDepthOrStencil);
return false; return false;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment