Commit 64b7c4ff by Jamie Madill Committed by Commit Bot

Use angle::Result in front-end (Part 3)

Handles the gl::Framebuffer class and its implementation. Bug: angleproject:2491 Change-Id: I3b9c0609e9277264ccdb370596500562df3b7d15 Reviewed-on: https://chromium-review.googlesource.com/c/1280743Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 32643cea
......@@ -1271,7 +1271,7 @@ GLenum Framebuffer::checkStatusWithGLFrontEnd(const Context *context)
return GL_FRAMEBUFFER_COMPLETE;
}
Error Framebuffer::discard(const Context *context, size_t count, const GLenum *attachments)
angle::Result Framebuffer::discard(const Context *context, size_t count, const GLenum *attachments)
{
// Back-ends might make the contents of the FBO undefined. In WebGL 2.0, invalidate operations
// can be no-ops, so we should probably do that to ensure consistency.
......@@ -1280,7 +1280,9 @@ Error Framebuffer::discard(const Context *context, size_t count, const GLenum *a
return mImpl->discard(context, count, attachments);
}
Error Framebuffer::invalidate(const Context *context, size_t count, const GLenum *attachments)
angle::Result Framebuffer::invalidate(const Context *context,
size_t count,
const GLenum *attachments)
{
// Back-ends might make the contents of the FBO undefined. In WebGL 2.0, invalidate operations
// can be no-ops, so we should probably do that to ensure consistency.
......@@ -1330,7 +1332,7 @@ bool Framebuffer::partialClearNeedsInit(const Context *context,
return false;
}
Error Framebuffer::invalidateSub(const Context *context,
angle::Result Framebuffer::invalidateSub(const Context *context,
size_t count,
const GLenum *attachments,
const Rectangle &area)
......@@ -1342,20 +1344,20 @@ Error Framebuffer::invalidateSub(const Context *context,
return mImpl->invalidateSub(context, count, attachments, area);
}
Error Framebuffer::clear(const Context *context, GLbitfield mask)
angle::Result Framebuffer::clear(const Context *context, GLbitfield mask)
{
const auto &glState = context->getGLState();
if (glState.isRasterizerDiscardEnabled())
{
return NoError();
return angle::Result::Continue();
}
ANGLE_TRY(mImpl->clear(context, mask));
return NoError();
return angle::Result::Continue();
}
Error Framebuffer::clearBufferfv(const Context *context,
angle::Result Framebuffer::clearBufferfv(const Context *context,
GLenum buffer,
GLint drawbuffer,
const GLfloat *values)
......@@ -1363,15 +1365,15 @@ Error Framebuffer::clearBufferfv(const Context *context,
if (context->getGLState().isRasterizerDiscardEnabled() ||
IsClearBufferMaskedOut(context, buffer))
{
return NoError();
return angle::Result::Continue();
}
ANGLE_TRY(mImpl->clearBufferfv(context, buffer, drawbuffer, values));
return NoError();
return angle::Result::Continue();
}
Error Framebuffer::clearBufferuiv(const Context *context,
angle::Result Framebuffer::clearBufferuiv(const Context *context,
GLenum buffer,
GLint drawbuffer,
const GLuint *values)
......@@ -1379,15 +1381,15 @@ Error Framebuffer::clearBufferuiv(const Context *context,
if (context->getGLState().isRasterizerDiscardEnabled() ||
IsClearBufferMaskedOut(context, buffer))
{
return NoError();
return angle::Result::Continue();
}
ANGLE_TRY(mImpl->clearBufferuiv(context, buffer, drawbuffer, values));
return NoError();
return angle::Result::Continue();
}
Error Framebuffer::clearBufferiv(const Context *context,
angle::Result Framebuffer::clearBufferiv(const Context *context,
GLenum buffer,
GLint drawbuffer,
const GLint *values)
......@@ -1395,15 +1397,15 @@ Error Framebuffer::clearBufferiv(const Context *context,
if (context->getGLState().isRasterizerDiscardEnabled() ||
IsClearBufferMaskedOut(context, buffer))
{
return NoError();
return angle::Result::Continue();
}
ANGLE_TRY(mImpl->clearBufferiv(context, buffer, drawbuffer, values));
return NoError();
return angle::Result::Continue();
}
Error Framebuffer::clearBufferfi(const Context *context,
angle::Result Framebuffer::clearBufferfi(const Context *context,
GLenum buffer,
GLint drawbuffer,
GLfloat depth,
......@@ -1412,29 +1414,30 @@ Error Framebuffer::clearBufferfi(const Context *context,
if (context->getGLState().isRasterizerDiscardEnabled() ||
IsClearBufferMaskedOut(context, buffer))
{
return NoError();
return angle::Result::Continue();
}
ANGLE_TRY(mImpl->clearBufferfi(context, buffer, drawbuffer, depth, stencil));
return NoError();
return angle::Result::Continue();
}
Error Framebuffer::getImplementationColorReadFormat(const Context *context, GLenum *formatOut)
angle::Result Framebuffer::getImplementationColorReadFormat(const Context *context,
GLenum *formatOut)
{
ANGLE_TRY(syncState(context));
*formatOut = mImpl->getImplementationColorReadFormat(context);
return NoError();
return angle::Result::Continue();
}
Error Framebuffer::getImplementationColorReadType(const Context *context, GLenum *typeOut)
angle::Result Framebuffer::getImplementationColorReadType(const Context *context, GLenum *typeOut)
{
ANGLE_TRY(syncState(context));
*typeOut = mImpl->getImplementationColorReadType(context);
return NoError();
return angle::Result::Continue();
}
Error Framebuffer::readPixels(const Context *context,
angle::Result Framebuffer::readPixels(const Context *context,
const Rectangle &area,
GLenum format,
GLenum type,
......@@ -1449,10 +1452,10 @@ Error Framebuffer::readPixels(const Context *context,
unpackBuffer->onPixelPack(context);
}
return NoError();
return angle::Result::Continue();
}
Error Framebuffer::blit(const Context *context,
angle::Result Framebuffer::blit(const Context *context,
const Rectangle &sourceArea,
const Rectangle &destArea,
GLbitfield mask,
......@@ -1479,7 +1482,7 @@ Error Framebuffer::blit(const Context *context,
if (!blitMask)
{
return NoError();
return angle::Result::Continue();
}
auto *sourceFBO = context->getGLState().getReadFramebuffer();
......@@ -1518,10 +1521,12 @@ int Framebuffer::getCachedSamples(const Context *context)
return 0;
}
Error Framebuffer::getSamplePosition(const Context *context, size_t index, GLfloat *xy) const
angle::Result Framebuffer::getSamplePosition(const Context *context,
size_t index,
GLfloat *xy) const
{
ANGLE_TRY(mImpl->getSamplePosition(context, index, xy));
return NoError();
return angle::Result::Continue();
}
bool Framebuffer::hasValidDepthStencil() const
......@@ -2010,12 +2015,13 @@ bool Framebuffer::readDisallowedByMultiview() const
mState.getMultiviewLayout() == GL_FRAMEBUFFER_MULTIVIEW_SIDE_BY_SIDE_ANGLE;
}
Error Framebuffer::ensureClearAttachmentsInitialized(const Context *context, GLbitfield mask)
angle::Result Framebuffer::ensureClearAttachmentsInitialized(const Context *context,
GLbitfield mask)
{
const auto &glState = context->getGLState();
if (!context->isRobustResourceInitEnabled() || glState.isRasterizerDiscardEnabled())
{
return NoError();
return angle::Result::Continue();
}
const BlendState &blend = glState.getBlendState();
......@@ -2027,7 +2033,7 @@ Error Framebuffer::ensureClearAttachmentsInitialized(const Context *context, GLb
if (!color && !depth && !stencil)
{
return NoError();
return angle::Result::Continue();
}
if (partialClearNeedsInit(context, color, depth, stencil))
......@@ -2040,10 +2046,10 @@ Error Framebuffer::ensureClearAttachmentsInitialized(const Context *context, GLb
// the clear.
markDrawAttachmentsInitialized(color, depth, stencil);
return NoError();
return angle::Result::Continue();
}
Error Framebuffer::ensureClearBufferAttachmentsInitialized(const Context *context,
angle::Result Framebuffer::ensureClearBufferAttachmentsInitialized(const Context *context,
GLenum buffer,
GLint drawbuffer)
{
......@@ -2051,7 +2057,7 @@ Error Framebuffer::ensureClearBufferAttachmentsInitialized(const Context *contex
context->getGLState().isRasterizerDiscardEnabled() ||
IsClearBufferMaskedOut(context, buffer))
{
return NoError();
return angle::Result::Continue();
}
if (partialBufferClearNeedsInit(context, buffer))
......@@ -2064,7 +2070,7 @@ Error Framebuffer::ensureClearBufferAttachmentsInitialized(const Context *contex
// the clear.
markBufferInitialized(buffer, drawbuffer);
return NoError();
return angle::Result::Continue();
}
angle::Result Framebuffer::ensureDrawAttachmentsInitialized(const Context *context)
......@@ -2095,11 +2101,12 @@ angle::Result Framebuffer::ensureDrawAttachmentsInitialized(const Context *conte
return angle::Result::Continue();
}
Error Framebuffer::ensureReadAttachmentInitialized(const Context *context, GLbitfield blitMask)
angle::Result Framebuffer::ensureReadAttachmentInitialized(const Context *context,
GLbitfield blitMask)
{
if (!context->isRobustResourceInitEnabled() || mState.mResourceNeedsInit.none())
{
return NoError();
return angle::Result::Continue();
}
if ((blitMask & GL_COLOR_BUFFER_BIT) != 0 && mState.mReadBufferState != GL_NONE)
......@@ -2130,7 +2137,7 @@ Error Framebuffer::ensureReadAttachmentInitialized(const Context *context, GLbit
}
}
return NoError();
return angle::Result::Continue();
}
void Framebuffer::markDrawAttachmentsInitialized(bool color, bool depth, bool stencil)
......@@ -2217,7 +2224,7 @@ Box Framebuffer::getDimensions() const
return mState.getDimensions();
}
Error Framebuffer::ensureBufferInitialized(const Context *context,
angle::Result Framebuffer::ensureBufferInitialized(const Context *context,
GLenum bufferType,
GLint bufferIndex)
{
......@@ -2225,7 +2232,7 @@ Error Framebuffer::ensureBufferInitialized(const Context *context,
if (mState.mResourceNeedsInit.none())
{
return NoError();
return angle::Result::Continue();
}
switch (bufferType)
......@@ -2277,7 +2284,7 @@ Error Framebuffer::ensureBufferInitialized(const Context *context,
break;
}
return NoError();
return angle::Result::Continue();
}
bool Framebuffer::partialBufferClearNeedsInit(const Context *context, GLenum bufferType)
......
......@@ -235,7 +235,7 @@ class Framebuffer final : public angle::ObserverInterface,
// This method calls checkStatus.
int getSamples(const Context *context);
Error getSamplePosition(const Context *context, size_t index, GLfloat *xy) const;
angle::Result getSamplePosition(const Context *context, size_t index, GLfloat *xy) const;
GLint getDefaultWidth() const;
GLint getDefaultHeight() const;
......@@ -274,43 +274,43 @@ class Framebuffer final : public angle::ObserverInterface,
bool hasValidDepthStencil() const;
Error discard(const Context *context, size_t count, const GLenum *attachments);
Error invalidate(const Context *context, size_t count, const GLenum *attachments);
Error invalidateSub(const Context *context,
angle::Result discard(const Context *context, size_t count, const GLenum *attachments);
angle::Result invalidate(const Context *context, size_t count, const GLenum *attachments);
angle::Result invalidateSub(const Context *context,
size_t count,
const GLenum *attachments,
const Rectangle &area);
Error clear(const Context *context, GLbitfield mask);
Error clearBufferfv(const Context *context,
angle::Result clear(const Context *context, GLbitfield mask);
angle::Result clearBufferfv(const Context *context,
GLenum buffer,
GLint drawbuffer,
const GLfloat *values);
Error clearBufferuiv(const Context *context,
angle::Result clearBufferuiv(const Context *context,
GLenum buffer,
GLint drawbuffer,
const GLuint *values);
Error clearBufferiv(const Context *context,
angle::Result clearBufferiv(const Context *context,
GLenum buffer,
GLint drawbuffer,
const GLint *values);
Error clearBufferfi(const Context *context,
angle::Result clearBufferfi(const Context *context,
GLenum buffer,
GLint drawbuffer,
GLfloat depth,
GLint stencil);
// These two methods call syncState() internally.
Error getImplementationColorReadFormat(const Context *context, GLenum *formatOut);
Error getImplementationColorReadType(const Context *context, GLenum *typeOut);
angle::Result getImplementationColorReadFormat(const Context *context, GLenum *formatOut);
angle::Result getImplementationColorReadType(const Context *context, GLenum *typeOut);
Error readPixels(const Context *context,
angle::Result readPixels(const Context *context,
const Rectangle &area,
GLenum format,
GLenum type,
void *pixels);
Error blit(const Context *context,
angle::Result blit(const Context *context,
const Rectangle &sourceArea,
const Rectangle &destArea,
GLbitfield mask,
......@@ -350,12 +350,12 @@ class Framebuffer final : public angle::ObserverInterface,
GLint copyTextureLevel,
GLint copyTextureLayer) const;
Error ensureClearAttachmentsInitialized(const Context *context, GLbitfield mask);
Error ensureClearBufferAttachmentsInitialized(const Context *context,
angle::Result ensureClearAttachmentsInitialized(const Context *context, GLbitfield mask);
angle::Result ensureClearBufferAttachmentsInitialized(const Context *context,
GLenum buffer,
GLint drawbuffer);
angle::Result ensureDrawAttachmentsInitialized(const Context *context);
Error ensureReadAttachmentInitialized(const Context *context, GLbitfield blitMask);
angle::Result ensureReadAttachmentInitialized(const Context *context, GLbitfield blitMask);
Box getDimensions() const;
private:
......@@ -404,7 +404,9 @@ class Framebuffer final : public angle::ObserverInterface,
void markDrawAttachmentsInitialized(bool color, bool depth, bool stencil);
void markBufferInitialized(GLenum bufferType, GLint bufferIndex);
Error ensureBufferInitialized(const Context *context, GLenum bufferType, GLint bufferIndex);
angle::Result ensureBufferInitialized(const Context *context,
GLenum bufferType,
GLint bufferIndex);
// Checks that we have a partially masked clear:
// * some color channels are masked out
......
......@@ -33,31 +33,31 @@ class FramebufferImpl : angle::NonCopyable
virtual ~FramebufferImpl() {}
virtual void destroy(const gl::Context *context) {}
virtual gl::Error discard(const gl::Context *context,
virtual angle::Result discard(const gl::Context *context,
size_t count,
const GLenum *attachments) = 0;
virtual gl::Error invalidate(const gl::Context *context,
virtual angle::Result invalidate(const gl::Context *context,
size_t count,
const GLenum *attachments) = 0;
virtual gl::Error invalidateSub(const gl::Context *context,
virtual angle::Result invalidateSub(const gl::Context *context,
size_t count,
const GLenum *attachments,
const gl::Rectangle &area) = 0;
virtual gl::Error clear(const gl::Context *context, GLbitfield mask) = 0;
virtual gl::Error clearBufferfv(const gl::Context *context,
virtual angle::Result clear(const gl::Context *context, GLbitfield mask) = 0;
virtual angle::Result clearBufferfv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLfloat *values) = 0;
virtual gl::Error clearBufferuiv(const gl::Context *context,
virtual angle::Result clearBufferuiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLuint *values) = 0;
virtual gl::Error clearBufferiv(const gl::Context *context,
virtual angle::Result clearBufferiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLint *values) = 0;
virtual gl::Error clearBufferfi(const gl::Context *context,
virtual angle::Result clearBufferfi(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
GLfloat depth,
......@@ -65,13 +65,13 @@ class FramebufferImpl : angle::NonCopyable
virtual GLenum getImplementationColorReadFormat(const gl::Context *context) const = 0;
virtual GLenum getImplementationColorReadType(const gl::Context *context) const = 0;
virtual gl::Error readPixels(const gl::Context *context,
virtual angle::Result readPixels(const gl::Context *context,
const gl::Rectangle &area,
GLenum format,
GLenum type,
void *pixels) = 0;
virtual gl::Error blit(const gl::Context *context,
virtual angle::Result blit(const gl::Context *context,
const gl::Rectangle &sourceArea,
const gl::Rectangle &destArea,
GLbitfield mask,
......@@ -82,7 +82,7 @@ class FramebufferImpl : angle::NonCopyable
virtual angle::Result syncState(const gl::Context *context,
const gl::Framebuffer::DirtyBits &dirtyBits) = 0;
virtual gl::Error getSamplePosition(const gl::Context *context,
virtual angle::Result getSamplePosition(const gl::Context *context,
size_t index,
GLfloat *xy) const = 0;
......
......@@ -23,26 +23,26 @@ class MockFramebufferImpl : public rx::FramebufferImpl
MockFramebufferImpl() : rx::FramebufferImpl(gl::FramebufferState()) {}
virtual ~MockFramebufferImpl() { destructor(); }
MOCK_METHOD3(discard, gl::Error(const gl::Context *, size_t, const GLenum *));
MOCK_METHOD3(invalidate, gl::Error(const gl::Context *, size_t, const GLenum *));
MOCK_METHOD3(discard, angle::Result(const gl::Context *, size_t, const GLenum *));
MOCK_METHOD3(invalidate, angle::Result(const gl::Context *, size_t, const GLenum *));
MOCK_METHOD4(invalidateSub,
gl::Error(const gl::Context *, size_t, const GLenum *, const gl::Rectangle &));
angle::Result(const gl::Context *, size_t, const GLenum *, const gl::Rectangle &));
MOCK_METHOD2(clear, gl::Error(const gl::Context *, GLbitfield));
MOCK_METHOD4(clearBufferfv, gl::Error(const gl::Context *, GLenum, GLint, const GLfloat *));
MOCK_METHOD4(clearBufferuiv, gl::Error(const gl::Context *, GLenum, GLint, const GLuint *));
MOCK_METHOD4(clearBufferiv, gl::Error(const gl::Context *, GLenum, GLint, const GLint *));
MOCK_METHOD5(clearBufferfi, gl::Error(const gl::Context *, GLenum, GLint, GLfloat, GLint));
MOCK_METHOD2(clear, angle::Result(const gl::Context *, GLbitfield));
MOCK_METHOD4(clearBufferfv, angle::Result(const gl::Context *, GLenum, GLint, const GLfloat *));
MOCK_METHOD4(clearBufferuiv, angle::Result(const gl::Context *, GLenum, GLint, const GLuint *));
MOCK_METHOD4(clearBufferiv, angle::Result(const gl::Context *, GLenum, GLint, const GLint *));
MOCK_METHOD5(clearBufferfi, angle::Result(const gl::Context *, GLenum, GLint, GLfloat, GLint));
MOCK_CONST_METHOD1(getImplementationColorReadFormat, GLenum(const gl::Context *));
MOCK_CONST_METHOD1(getImplementationColorReadType, GLenum(const gl::Context *));
MOCK_METHOD5(readPixels,
gl::Error(const gl::Context *, const gl::Rectangle &, GLenum, GLenum, void *));
angle::Result(const gl::Context *, const gl::Rectangle &, GLenum, GLenum, void *));
MOCK_CONST_METHOD3(getSamplePosition, gl::Error(const gl::Context *, size_t, GLfloat *));
MOCK_CONST_METHOD3(getSamplePosition, angle::Result(const gl::Context *, size_t, GLfloat *));
MOCK_METHOD5(blit,
gl::Error(const gl::Context *,
angle::Result(const gl::Context *,
const gl::Rectangle &,
const gl::Rectangle &,
GLbitfield,
......
......@@ -101,13 +101,13 @@ FramebufferD3D::~FramebufferD3D()
{
}
gl::Error FramebufferD3D::clear(const gl::Context *context, GLbitfield mask)
angle::Result FramebufferD3D::clear(const gl::Context *context, GLbitfield mask)
{
ClearParameters clearParams = GetClearParameters(context->getGLState(), mask);
return clearImpl(context, clearParams);
}
gl::Error FramebufferD3D::clearBufferfv(const gl::Context *context,
angle::Result FramebufferD3D::clearBufferfv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLfloat *values)
......@@ -134,7 +134,7 @@ gl::Error FramebufferD3D::clearBufferfv(const gl::Context *context,
return clearImpl(context, clearParams);
}
gl::Error FramebufferD3D::clearBufferuiv(const gl::Context *context,
angle::Result FramebufferD3D::clearBufferuiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLuint *values)
......@@ -151,7 +151,7 @@ gl::Error FramebufferD3D::clearBufferuiv(const gl::Context *context,
return clearImpl(context, clearParams);
}
gl::Error FramebufferD3D::clearBufferiv(const gl::Context *context,
angle::Result FramebufferD3D::clearBufferiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLint *values)
......@@ -178,7 +178,7 @@ gl::Error FramebufferD3D::clearBufferiv(const gl::Context *context,
return clearImpl(context, clearParams);
}
gl::Error FramebufferD3D::clearBufferfi(const gl::Context *context,
angle::Result FramebufferD3D::clearBufferfi(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
GLfloat depth,
......@@ -240,8 +240,8 @@ GLenum FramebufferD3D::getImplementationColorReadType(const gl::Context *context
return implementationFormatInfo.getReadPixelsType(context->getClientVersion());
}
gl::Error FramebufferD3D::readPixels(const gl::Context *context,
const gl::Rectangle &origArea,
angle::Result FramebufferD3D::readPixels(const gl::Context *context,
const gl::Rectangle &area,
GLenum format,
GLenum type,
void *pixels)
......@@ -249,11 +249,11 @@ gl::Error FramebufferD3D::readPixels(const gl::Context *context,
// Clip read area to framebuffer.
const gl::Extents fbSize = getState().getReadAttachment()->getSize();
const gl::Rectangle fbRect(0, 0, fbSize.width, fbSize.height);
gl::Rectangle area;
if (!ClipRectangle(origArea, fbRect, &area))
gl::Rectangle clippedArea;
if (!ClipRectangle(area, fbRect, &clippedArea))
{
// nothing to read
return gl::NoError();
return angle::Result::Continue();
}
const gl::PixelPackState &packState = context->getGLState().getPackState();
......@@ -264,20 +264,20 @@ gl::Error FramebufferD3D::readPixels(const gl::Context *context,
GLuint outputPitch = 0;
ANGLE_CHECK_HR_MATH(contextD3D,
sizedFormatInfo.computeRowPitch(type, origArea.width, packState.alignment,
sizedFormatInfo.computeRowPitch(type, area.width, packState.alignment,
packState.rowLength, &outputPitch));
GLuint outputSkipBytes = 0;
ANGLE_CHECK_HR_MATH(contextD3D, sizedFormatInfo.computeSkipBytes(
type, outputPitch, 0, packState, false, &outputSkipBytes));
outputSkipBytes +=
(area.x - origArea.x) * sizedFormatInfo.pixelBytes + (area.y - origArea.y) * outputPitch;
outputSkipBytes += (clippedArea.x - area.x) * sizedFormatInfo.pixelBytes +
(clippedArea.y - area.y) * outputPitch;
return readPixelsImpl(context, area, format, type, outputPitch, packState,
return readPixelsImpl(context, clippedArea, format, type, outputPitch, packState,
static_cast<uint8_t *>(pixels) + outputSkipBytes);
}
gl::Error FramebufferD3D::blit(const gl::Context *context,
angle::Result FramebufferD3D::blit(const gl::Context *context,
const gl::Rectangle &sourceArea,
const gl::Rectangle &destArea,
GLbitfield mask,
......@@ -290,7 +290,7 @@ gl::Error FramebufferD3D::blit(const gl::Context *context,
(mask & GL_DEPTH_BUFFER_BIT) != 0, (mask & GL_STENCIL_BUFFER_BIT) != 0,
filter, sourceFramebuffer));
return gl::NoError();
return angle::Result::Continue();
}
bool FramebufferD3D::checkStatus(const gl::Context *context) const
......
......@@ -62,20 +62,20 @@ class FramebufferD3D : public FramebufferImpl
FramebufferD3D(const gl::FramebufferState &data, RendererD3D *renderer);
~FramebufferD3D() override;
gl::Error clear(const gl::Context *context, GLbitfield mask) override;
gl::Error clearBufferfv(const gl::Context *context,
angle::Result clear(const gl::Context *context, GLbitfield mask) override;
angle::Result clearBufferfv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLfloat *values) override;
gl::Error clearBufferuiv(const gl::Context *context,
angle::Result clearBufferuiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLuint *values) override;
gl::Error clearBufferiv(const gl::Context *context,
angle::Result clearBufferiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLint *values) override;
gl::Error clearBufferfi(const gl::Context *context,
angle::Result clearBufferfi(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
GLfloat depth,
......@@ -83,13 +83,13 @@ class FramebufferD3D : public FramebufferImpl
GLenum getImplementationColorReadFormat(const gl::Context *context) const override;
GLenum getImplementationColorReadType(const gl::Context *context) const override;
gl::Error readPixels(const gl::Context *context,
angle::Result readPixels(const gl::Context *context,
const gl::Rectangle &area,
GLenum format,
GLenum type,
void *pixels) override;
gl::Error blit(const gl::Context *context,
angle::Result blit(const gl::Context *context,
const gl::Rectangle &sourceArea,
const gl::Rectangle &destArea,
GLbitfield mask,
......
......@@ -113,14 +113,14 @@ angle::Result Framebuffer11::clearImpl(const gl::Context *context,
return angle::Result::Continue();
}
gl::Error Framebuffer11::invalidate(const gl::Context *context,
angle::Result Framebuffer11::invalidate(const gl::Context *context,
size_t count,
const GLenum *attachments)
{
return invalidateBase(context, count, attachments, false);
}
gl::Error Framebuffer11::discard(const gl::Context *context,
angle::Result Framebuffer11::discard(const gl::Context *context,
size_t count,
const GLenum *attachments)
{
......@@ -219,13 +219,13 @@ angle::Result Framebuffer11::invalidateBase(const gl::Context *context,
return angle::Result::Continue();
}
gl::Error Framebuffer11::invalidateSub(const gl::Context *context,
size_t,
const GLenum *,
const gl::Rectangle &)
angle::Result Framebuffer11::invalidateSub(const gl::Context *context,
size_t count,
const GLenum *attachments,
const gl::Rectangle &area)
{
// A no-op implementation conforms to the spec, so don't call UNIMPLEMENTED()
return gl::NoError();
return angle::Result::Continue();
}
angle::Result Framebuffer11::invalidateAttachment(const gl::Context *context,
......@@ -397,7 +397,7 @@ angle::Result Framebuffer11::syncState(const gl::Context *context,
return angle::Result::Continue();
}
gl::Error Framebuffer11::getSamplePosition(const gl::Context *context,
angle::Result Framebuffer11::getSamplePosition(const gl::Context *context,
size_t index,
GLfloat *xy) const
{
......@@ -406,7 +406,7 @@ gl::Error Framebuffer11::getSamplePosition(const gl::Context *context,
GLsizei sampleCount = attachment->getSamples();
d3d11_gl::GetSamplePosition(sampleCount, index, xy);
return gl::NoError();
return angle::Result::Continue();
}
RenderTarget11 *Framebuffer11::getFirstRenderTarget() const
......
......@@ -24,11 +24,13 @@ class Framebuffer11 : public FramebufferD3D
Framebuffer11(const gl::FramebufferState &data, Renderer11 *renderer);
~Framebuffer11() override;
gl::Error discard(const gl::Context *context, size_t count, const GLenum *attachments) override;
gl::Error invalidate(const gl::Context *context,
angle::Result discard(const gl::Context *context,
size_t count,
const GLenum *attachments) override;
gl::Error invalidateSub(const gl::Context *context,
angle::Result invalidate(const gl::Context *context,
size_t count,
const GLenum *attachments) override;
angle::Result invalidateSub(const gl::Context *context,
size_t count,
const GLenum *attachments,
const gl::Rectangle &area) override;
......@@ -50,7 +52,7 @@ class Framebuffer11 : public FramebufferD3D
RenderTarget11 *getFirstRenderTarget() const;
gl::Error getSamplePosition(const gl::Context *context,
angle::Result getSamplePosition(const gl::Context *context,
size_t index,
GLfloat *xy) const override;
......
......@@ -34,28 +34,29 @@ Framebuffer9::~Framebuffer9()
{
}
gl::Error Framebuffer9::discard(const gl::Context *context, size_t, const GLenum *)
angle::Result Framebuffer9::discard(const gl::Context *context,
size_t count,
const GLenum *attachments)
{
// Extension not implemented in D3D9 renderer
UNREACHABLE();
return gl::NoError();
ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
return angle::Result::Stop();
}
gl::Error Framebuffer9::invalidate(const gl::Context *context, size_t, const GLenum *)
angle::Result Framebuffer9::invalidate(const gl::Context *context,
size_t count,
const GLenum *attachments)
{
// Shouldn't ever reach here in D3D9
UNREACHABLE();
return gl::NoError();
ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
return angle::Result::Stop();
}
gl::Error Framebuffer9::invalidateSub(const gl::Context *context,
size_t,
const GLenum *,
const gl::Rectangle &)
angle::Result Framebuffer9::invalidateSub(const gl::Context *context,
size_t count,
const GLenum *attachments,
const gl::Rectangle &area)
{
// Shouldn't ever reach here in D3D9
UNREACHABLE();
return gl::NoError();
ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
return angle::Result::Stop();
}
angle::Result Framebuffer9::clearImpl(const gl::Context *context,
......@@ -390,12 +391,12 @@ GLenum Framebuffer9::getRenderTargetImplementationFormat(RenderTargetD3D *render
return d3dFormatInfo.info().glInternalFormat;
}
gl::Error Framebuffer9::getSamplePosition(const gl::Context *context,
angle::Result Framebuffer9::getSamplePosition(const gl::Context *context,
size_t index,
GLfloat *xy) const
{
UNREACHABLE();
return gl::InternalError() << "getSamplePosition is unsupported to d3d9.";
ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
return angle::Result::Stop();
}
angle::Result Framebuffer9::syncState(const gl::Context *context,
......
......@@ -23,16 +23,18 @@ class Framebuffer9 : public FramebufferD3D
Framebuffer9(const gl::FramebufferState &data, Renderer9 *renderer);
~Framebuffer9() override;
gl::Error discard(const gl::Context *context, size_t count, const GLenum *attachments) override;
gl::Error invalidate(const gl::Context *context,
angle::Result discard(const gl::Context *context,
size_t count,
const GLenum *attachments) override;
gl::Error invalidateSub(const gl::Context *context,
angle::Result invalidate(const gl::Context *context,
size_t count,
const GLenum *attachments) override;
angle::Result invalidateSub(const gl::Context *context,
size_t count,
const GLenum *attachments,
const gl::Rectangle &area) override;
gl::Error getSamplePosition(const gl::Context *context,
angle::Result getSamplePosition(const gl::Context *context,
size_t index,
GLfloat *xy) const override;
......
......@@ -210,13 +210,17 @@ void FramebufferGL::destroy(const gl::Context *context)
mFramebufferID = 0;
}
Error FramebufferGL::discard(const gl::Context *context, size_t count, const GLenum *attachments)
angle::Result FramebufferGL::discard(const gl::Context *context,
size_t count,
const GLenum *attachments)
{
// glInvalidateFramebuffer accepts the same enums as glDiscardFramebufferEXT
return invalidate(context, count, attachments);
}
Error FramebufferGL::invalidate(const gl::Context *context, size_t count, const GLenum *attachments)
angle::Result FramebufferGL::invalidate(const gl::Context *context,
size_t count,
const GLenum *attachments)
{
const GLenum *finalAttachmentsPtr = attachments;
......@@ -243,10 +247,10 @@ Error FramebufferGL::invalidate(const gl::Context *context, size_t count, const
finalAttachmentsPtr);
}
return gl::NoError();
return angle::Result::Continue();
}
Error FramebufferGL::invalidateSub(const gl::Context *context,
angle::Result FramebufferGL::invalidateSub(const gl::Context *context,
size_t count,
const GLenum *attachments,
const gl::Rectangle &area)
......@@ -273,10 +277,10 @@ Error FramebufferGL::invalidateSub(const gl::Context *context,
area.height);
}
return gl::NoError();
return angle::Result::Continue();
}
Error FramebufferGL::clear(const gl::Context *context, GLbitfield mask)
angle::Result FramebufferGL::clear(const gl::Context *context, GLbitfield mask)
{
const FunctionsGL *functions = GetFunctionsGL(context);
StateManagerGL *stateManager = GetStateManagerGL(context);
......@@ -296,10 +300,10 @@ Error FramebufferGL::clear(const gl::Context *context, GLbitfield mask)
GL_NONE, 0, nullptr, 0.0f, 0);
}
return gl::NoError();
return angle::Result::Continue();
}
Error FramebufferGL::clearBufferfv(const gl::Context *context,
angle::Result FramebufferGL::clearBufferfv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLfloat *values)
......@@ -323,10 +327,10 @@ Error FramebufferGL::clearBufferfv(const gl::Context *context,
reinterpret_cast<const uint8_t *>(values), 0.0f, 0);
}
return gl::NoError();
return angle::Result::Continue();
}
Error FramebufferGL::clearBufferuiv(const gl::Context *context,
angle::Result FramebufferGL::clearBufferuiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLuint *values)
......@@ -350,10 +354,10 @@ Error FramebufferGL::clearBufferuiv(const gl::Context *context,
reinterpret_cast<const uint8_t *>(values), 0.0f, 0);
}
return gl::NoError();
return angle::Result::Continue();
}
Error FramebufferGL::clearBufferiv(const gl::Context *context,
angle::Result FramebufferGL::clearBufferiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLint *values)
......@@ -377,10 +381,10 @@ Error FramebufferGL::clearBufferiv(const gl::Context *context,
reinterpret_cast<const uint8_t *>(values), 0.0f, 0);
}
return gl::NoError();
return angle::Result::Continue();
}
Error FramebufferGL::clearBufferfi(const gl::Context *context,
angle::Result FramebufferGL::clearBufferfi(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
GLfloat depth,
......@@ -405,7 +409,7 @@ Error FramebufferGL::clearBufferfi(const gl::Context *context,
nullptr, depth, stencil);
}
return gl::NoError();
return angle::Result::Continue();
}
GLenum FramebufferGL::getImplementationColorReadFormat(const gl::Context *context) const
......@@ -422,11 +426,11 @@ GLenum FramebufferGL::getImplementationColorReadType(const gl::Context *context)
return format.info->getReadPixelsType(context->getClientVersion());
}
Error FramebufferGL::readPixels(const gl::Context *context,
const gl::Rectangle &origArea,
angle::Result FramebufferGL::readPixels(const gl::Context *context,
const gl::Rectangle &area,
GLenum format,
GLenum type,
void *ptrOrOffset)
void *pixels)
{
ContextGL *contextGL = GetImplAs<ContextGL>(context);
const FunctionsGL *functions = GetFunctionsGL(context);
......@@ -436,11 +440,11 @@ Error FramebufferGL::readPixels(const gl::Context *context,
// Clip read area to framebuffer.
const gl::Extents fbSize = getState().getReadAttachment()->getSize();
const gl::Rectangle fbRect(0, 0, fbSize.width, fbSize.height);
gl::Rectangle area;
if (!ClipRectangle(origArea, fbRect, &area))
gl::Rectangle clippedArea;
if (!ClipRectangle(area, fbRect, &clippedArea))
{
// nothing to read
return gl::NoError();
return angle::Result::Continue();
}
PixelPackState packState = context->getGLState().getPackState();
......@@ -456,11 +460,11 @@ Error FramebufferGL::readPixels(const gl::Context *context,
bool useOverlappingRowsWorkaround = workarounds.packOverlappingRowsSeparatelyPackBuffer &&
packBuffer && packState.rowLength != 0 &&
packState.rowLength < area.width;
packState.rowLength < clippedArea.width;
GLubyte *pixels = static_cast<GLubyte *>(ptrOrOffset);
int leftClip = area.x - origArea.x;
int topClip = area.y - origArea.y;
GLubyte *outPtr = static_cast<GLubyte *>(pixels);
int leftClip = clippedArea.x - area.x;
int topClip = clippedArea.y - area.y;
if (leftClip || topClip)
{
// Adjust destination to match portion clipped off left and/or top.
......@@ -468,16 +472,16 @@ Error FramebufferGL::readPixels(const gl::Context *context,
GLuint rowBytes = 0;
ANGLE_CHECK_GL_MATH(contextGL,
glFormat.computeRowPitch(readType, origArea.width, packState.alignment,
glFormat.computeRowPitch(readType, area.width, packState.alignment,
packState.rowLength, &rowBytes));
pixels += leftClip * glFormat.pixelBytes + topClip * rowBytes;
outPtr += leftClip * glFormat.pixelBytes + topClip * rowBytes;
}
if (packState.rowLength == 0 && area.width != origArea.width)
if (packState.rowLength == 0 && clippedArea.width != area.width)
{
// No rowLength was specified so it will derive from read width, but clipping changed the
// read width. Use the original width so we fill the user's buffer as they intended.
packState.rowLength = origArea.width;
packState.rowLength = area.width;
}
// We want to use rowLength, but that might not be supported.
......@@ -486,22 +490,22 @@ Error FramebufferGL::readPixels(const gl::Context *context,
if (cannotSetDesiredRowLength || useOverlappingRowsWorkaround)
{
return readPixelsRowByRow(context, area, readFormat, readType, packState, pixels);
return readPixelsRowByRow(context, clippedArea, readFormat, readType, packState, outPtr);
}
bool useLastRowPaddingWorkaround = false;
if (workarounds.packLastRowSeparatelyForPaddingInclusion)
{
ANGLE_TRY(ShouldApplyLastRowPaddingWorkaround(
contextGL, gl::Extents(area.width, area.height, 1), packState, packBuffer, readFormat,
readType, false, pixels, &useLastRowPaddingWorkaround));
contextGL, gl::Extents(clippedArea.width, clippedArea.height, 1), packState, packBuffer,
readFormat, readType, false, outPtr, &useLastRowPaddingWorkaround));
}
return readPixelsAllAtOnce(context, area, readFormat, readType, packState, pixels,
return readPixelsAllAtOnce(context, clippedArea, readFormat, readType, packState, outPtr,
useLastRowPaddingWorkaround);
}
Error FramebufferGL::blit(const gl::Context *context,
angle::Result FramebufferGL::blit(const gl::Context *context,
const gl::Rectangle &sourceArea,
const gl::Rectangle &destArea,
GLbitfield mask,
......@@ -579,7 +583,7 @@ Error FramebufferGL::blit(const gl::Context *context,
if (blitMask == 0)
{
return gl::NoError();
return angle::Result::Continue();
}
const FramebufferGL *sourceFramebufferGL = GetImplAs<FramebufferGL>(sourceFramebuffer);
......@@ -590,10 +594,10 @@ Error FramebufferGL::blit(const gl::Context *context,
destArea.x, destArea.y, destArea.x1(), destArea.y1(), blitMask,
filter);
return gl::NoError();
return angle::Result::Continue();
}
gl::Error FramebufferGL::getSamplePosition(const gl::Context *context,
angle::Result FramebufferGL::getSamplePosition(const gl::Context *context,
size_t index,
GLfloat *xy) const
{
......@@ -602,7 +606,7 @@ gl::Error FramebufferGL::getSamplePosition(const gl::Context *context,
stateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
functions->getMultisamplefv(GL_SAMPLE_POSITION, static_cast<GLuint>(index), xy);
return gl::NoError();
return angle::Result::Continue();
}
bool FramebufferGL::checkStatus(const gl::Context *context) const
......
......@@ -28,29 +28,31 @@ class FramebufferGL : public FramebufferImpl
void destroy(const gl::Context *context) override;
gl::Error discard(const gl::Context *context, size_t count, const GLenum *attachments) override;
gl::Error invalidate(const gl::Context *context,
angle::Result discard(const gl::Context *context,
size_t count,
const GLenum *attachments) override;
gl::Error invalidateSub(const gl::Context *context,
angle::Result invalidate(const gl::Context *context,
size_t count,
const GLenum *attachments) override;
angle::Result invalidateSub(const gl::Context *context,
size_t count,
const GLenum *attachments,
const gl::Rectangle &area) override;
gl::Error clear(const gl::Context *context, GLbitfield mask) override;
gl::Error clearBufferfv(const gl::Context *context,
angle::Result clear(const gl::Context *context, GLbitfield mask) override;
angle::Result clearBufferfv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLfloat *values) override;
gl::Error clearBufferuiv(const gl::Context *context,
angle::Result clearBufferuiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLuint *values) override;
gl::Error clearBufferiv(const gl::Context *context,
angle::Result clearBufferiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLint *values) override;
gl::Error clearBufferfi(const gl::Context *context,
angle::Result clearBufferfi(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
GLfloat depth,
......@@ -59,19 +61,19 @@ class FramebufferGL : public FramebufferImpl
GLenum getImplementationColorReadFormat(const gl::Context *context) const override;
GLenum getImplementationColorReadType(const gl::Context *context) const override;
gl::Error readPixels(const gl::Context *context,
angle::Result readPixels(const gl::Context *context,
const gl::Rectangle &area,
GLenum format,
GLenum type,
void *pixels) override;
gl::Error blit(const gl::Context *context,
angle::Result blit(const gl::Context *context,
const gl::Rectangle &sourceArea,
const gl::Rectangle &destArea,
GLbitfield mask,
GLenum filter) override;
gl::Error getSamplePosition(const gl::Context *context,
angle::Result getSamplePosition(const gl::Context *context,
size_t index,
GLfloat *xy) const override;
......
......@@ -26,64 +26,64 @@ FramebufferNULL::~FramebufferNULL()
{
}
gl::Error FramebufferNULL::discard(const gl::Context *context,
angle::Result FramebufferNULL::discard(const gl::Context *context,
size_t count,
const GLenum *attachments)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error FramebufferNULL::invalidate(const gl::Context *context,
angle::Result FramebufferNULL::invalidate(const gl::Context *context,
size_t count,
const GLenum *attachments)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error FramebufferNULL::invalidateSub(const gl::Context *context,
angle::Result FramebufferNULL::invalidateSub(const gl::Context *context,
size_t count,
const GLenum *attachments,
const gl::Rectangle &area)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error FramebufferNULL::clear(const gl::Context *context, GLbitfield mask)
angle::Result FramebufferNULL::clear(const gl::Context *context, GLbitfield mask)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error FramebufferNULL::clearBufferfv(const gl::Context *context,
angle::Result FramebufferNULL::clearBufferfv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLfloat *values)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error FramebufferNULL::clearBufferuiv(const gl::Context *context,
angle::Result FramebufferNULL::clearBufferuiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLuint *values)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error FramebufferNULL::clearBufferiv(const gl::Context *context,
angle::Result FramebufferNULL::clearBufferiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLint *values)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error FramebufferNULL::clearBufferfi(const gl::Context *context,
angle::Result FramebufferNULL::clearBufferfi(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
GLfloat depth,
GLint stencil)
{
return gl::NoError();
return angle::Result::Continue();
}
GLenum FramebufferNULL::getImplementationColorReadFormat(const gl::Context *context) const
......@@ -112,7 +112,7 @@ GLenum FramebufferNULL::getImplementationColorReadType(const gl::Context *contex
return format.info->getReadPixelsType(context->getClientVersion());
}
gl::Error FramebufferNULL::readPixels(const gl::Context *context,
angle::Result FramebufferNULL::readPixels(const gl::Context *context,
const gl::Rectangle &origArea,
GLenum format,
GLenum type,
......@@ -141,7 +141,7 @@ gl::Error FramebufferNULL::readPixels(const gl::Context *context,
if (!ClipRectangle(origArea, fbRect, &area))
{
// nothing to read
return gl::NoError();
return angle::Result::Continue();
}
// Compute size of unclipped rows and initial skip
......@@ -171,16 +171,16 @@ gl::Error FramebufferNULL::readPixels(const gl::Context *context,
pixels += rowBytes;
}
return gl::NoError();
return angle::Result::Continue();
}
gl::Error FramebufferNULL::blit(const gl::Context *context,
angle::Result FramebufferNULL::blit(const gl::Context *context,
const gl::Rectangle &sourceArea,
const gl::Rectangle &destArea,
GLbitfield mask,
GLenum filter)
{
return gl::NoError();
return angle::Result::Continue();
}
bool FramebufferNULL::checkStatus(const gl::Context *context) const
......@@ -194,11 +194,11 @@ angle::Result FramebufferNULL::syncState(const gl::Context *context,
return angle::Result::Continue();
}
gl::Error FramebufferNULL::getSamplePosition(const gl::Context *context,
angle::Result FramebufferNULL::getSamplePosition(const gl::Context *context,
size_t index,
GLfloat *xy) const
{
return gl::NoError();
return angle::Result::Continue();
}
} // namespace rx
......@@ -21,29 +21,31 @@ class FramebufferNULL : public FramebufferImpl
FramebufferNULL(const gl::FramebufferState &state);
~FramebufferNULL() override;
gl::Error discard(const gl::Context *context, size_t count, const GLenum *attachments) override;
gl::Error invalidate(const gl::Context *context,
angle::Result discard(const gl::Context *context,
size_t count,
const GLenum *attachments) override;
gl::Error invalidateSub(const gl::Context *context,
angle::Result invalidate(const gl::Context *context,
size_t count,
const GLenum *attachments) override;
angle::Result invalidateSub(const gl::Context *context,
size_t count,
const GLenum *attachments,
const gl::Rectangle &area) override;
gl::Error clear(const gl::Context *context, GLbitfield mask) override;
gl::Error clearBufferfv(const gl::Context *context,
angle::Result clear(const gl::Context *context, GLbitfield mask) override;
angle::Result clearBufferfv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLfloat *values) override;
gl::Error clearBufferuiv(const gl::Context *context,
angle::Result clearBufferuiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLuint *values) override;
gl::Error clearBufferiv(const gl::Context *context,
angle::Result clearBufferiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLint *values) override;
gl::Error clearBufferfi(const gl::Context *context,
angle::Result clearBufferfi(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
GLfloat depth,
......@@ -51,13 +53,13 @@ class FramebufferNULL : public FramebufferImpl
GLenum getImplementationColorReadFormat(const gl::Context *context) const override;
GLenum getImplementationColorReadType(const gl::Context *context) const override;
gl::Error readPixels(const gl::Context *context,
angle::Result readPixels(const gl::Context *context,
const gl::Rectangle &area,
GLenum format,
GLenum type,
void *pixels) override;
gl::Error blit(const gl::Context *context,
angle::Result blit(const gl::Context *context,
const gl::Rectangle &sourceArea,
const gl::Rectangle &destArea,
GLbitfield mask,
......@@ -68,7 +70,7 @@ class FramebufferNULL : public FramebufferImpl
angle::Result syncState(const gl::Context *context,
const gl::Framebuffer::DirtyBits &dirtyBits) override;
gl::Error getSamplePosition(const gl::Context *context,
angle::Result getSamplePosition(const gl::Context *context,
size_t index,
GLfloat *xy) const override;
};
......
......@@ -142,32 +142,32 @@ void FramebufferVk::destroy(const gl::Context *context)
mBlitPixelBuffer.destroy(contextVk->getDevice());
}
gl::Error FramebufferVk::discard(const gl::Context *context,
angle::Result FramebufferVk::discard(const gl::Context *context,
size_t count,
const GLenum *attachments)
{
UNIMPLEMENTED();
return gl::InternalError();
ANGLE_VK_UNREACHABLE(vk::GetImpl(context));
return angle::Result::Stop();
}
gl::Error FramebufferVk::invalidate(const gl::Context *context,
angle::Result FramebufferVk::invalidate(const gl::Context *context,
size_t count,
const GLenum *attachments)
{
UNIMPLEMENTED();
return gl::InternalError();
ANGLE_VK_UNREACHABLE(vk::GetImpl(context));
return angle::Result::Stop();
}
gl::Error FramebufferVk::invalidateSub(const gl::Context *context,
angle::Result FramebufferVk::invalidateSub(const gl::Context *context,
size_t count,
const GLenum *attachments,
const gl::Rectangle &area)
{
UNIMPLEMENTED();
return gl::InternalError();
ANGLE_VK_UNREACHABLE(vk::GetImpl(context));
return angle::Result::Stop();
}
gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask)
angle::Result FramebufferVk::clear(const gl::Context *context, GLbitfield mask)
{
ContextVk *contextVk = vk::GetImpl(context);
......@@ -207,7 +207,7 @@ gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask)
// TODO(jmadill): Masked stencil clear. http://anglebug.com/2540
ANGLE_TRY(clearWithClearAttachments(contextVk, false, clearDepth, clearStencil));
}
return gl::NoError();
return angle::Result::Continue();
}
// If we clear the depth OR the stencil but not both, and we have a packed depth stencil
......@@ -226,7 +226,7 @@ gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask)
// Masked stencil clears are currently not implemented.
// TODO(jmadill): Masked stencil clear. http://anglebug.com/2540
ANGLE_TRY(clearWithClearAttachments(contextVk, clearColor, clearDepth, clearStencil));
return gl::NoError();
return angle::Result::Continue();
}
// Standard Depth/stencil clear without scissor.
......@@ -247,7 +247,7 @@ gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask)
if (!clearColor)
{
return gl::NoError();
return angle::Result::Continue();
}
const auto *attachment = mState.getFirstNonNullAttachment();
......@@ -283,44 +283,44 @@ gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask)
colorRenderTarget->getLayerIndex(), 1, commandBuffer);
}
return gl::NoError();
return angle::Result::Continue();
}
gl::Error FramebufferVk::clearBufferfv(const gl::Context *context,
angle::Result FramebufferVk::clearBufferfv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLfloat *values)
{
UNIMPLEMENTED();
return gl::InternalError();
ANGLE_VK_UNREACHABLE(vk::GetImpl(context));
return angle::Result::Stop();
}
gl::Error FramebufferVk::clearBufferuiv(const gl::Context *context,
angle::Result FramebufferVk::clearBufferuiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLuint *values)
{
UNIMPLEMENTED();
return gl::InternalError();
ANGLE_VK_UNREACHABLE(vk::GetImpl(context));
return angle::Result::Stop();
}
gl::Error FramebufferVk::clearBufferiv(const gl::Context *context,
angle::Result FramebufferVk::clearBufferiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLint *values)
{
UNIMPLEMENTED();
return gl::InternalError();
ANGLE_VK_UNREACHABLE(vk::GetImpl(context));
return angle::Result::Stop();
}
gl::Error FramebufferVk::clearBufferfi(const gl::Context *context,
angle::Result FramebufferVk::clearBufferfi(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
GLfloat depth,
GLint stencil)
{
UNIMPLEMENTED();
return gl::InternalError();
ANGLE_VK_UNREACHABLE(vk::GetImpl(context));
return angle::Result::Stop();
}
GLenum FramebufferVk::getImplementationColorReadFormat(const gl::Context *context) const
......@@ -333,7 +333,7 @@ GLenum FramebufferVk::getImplementationColorReadType(const gl::Context *context)
return GetReadAttachmentInfo(context, mRenderTargetCache.getColorRead(mState)).type;
}
gl::Error FramebufferVk::readPixels(const gl::Context *context,
angle::Result FramebufferVk::readPixels(const gl::Context *context,
const gl::Rectangle &area,
GLenum format,
GLenum type,
......@@ -349,7 +349,7 @@ gl::Error FramebufferVk::readPixels(const gl::Context *context,
if (!ClipRectangle(area, fbRect, &clippedArea))
{
// nothing to read
return gl::NoError();
return angle::Result::Continue();
}
gl::Rectangle flippedArea = clippedArea;
if (contextVk->isViewportFlipEnabledForReadFBO())
......@@ -386,7 +386,7 @@ gl::Error FramebufferVk::readPixels(const gl::Context *context,
getColorReadRenderTarget(),
static_cast<uint8_t *>(pixels) + outputSkipBytes));
mReadPixelBuffer.releaseRetainedBuffers(renderer);
return gl::NoError();
return angle::Result::Continue();
}
RenderTargetVk *FramebufferVk::getDepthStencilRenderTarget() const
......@@ -497,7 +497,7 @@ angle::Result FramebufferVk::blitWithReadback(ContextVk *contextVk,
return angle::Result::Continue();
}
gl::Error FramebufferVk::blit(const gl::Context *context,
angle::Result FramebufferVk::blit(const gl::Context *context,
const gl::Rectangle &sourceArea,
const gl::Rectangle &destArea,
GLbitfield mask,
......@@ -524,12 +524,12 @@ gl::Error FramebufferVk::blit(const gl::Context *context,
const gl::Rectangle scissorRect = glState.getScissor();
if (!ClipRectangle(sourceArea, scissorRect, &readRect))
{
return gl::NoError();
return angle::Result::Continue();
}
if (!ClipRectangle(destArea, scissorRect, &drawRect))
{
return gl::NoError();
return angle::Result::Continue();
}
}
......@@ -542,7 +542,7 @@ gl::Error FramebufferVk::blit(const gl::Context *context,
gl::Rectangle readRenderTargetRect;
if (!ClipToRenderTarget(readRect, readRenderTarget, &readRenderTargetRect))
{
return gl::NoError();
return angle::Result::Continue();
}
for (size_t colorAttachment : mState.getEnabledDrawBuffers())
......@@ -555,7 +555,7 @@ gl::Error FramebufferVk::blit(const gl::Context *context,
gl::Rectangle drawRenderTargetRect;
if (!ClipToRenderTarget(drawRect, drawRenderTarget, &drawRenderTargetRect))
{
return gl::NoError();
return angle::Result::Continue();
}
ANGLE_TRY(blitWithCommand(contextVk, readRenderTargetRect, drawRenderTargetRect,
......@@ -572,7 +572,7 @@ gl::Error FramebufferVk::blit(const gl::Context *context,
gl::Rectangle readRenderTargetRect;
if (!ClipToRenderTarget(readRect, readRenderTarget, &readRenderTargetRect))
{
return gl::NoError();
return angle::Result::Continue();
}
RenderTargetVk *drawRenderTarget = mRenderTargetCache.getDepthStencil();
......@@ -581,7 +581,7 @@ gl::Error FramebufferVk::blit(const gl::Context *context,
gl::Rectangle drawRenderTargetRect;
if (!ClipToRenderTarget(drawRect, drawRenderTarget, &drawRenderTargetRect))
{
return gl::NoError();
return angle::Result::Continue();
}
ASSERT(readRenderTargetRect == drawRenderTargetRect);
......@@ -619,7 +619,7 @@ gl::Error FramebufferVk::blit(const gl::Context *context,
}
}
return gl::NoError();
return angle::Result::Continue();
}
angle::Result FramebufferVk::blitWithCommand(ContextVk *contextVk,
......@@ -1064,12 +1064,12 @@ angle::Result FramebufferVk::clearWithDraw(ContextVk *contextVk,
return angle::Result::Continue();
}
gl::Error FramebufferVk::getSamplePosition(const gl::Context *context,
angle::Result FramebufferVk::getSamplePosition(const gl::Context *context,
size_t index,
GLfloat *xy) const
{
UNIMPLEMENTED();
return gl::InternalError() << "getSamplePosition is unimplemented.";
ANGLE_VK_UNREACHABLE(vk::GetImpl(context));
return angle::Result::Stop();
}
angle::Result FramebufferVk::getCommandBufferForDraw(ContextVk *contextVk,
......
......@@ -38,29 +38,31 @@ class FramebufferVk : public FramebufferImpl
~FramebufferVk() override;
void destroy(const gl::Context *context) override;
gl::Error discard(const gl::Context *context, size_t count, const GLenum *attachments) override;
gl::Error invalidate(const gl::Context *context,
angle::Result discard(const gl::Context *context,
size_t count,
const GLenum *attachments) override;
gl::Error invalidateSub(const gl::Context *context,
angle::Result invalidate(const gl::Context *context,
size_t count,
const GLenum *attachments) override;
angle::Result invalidateSub(const gl::Context *context,
size_t count,
const GLenum *attachments,
const gl::Rectangle &area) override;
gl::Error clear(const gl::Context *context, GLbitfield mask) override;
gl::Error clearBufferfv(const gl::Context *context,
angle::Result clear(const gl::Context *context, GLbitfield mask) override;
angle::Result clearBufferfv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLfloat *values) override;
gl::Error clearBufferuiv(const gl::Context *context,
angle::Result clearBufferuiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLuint *values) override;
gl::Error clearBufferiv(const gl::Context *context,
angle::Result clearBufferiv(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
const GLint *values) override;
gl::Error clearBufferfi(const gl::Context *context,
angle::Result clearBufferfi(const gl::Context *context,
GLenum buffer,
GLint drawbuffer,
GLfloat depth,
......@@ -68,13 +70,13 @@ class FramebufferVk : public FramebufferImpl
GLenum getImplementationColorReadFormat(const gl::Context *context) const override;
GLenum getImplementationColorReadType(const gl::Context *context) const override;
gl::Error readPixels(const gl::Context *context,
angle::Result readPixels(const gl::Context *context,
const gl::Rectangle &area,
GLenum format,
GLenum type,
void *pixels) override;
gl::Error blit(const gl::Context *context,
angle::Result blit(const gl::Context *context,
const gl::Rectangle &sourceArea,
const gl::Rectangle &destArea,
GLbitfield mask,
......@@ -85,7 +87,7 @@ class FramebufferVk : public FramebufferImpl
angle::Result syncState(const gl::Context *context,
const gl::Framebuffer::DirtyBits &dirtyBits) override;
gl::Error getSamplePosition(const gl::Context *context,
angle::Result getSamplePosition(const gl::Context *context,
size_t index,
GLfloat *xy) const override;
RenderTargetVk *getDepthStencilRenderTarget() const;
......
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