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 @@
namespace gl
{
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(BufferNotBound, "A buffer must be bound.");
ERRMSG(CompressedTextureDimensionsMustMatchData,
......@@ -108,6 +160,7 @@ ERRMSG(InvalidMemoryBarrierBit, "Invalid memory barrier bit.");
ERRMSG(InvalidMipLevel, "Level of detail outside of range.");
ERRMSG(InvalidMultitextureUnit,
"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(InvalidNameCharacters, "Name contains invalid characters.");
ERRMSG(InvalidPname, "Invalid pname.");
......
......@@ -1206,13 +1206,13 @@ bool ValidateBlitFramebufferParameters(Context *context,
case GL_LINEAR:
break;
default:
context->handleError(InvalidEnum());
ANGLE_VALIDATION_ERR(context, InvalidEnum(), BlitInvalidFilter);
return false;
}
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;
}
......@@ -1220,7 +1220,7 @@ bool ValidateBlitFramebufferParameters(Context *context,
// color buffer, leaving only nearest being unfiltered from above
if ((mask & ~GL_COLOR_BUFFER_BIT) != 0 && filter != GL_NEAREST)
{
context->handleError(InvalidOperation());
ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitOnlyNearestForNonColor);
return false;
}
......@@ -1230,7 +1230,7 @@ bool ValidateBlitFramebufferParameters(Context *context,
if (!readFramebuffer || !drawFramebuffer)
{
context->handleError(InvalidFramebufferOperation());
ANGLE_VALIDATION_ERR(context, InvalidFramebufferOperation(), BlitFramebufferMissing);
return false;
}
......@@ -1246,7 +1246,7 @@ bool ValidateBlitFramebufferParameters(Context *context,
if (readFramebuffer->id() == drawFramebuffer->id())
{
context->handleError(InvalidOperation());
ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitFeedbackLoop);
return false;
}
......@@ -1306,47 +1306,45 @@ bool ValidateBlitFramebufferParameters(Context *context,
if (readFixedOrFloat != drawFixedOrFloat)
{
context->handleError(InvalidOperation()
<< "If the read buffer contains fixed-point or "
"floating-point values, the draw buffer must "
"as well.");
ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitTypeMismatchFixedOrFloat);
return false;
}
}
else if (readFixedPoint != drawFixedPoint)
{
context->handleError(InvalidOperation()
<< "If the read buffer contains fixed-point values, "
"the draw buffer must as well.");
ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitTypeMismatchFixedPoint);
return false;
}
if (readComponentType == GL_UNSIGNED_INT &&
drawComponentType != GL_UNSIGNED_INT)
{
context->handleError(InvalidOperation());
ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitTypeMismatchUnsignedInteger);
return false;
}
if (readComponentType == GL_INT && drawComponentType != GL_INT)
{
context->handleError(InvalidOperation());
ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitTypeMismatchSignedInteger);
return false;
}
if (readColorBuffer->getSamples() > 0 &&
(!Format::EquivalentForBlit(readFormat, drawFormat) || !sameBounds))
{
context->handleError(InvalidOperation());
ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitMultisampledFormatOrBoundsMismatch);
return false;
}
if (context->getExtensions().webglCompatibility &&
*readColorBuffer == *attachment)
{
context->handleError(
InvalidOperation()
<< "Read and write color attachments cannot be the same image.");
ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitSameImageColor);
return false;
}
}
......@@ -1356,7 +1354,7 @@ bool ValidateBlitFramebufferParameters(Context *context,
readFormat.info->componentType == GL_UNSIGNED_INT) &&
filter == GL_LINEAR)
{
context->handleError(InvalidOperation());
ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitIntegerWithLinearFilter);
return false;
}
}
......@@ -1366,9 +1364,7 @@ bool ValidateBlitFramebufferParameters(Context *context,
// situation is an application error that would lead to a crash in ANGLE.
else if (drawFramebuffer->hasEnabledDrawBuffer())
{
context->handleError(
InvalidOperation()
<< "Attempt to read from a missing color attachment of a complete framebuffer.");
ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitMissingColor);
return false;
}
}
......@@ -1388,30 +1384,28 @@ bool ValidateBlitFramebufferParameters(Context *context,
{
if (!Format::EquivalentForBlit(readBuffer->getFormat(), drawBuffer->getFormat()))
{
context->handleError(InvalidOperation());
ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitDepthOrStencilFormatMismatch);
return false;
}
if (readBuffer->getSamples() > 0 && !sameBounds)
{
context->handleError(InvalidOperation());
ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitMultisampledBoundsMismatch);
return false;
}
if (context->getExtensions().webglCompatibility && *readBuffer == *drawBuffer)
{
context->handleError(
InvalidOperation()
<< "Read and write depth stencil attachments cannot be the same image.");
ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitSameImageDepthOrStencil);
return false;
}
}
// WebGL 2.0 BlitFramebuffer when blitting from a missing attachment
else if (drawBuffer)
{
context->handleError(InvalidOperation() << "Attempt to read from a missing "
"depth/stencil attachment of a "
"complete framebuffer.");
ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitMissingDepthOrStencil);
return false;
}
}
......@@ -1424,14 +1418,12 @@ bool ValidateBlitFramebufferParameters(Context *context,
// views in the current read framebuffer is more than one.
if (readFramebuffer->readDisallowedByMultiview())
{
context->handleError(InvalidFramebufferOperation()
<< "Attempt to read from a multi-view framebuffer.");
ANGLE_VALIDATION_ERR(context, InvalidFramebufferOperation(), BlitFromMultiview);
return false;
}
if (drawFramebuffer->getMultiviewLayout() != GL_NONE)
{
context->handleError(InvalidFramebufferOperation()
<< "Attempt to write to a multi-view framebuffer.");
ANGLE_VALIDATION_ERR(context, InvalidFramebufferOperation(), BlitToMultiview);
return false;
}
......@@ -6368,7 +6360,7 @@ bool ValidateFramebufferNotMultisampled(Context *context, Framebuffer *framebuff
{
if (framebuffer->getSamples(context) != 0)
{
context->handleError(InvalidOperation());
ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidMultisampledFramebufferOperation);
return false;
}
return true;
......
......@@ -2440,22 +2440,20 @@ bool ValidateBlitFramebufferANGLE(Context *context,
{
if (!context->getExtensions().framebufferBlit)
{
context->handleError(InvalidOperation() << "Blit extension not available.");
ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitExtensionNotAvailable);
return false;
}
if (srcX1 - srcX0 != dstX1 - dstX0 || srcY1 - srcY0 != dstY1 - dstY0)
{
// TODO(jmadill): Determine if this should be available on other implementations.
context->handleError(InvalidOperation() << "Scaling and flipping in "
"BlitFramebufferANGLE not supported by this "
"implementation.");
ANGLE_VALIDATION_ERR(context, InvalidOperation(), BlitExtensionScaleOrFlip);
return false;
}
if (filter == GL_LINEAR)
{
context->handleError(InvalidEnum() << "Linear blit not supported in this extension");
ANGLE_VALIDATION_ERR(context, InvalidEnum(), BlitExtensionLinear);
return false;
}
......@@ -2474,7 +2472,8 @@ bool ValidateBlitFramebufferANGLE(Context *context,
readColorAttachment->type() != GL_RENDERBUFFER &&
readColorAttachment->type() != GL_FRAMEBUFFER_DEFAULT)
{
context->handleError(InvalidOperation());
ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitExtensionFromInvalidAttachmentType);
return false;
}
......@@ -2490,7 +2489,8 @@ bool ValidateBlitFramebufferANGLE(Context *context,
attachment->type() != GL_RENDERBUFFER &&
attachment->type() != GL_FRAMEBUFFER_DEFAULT)
{
context->handleError(InvalidOperation());
ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitExtensionToInvalidAttachmentType);
return false;
}
......@@ -2498,7 +2498,8 @@ bool ValidateBlitFramebufferANGLE(Context *context,
if (!Format::EquivalentForBlit(attachment->getFormat(),
readColorAttachment->getFormat()))
{
context->handleError(InvalidOperation());
ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitExtensionFormatMismatch);
return false;
}
}
......@@ -2509,7 +2510,8 @@ bool ValidateBlitFramebufferANGLE(Context *context,
IsPartialBlit(context, readColorAttachment, drawColorAttachment, srcX0, srcY0,
srcX1, srcY1, dstX0, dstY0, dstX1, dstY1))
{
context->handleError(InvalidOperation());
ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitExtensionMultisampledWholeBufferBlit);
return false;
}
}
......@@ -2532,15 +2534,15 @@ bool ValidateBlitFramebufferANGLE(Context *context,
dstX0, dstY0, dstX1, dstY1))
{
// only whole-buffer copies are permitted
context->handleError(InvalidOperation() << "Only whole-buffer depth and "
"stencil blits are supported by "
"this extension.");
ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitExtensionDepthStencilWholeBufferBlit);
return false;
}
if (readBuffer->getSamples() != 0 || drawBuffer->getSamples() != 0)
{
context->handleError(InvalidOperation());
ANGLE_VALIDATION_ERR(context, InvalidOperation(),
BlitExtensionMultisampledDepthOrStencil);
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