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