Commit bc918e7d by Jamie Madill Committed by Commit Bot

Return errors from gl::State::syncDirtyObjects.

This plumbs the front-end code, but doesn't implement Error handling for any objects yet. Framebuffers and VertexArrays will get error handling from their syncState methods. Bug: angleproject:2372 Change-Id: I226049e25ac7af2bdd3c4787b67a5d297c0b9c4b Reviewed-on: https://chromium-review.googlesource.com/954289 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarLuc Ferron <lucferron@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 5164b797
......@@ -1938,7 +1938,7 @@ void Context::stencilFillPath(GLuint path, GLenum fillMode, GLuint mask)
return;
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
syncRendererState();
ANGLE_CONTEXT_TRY(syncRendererState());
mImplementation->stencilFillPath(pathObj, fillMode, mask);
}
......@@ -1950,7 +1950,7 @@ void Context::stencilStrokePath(GLuint path, GLint reference, GLuint mask)
return;
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
syncRendererState();
ANGLE_CONTEXT_TRY(syncRendererState());
mImplementation->stencilStrokePath(pathObj, reference, mask);
}
......@@ -1962,7 +1962,7 @@ void Context::coverFillPath(GLuint path, GLenum coverMode)
return;
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
syncRendererState();
ANGLE_CONTEXT_TRY(syncRendererState());
mImplementation->coverFillPath(pathObj, coverMode);
}
......@@ -1974,7 +1974,7 @@ void Context::coverStrokePath(GLuint path, GLenum coverMode)
return;
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
syncRendererState();
ANGLE_CONTEXT_TRY(syncRendererState());
mImplementation->coverStrokePath(pathObj, coverMode);
}
......@@ -1986,7 +1986,7 @@ void Context::stencilThenCoverFillPath(GLuint path, GLenum fillMode, GLuint mask
return;
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
syncRendererState();
ANGLE_CONTEXT_TRY(syncRendererState());
mImplementation->stencilThenCoverFillPath(pathObj, fillMode, mask, coverMode);
}
......@@ -2001,7 +2001,7 @@ void Context::stencilThenCoverStrokePath(GLuint path,
return;
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
syncRendererState();
ANGLE_CONTEXT_TRY(syncRendererState());
mImplementation->stencilThenCoverStrokePath(pathObj, reference, mask, coverMode);
}
......@@ -2017,7 +2017,7 @@ void Context::coverFillPathInstanced(GLsizei numPaths,
const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
syncRendererState();
ANGLE_CONTEXT_TRY(syncRendererState());
mImplementation->coverFillPathInstanced(pathObjects, coverMode, transformType, transformValues);
}
......@@ -2033,7 +2033,7 @@ void Context::coverStrokePathInstanced(GLsizei numPaths,
const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
syncRendererState();
ANGLE_CONTEXT_TRY(syncRendererState());
mImplementation->coverStrokePathInstanced(pathObjects, coverMode, transformType,
transformValues);
......@@ -2051,7 +2051,7 @@ void Context::stencilFillPathInstanced(GLsizei numPaths,
const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
syncRendererState();
ANGLE_CONTEXT_TRY(syncRendererState());
mImplementation->stencilFillPathInstanced(pathObjects, fillMode, mask, transformType,
transformValues);
......@@ -2069,7 +2069,7 @@ void Context::stencilStrokePathInstanced(GLsizei numPaths,
const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
syncRendererState();
ANGLE_CONTEXT_TRY(syncRendererState());
mImplementation->stencilStrokePathInstanced(pathObjects, reference, mask, transformType,
transformValues);
......@@ -2088,7 +2088,7 @@ void Context::stencilThenCoverFillPathInstanced(GLsizei numPaths,
const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
syncRendererState();
ANGLE_CONTEXT_TRY(syncRendererState());
mImplementation->stencilThenCoverFillPathInstanced(pathObjects, coverMode, fillMode, mask,
transformType, transformValues);
......@@ -2107,7 +2107,7 @@ void Context::stencilThenCoverStrokePathInstanced(GLsizei numPaths,
const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
syncRendererState();
ANGLE_CONTEXT_TRY(syncRendererState());
mImplementation->stencilThenCoverStrokePathInstanced(pathObjects, coverMode, reference, mask,
transformType, transformValues);
......@@ -2907,7 +2907,7 @@ void Context::initWorkarounds()
Error Context::prepareForDraw()
{
syncRendererState();
ANGLE_TRY(syncRendererState());
if (isRobustResourceInitEnabled())
{
......@@ -2918,21 +2918,23 @@ Error Context::prepareForDraw()
return NoError();
}
void Context::syncRendererState()
Error Context::syncRendererState()
{
mGLState.syncDirtyObjects(this);
ANGLE_TRY(mGLState.syncDirtyObjects(this));
const State::DirtyBits &dirtyBits = mGLState.getDirtyBits();
mImplementation->syncState(this, dirtyBits);
mGLState.clearDirtyBits();
return NoError();
}
void Context::syncRendererState(const State::DirtyBits &bitMask,
const State::DirtyObjects &objectMask)
Error Context::syncRendererState(const State::DirtyBits &bitMask,
const State::DirtyObjects &objectMask)
{
mGLState.syncDirtyObjects(this, objectMask);
ANGLE_TRY(mGLState.syncDirtyObjects(this, objectMask));
const State::DirtyBits &dirtyBits = (mGLState.getDirtyBits() & bitMask);
mImplementation->syncState(this, dirtyBits);
mGLState.clearDirtyBits(dirtyBits);
return NoError();
}
void Context::blitFramebuffer(GLint srcX0,
......@@ -2959,32 +2961,32 @@ void Context::blitFramebuffer(GLint srcX0,
Rectangle srcArea(srcX0, srcY0, srcX1 - srcX0, srcY1 - srcY0);
Rectangle dstArea(dstX0, dstY0, dstX1 - dstX0, dstY1 - dstY0);
syncStateForBlit();
ANGLE_CONTEXT_TRY(syncStateForBlit());
handleError(drawFramebuffer->blit(this, srcArea, dstArea, mask, filter));
}
void Context::clear(GLbitfield mask)
{
syncStateForClear();
ANGLE_CONTEXT_TRY(syncStateForClear());
handleError(mGLState.getDrawFramebuffer()->clear(this, mask));
}
void Context::clearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *values)
{
syncStateForClear();
ANGLE_CONTEXT_TRY(syncStateForClear());
handleError(mGLState.getDrawFramebuffer()->clearBufferfv(this, buffer, drawbuffer, values));
}
void Context::clearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *values)
{
syncStateForClear();
ANGLE_CONTEXT_TRY(syncStateForClear());
handleError(mGLState.getDrawFramebuffer()->clearBufferuiv(this, buffer, drawbuffer, values));
}
void Context::clearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *values)
{
syncStateForClear();
ANGLE_CONTEXT_TRY(syncStateForClear());
handleError(mGLState.getDrawFramebuffer()->clearBufferiv(this, buffer, drawbuffer, values));
}
......@@ -3000,7 +3002,7 @@ void Context::clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLin
return;
}
syncStateForClear();
ANGLE_CONTEXT_TRY(syncStateForClear());
handleError(framebufferObject->clearBufferfi(this, buffer, drawbuffer, depth, stencil));
}
......@@ -3017,7 +3019,7 @@ void Context::readPixels(GLint x,
return;
}
syncStateForReadPixels();
ANGLE_CONTEXT_TRY(syncStateForReadPixels());
Framebuffer *readFBO = mGLState.getReadFramebuffer();
ASSERT(readFBO);
......@@ -3036,7 +3038,7 @@ void Context::copyTexImage2D(TextureTarget target,
GLint border)
{
// Only sync the read FBO
mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER);
ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER));
Rectangle sourceArea(x, y, width, height);
......@@ -3060,7 +3062,7 @@ void Context::copyTexSubImage2D(TextureTarget target,
}
// Only sync the read FBO
mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER);
ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER));
Offset destOffset(xoffset, yoffset, 0);
Rectangle sourceArea(x, y, width, height);
......@@ -3086,7 +3088,7 @@ void Context::copyTexSubImage3D(TextureType target,
}
// Only sync the read FBO
mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER);
ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER));
Offset destOffset(xoffset, yoffset, zoffset);
Rectangle sourceArea(x, y, width, height);
......@@ -3269,7 +3271,7 @@ void Context::readBuffer(GLenum mode)
void Context::discardFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
{
// Only sync the FBO
mGLState.syncDirtyObject(this, target);
ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, target));
Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
ASSERT(framebuffer);
......@@ -3284,7 +3286,7 @@ void Context::invalidateFramebuffer(GLenum target,
const GLenum *attachments)
{
// Only sync the FBO
mGLState.syncDirtyObject(this, target);
ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, target));
Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
ASSERT(framebuffer);
......@@ -3306,7 +3308,7 @@ void Context::invalidateSubFramebuffer(GLenum target,
GLsizei height)
{
// Only sync the FBO
mGLState.syncDirtyObject(this, target);
ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, target));
Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
ASSERT(framebuffer);
......@@ -3330,7 +3332,7 @@ void Context::texImage2D(TextureTarget target,
GLenum type,
const void *pixels)
{
syncStateForTexImage();
ANGLE_CONTEXT_TRY(syncStateForTexImage());
Extents size(width, height, 1);
Texture *texture = getTargetTexture(TextureTargetToType(target));
......@@ -3349,7 +3351,7 @@ void Context::texImage3D(TextureType target,
GLenum type,
const void *pixels)
{
syncStateForTexImage();
ANGLE_CONTEXT_TRY(syncStateForTexImage());
Extents size(width, height, depth);
Texture *texture = getTargetTexture(target);
......@@ -3374,7 +3376,7 @@ void Context::texSubImage2D(TextureTarget target,
return;
}
syncStateForTexImage();
ANGLE_CONTEXT_TRY(syncStateForTexImage());
Box area(xoffset, yoffset, 0, width, height, 1);
Texture *texture = getTargetTexture(TextureTargetToType(target));
......@@ -3400,7 +3402,7 @@ void Context::texSubImage3D(TextureType target,
return;
}
syncStateForTexImage();
ANGLE_CONTEXT_TRY(syncStateForTexImage());
Box area(xoffset, yoffset, zoffset, width, height, depth);
Texture *texture = getTargetTexture(target);
......@@ -3418,7 +3420,7 @@ void Context::compressedTexImage2D(TextureTarget target,
GLsizei imageSize,
const void *data)
{
syncStateForTexImage();
ANGLE_CONTEXT_TRY(syncStateForTexImage());
Extents size(width, height, 1);
Texture *texture = getTargetTexture(TextureTargetToType(target));
......@@ -3437,7 +3439,7 @@ void Context::compressedTexImage3D(TextureType target,
GLsizei imageSize,
const void *data)
{
syncStateForTexImage();
ANGLE_CONTEXT_TRY(syncStateForTexImage());
Extents size(width, height, depth);
Texture *texture = getTargetTexture(target);
......@@ -3456,7 +3458,7 @@ void Context::compressedTexSubImage2D(TextureTarget target,
GLsizei imageSize,
const void *data)
{
syncStateForTexImage();
ANGLE_CONTEXT_TRY(syncStateForTexImage());
Box area(xoffset, yoffset, 0, width, height, 1);
Texture *texture = getTargetTexture(TextureTargetToType(target));
......@@ -3483,7 +3485,7 @@ void Context::compressedTexSubImage3D(TextureType target,
return;
}
syncStateForTexImage();
ANGLE_CONTEXT_TRY(syncStateForTexImage());
Box area(xoffset, yoffset, zoffset, width, height, depth);
Texture *texture = getTargetTexture(target);
......@@ -3509,7 +3511,7 @@ void Context::copyTexture(GLuint sourceId,
GLboolean unpackPremultiplyAlpha,
GLboolean unpackUnmultiplyAlpha)
{
syncStateForTexImage();
ANGLE_CONTEXT_TRY(syncStateForTexImage());
gl::Texture *sourceTexture = getTexture(sourceId);
gl::Texture *destTexture = getTexture(destId);
......@@ -3540,7 +3542,7 @@ void Context::copySubTexture(GLuint sourceId,
return;
}
syncStateForTexImage();
ANGLE_CONTEXT_TRY(syncStateForTexImage());
gl::Texture *sourceTexture = getTexture(sourceId);
gl::Texture *destTexture = getTexture(destId);
......@@ -3554,7 +3556,7 @@ void Context::copySubTexture(GLuint sourceId,
void Context::compressedCopyTexture(GLuint sourceId, GLuint destId)
{
syncStateForTexImage();
ANGLE_CONTEXT_TRY(syncStateForTexImage());
gl::Texture *sourceTexture = getTexture(sourceId);
gl::Texture *destTexture = getTexture(destId);
......@@ -3625,24 +3627,24 @@ void Context::flushMappedBufferRange(BufferBinding /*target*/,
// We do not currently support a non-trivial implementation of FlushMappedBufferRange
}
void Context::syncStateForReadPixels()
Error Context::syncStateForReadPixels()
{
syncRendererState(mReadPixelsDirtyBits, mReadPixelsDirtyObjects);
return syncRendererState(mReadPixelsDirtyBits, mReadPixelsDirtyObjects);
}
void Context::syncStateForTexImage()
Error Context::syncStateForTexImage()
{
syncRendererState(mTexImageDirtyBits, mTexImageDirtyObjects);
return syncRendererState(mTexImageDirtyBits, mTexImageDirtyObjects);
}
void Context::syncStateForClear()
Error Context::syncStateForClear()
{
syncRendererState(mClearDirtyBits, mClearDirtyObjects);
return syncRendererState(mClearDirtyBits, mClearDirtyObjects);
}
void Context::syncStateForBlit()
Error Context::syncStateForBlit()
{
syncRendererState(mBlitDirtyBits, mBlitDirtyObjects);
return syncRendererState(mBlitDirtyBits, mBlitDirtyObjects);
}
void Context::activeShaderProgram(GLuint pipeline, GLuint program)
......@@ -4230,7 +4232,7 @@ void Context::getMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
{
// According to spec 3.1 Table 20.49: Framebuffer Dependent Values,
// the sample position should be queried by DRAW_FRAMEBUFFER.
mGLState.syncDirtyObject(this, GL_DRAW_FRAMEBUFFER);
ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, GL_DRAW_FRAMEBUFFER));
const Framebuffer *framebuffer = mGLState.getDrawFramebuffer();
switch (pname)
......@@ -4309,7 +4311,7 @@ Error Context::getZeroFilledBuffer(size_t requstedSizeBytes,
Error Context::prepareForDispatch()
{
syncRendererState(mComputeDirtyBits, mComputeDirtyObjects);
ANGLE_TRY(syncRendererState(mComputeDirtyBits, mComputeDirtyObjects));
if (isRobustResourceInitEnabled())
{
......
......@@ -1166,12 +1166,12 @@ class Context final : public ValidationContext
private:
Error prepareForDraw();
void syncRendererState();
void syncRendererState(const State::DirtyBits &bitMask, const State::DirtyObjects &objectMask);
void syncStateForReadPixels();
void syncStateForTexImage();
void syncStateForClear();
void syncStateForBlit();
Error syncRendererState();
Error syncRendererState(const State::DirtyBits &bitMask, const State::DirtyObjects &objectMask);
Error syncStateForReadPixels();
Error syncStateForTexImage();
Error syncStateForClear();
Error syncStateForBlit();
VertexArray *checkVertexArrayAllocation(GLuint vertexArrayHandle);
TransformFeedback *checkTransformFeedbackAllocation(GLuint transformFeedback);
......
......@@ -2227,15 +2227,15 @@ bool State::hasMappedBuffer(BufferBinding target) const
}
}
void State::syncDirtyObjects(const Context *context)
Error State::syncDirtyObjects(const Context *context)
{
if (!mDirtyObjects.any())
return;
return NoError();
syncDirtyObjects(context, mDirtyObjects);
return syncDirtyObjects(context, mDirtyObjects);
}
void State::syncDirtyObjects(const Context *context, const DirtyObjects &bitset)
Error State::syncDirtyObjects(const Context *context, const DirtyObjects &bitset)
{
for (auto dirtyObject : bitset)
{
......@@ -2264,6 +2264,7 @@ void State::syncDirtyObjects(const Context *context, const DirtyObjects &bitset)
}
mDirtyObjects &= ~bitset;
return NoError();
}
void State::syncProgramTextures(const Context *context)
......@@ -2341,7 +2342,7 @@ void State::syncProgramTextures(const Context *context)
}
}
void State::syncDirtyObject(const Context *context, GLenum target)
Error State::syncDirtyObject(const Context *context, GLenum target)
{
DirtyObjects localSet;
......@@ -2367,7 +2368,7 @@ void State::syncDirtyObject(const Context *context, GLenum target)
break;
}
syncDirtyObjects(context, localSet);
return syncDirtyObjects(context, localSet);
}
void State::setObjectDirty(GLenum target)
......
......@@ -440,9 +440,9 @@ class State : public angle::ObserverInterface, angle::NonCopyable
using DirtyObjects = angle::BitSet<DIRTY_OBJECT_MAX>;
void clearDirtyObjects() { mDirtyObjects.reset(); }
void setAllDirtyObjects() { mDirtyObjects.set(); }
void syncDirtyObjects(const Context *context);
void syncDirtyObjects(const Context *context, const DirtyObjects &bitset);
void syncDirtyObject(const Context *context, GLenum target);
Error syncDirtyObjects(const Context *context);
Error syncDirtyObjects(const Context *context, const DirtyObjects &bitset);
Error syncDirtyObject(const Context *context, GLenum target);
void setObjectDirty(GLenum target);
void setFramebufferDirty(const Framebuffer *framebuffer) 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