Commit 102074d1 by Shahbaz Youssefi Committed by Commit Bot

Pass in Command::Clear to framebuffer syncState

In preparation for some clear-related optimizations. Bug: angleproject:4836 Change-Id: I32ceb2b8a690ed13dac81e1ffe073436d6e24421 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2453464 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com>
parent 6dfd855a
...@@ -511,6 +511,7 @@ void Context::initialize() ...@@ -511,6 +511,7 @@ void Context::initialize()
mClearDirtyBits.set(State::DIRTY_BIT_STENCIL_WRITEMASK_FRONT); mClearDirtyBits.set(State::DIRTY_BIT_STENCIL_WRITEMASK_FRONT);
mClearDirtyBits.set(State::DIRTY_BIT_STENCIL_WRITEMASK_BACK); mClearDirtyBits.set(State::DIRTY_BIT_STENCIL_WRITEMASK_BACK);
mClearDirtyBits.set(State::DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING); mClearDirtyBits.set(State::DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING);
mClearDirtyObjects.set(State::DIRTY_OBJECT_DRAW_FRAMEBUFFER);
// We sync the draw Framebuffer manually in prepareForClear to allow the clear calls to do // We sync the draw Framebuffer manually in prepareForClear to allow the clear calls to do
// more custom handling for robust resource init. // more custom handling for robust resource init.
...@@ -3658,22 +3659,16 @@ bool Context::noopDrawInstanced(PrimitiveMode mode, GLsizei count, GLsizei insta ...@@ -3658,22 +3659,16 @@ bool Context::noopDrawInstanced(PrimitiveMode mode, GLsizei count, GLsizei insta
angle::Result Context::prepareForClear(GLbitfield mask) angle::Result Context::prepareForClear(GLbitfield mask)
{ {
// Sync the draw framebuffer manually after the clear attachments. // Sync the draw framebuffer manually after the clear attachments.
ASSERT(mClearDirtyObjects.none());
ANGLE_TRY(mState.getDrawFramebuffer()->ensureClearAttachmentsInitialized(this, mask)); ANGLE_TRY(mState.getDrawFramebuffer()->ensureClearAttachmentsInitialized(this, mask));
ANGLE_TRY(mState.syncDirtyObject(this, GL_DRAW_FRAMEBUFFER)); return syncStateForClear();
ANGLE_TRY(syncDirtyBits(mClearDirtyBits));
return angle::Result::Continue;
} }
angle::Result Context::prepareForClearBuffer(GLenum buffer, GLint drawbuffer) angle::Result Context::prepareForClearBuffer(GLenum buffer, GLint drawbuffer)
{ {
// Sync the draw framebuffer manually after the clear attachments. // Sync the draw framebuffer manually after the clear attachments.
ASSERT(mClearDirtyObjects.none());
ANGLE_TRY(mState.getDrawFramebuffer()->ensureClearBufferAttachmentsInitialized(this, buffer, ANGLE_TRY(mState.getDrawFramebuffer()->ensureClearBufferAttachmentsInitialized(this, buffer,
drawbuffer)); drawbuffer));
ANGLE_TRY(mState.syncDirtyObject(this, GL_DRAW_FRAMEBUFFER)); return syncStateForClear();
ANGLE_TRY(syncDirtyBits(mClearDirtyBits));
return angle::Result::Continue;
} }
ANGLE_INLINE angle::Result Context::prepareForCopyImage() ANGLE_INLINE angle::Result Context::prepareForCopyImage()
...@@ -4821,6 +4816,11 @@ angle::Result Context::syncStateForBlit() ...@@ -4821,6 +4816,11 @@ angle::Result Context::syncStateForBlit()
return syncState(mBlitDirtyBits, mBlitDirtyObjects, Command::Blit); return syncState(mBlitDirtyBits, mBlitDirtyObjects, Command::Blit);
} }
angle::Result Context::syncStateForClear()
{
return syncState(mClearDirtyBits, mClearDirtyObjects, Command::Clear);
}
void Context::activeShaderProgram(ProgramPipelineID pipeline, ShaderProgramID program) void Context::activeShaderProgram(ProgramPipelineID pipeline, ShaderProgramID program)
{ {
Program *shaderProgram = getProgramNoResolveLink(program); Program *shaderProgram = getProgramNoResolveLink(program);
......
...@@ -651,6 +651,7 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl ...@@ -651,6 +651,7 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl
angle::Result syncStateForReadPixels(); angle::Result syncStateForReadPixels();
angle::Result syncStateForTexImage(); angle::Result syncStateForTexImage();
angle::Result syncStateForBlit(); angle::Result syncStateForBlit();
angle::Result syncStateForClear();
VertexArray *checkVertexArrayAllocation(VertexArrayID vertexArrayHandle); VertexArray *checkVertexArrayAllocation(VertexArrayID vertexArrayHandle);
TransformFeedback *checkTransformFeedbackAllocation(TransformFeedbackID transformFeedback); TransformFeedback *checkTransformFeedbackAllocation(TransformFeedbackID transformFeedback);
......
...@@ -33,6 +33,7 @@ class Texture; ...@@ -33,6 +33,7 @@ class Texture;
enum class Command enum class Command
{ {
Blit, Blit,
Clear,
CopyImage, CopyImage,
Dispatch, Dispatch,
Draw, Draw,
......
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