Commit 1033d55d by Jamie Madill Committed by Commit Bot

Pass binding enum to Framebuffer::syncState.

Will allow us to determine if we're clearing the read or draw FBO. Then we can stash clears for the draw FBO only and issue them immediately for the read FBO in the Vulkan back-end. Bug: angleproject:4517 Change-Id: Ifc043317d6156a75749b13f9d2c44a17e14ee378 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2139997Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 8116c488
...@@ -1140,7 +1140,9 @@ GLenum Framebuffer::checkStatusImpl(const Context *context) const ...@@ -1140,7 +1140,9 @@ GLenum Framebuffer::checkStatusImpl(const Context *context) const
// We can skip syncState on several back-ends. // We can skip syncState on several back-ends.
if (mImpl->shouldSyncStateBeforeCheckStatus()) if (mImpl->shouldSyncStateBeforeCheckStatus())
{ {
angle::Result err = syncState(context); // This binding is not totally correct. It is ok because the parameter isn't used in
// the GL back-end and the GL back-end is the only user of syncStateBeforeCheckStatus.
angle::Result err = syncState(context, GL_FRAMEBUFFER);
if (err != angle::Result::Continue) if (err != angle::Result::Continue)
{ {
return 0; return 0;
...@@ -1972,12 +1974,12 @@ void Framebuffer::resetAttachment(const Context *context, GLenum binding) ...@@ -1972,12 +1974,12 @@ void Framebuffer::resetAttachment(const Context *context, GLenum binding)
setAttachment(context, GL_NONE, binding, ImageIndex(), nullptr); setAttachment(context, GL_NONE, binding, ImageIndex(), nullptr);
} }
angle::Result Framebuffer::syncState(const Context *context) const angle::Result Framebuffer::syncState(const Context *context, GLenum framebufferBinding) const
{ {
if (mDirtyBits.any()) if (mDirtyBits.any())
{ {
mDirtyBitsGuard = mDirtyBits; mDirtyBitsGuard = mDirtyBits;
ANGLE_TRY(mImpl->syncState(context, mDirtyBits)); ANGLE_TRY(mImpl->syncState(context, framebufferBinding, mDirtyBits));
mDirtyBits.reset(); mDirtyBits.reset();
mDirtyBitsGuard.reset(); mDirtyBitsGuard.reset();
} }
......
...@@ -389,7 +389,7 @@ class Framebuffer final : public angle::ObserverInterface, ...@@ -389,7 +389,7 @@ class Framebuffer final : public angle::ObserverInterface,
bool hasResourceThatNeedsInit() const { return mState.mResourceNeedsInit.any(); } bool hasResourceThatNeedsInit() const { return mState.mResourceNeedsInit.any(); }
angle::Result syncState(const Context *context) const; angle::Result syncState(const Context *context, GLenum framebufferBinding) const;
// Observer implementation // Observer implementation
void onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMessage message) override; void onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMessage message) override;
......
...@@ -3008,13 +3008,13 @@ angle::Result State::syncDrawAttachments(const Context *context) ...@@ -3008,13 +3008,13 @@ angle::Result State::syncDrawAttachments(const Context *context)
angle::Result State::syncReadFramebuffer(const Context *context) angle::Result State::syncReadFramebuffer(const Context *context)
{ {
ASSERT(mReadFramebuffer); ASSERT(mReadFramebuffer);
return mReadFramebuffer->syncState(context); return mReadFramebuffer->syncState(context, GL_READ_FRAMEBUFFER);
} }
angle::Result State::syncDrawFramebuffer(const Context *context) angle::Result State::syncDrawFramebuffer(const Context *context)
{ {
ASSERT(mDrawFramebuffer); ASSERT(mDrawFramebuffer);
return mDrawFramebuffer->syncState(context); return mDrawFramebuffer->syncState(context, GL_DRAW_FRAMEBUFFER);
} }
angle::Result State::syncTextures(const Context *context) angle::Result State::syncTextures(const Context *context)
......
...@@ -80,6 +80,7 @@ class FramebufferImpl : angle::NonCopyable ...@@ -80,6 +80,7 @@ class FramebufferImpl : angle::NonCopyable
virtual bool checkStatus(const gl::Context *context) const = 0; virtual bool checkStatus(const gl::Context *context) const = 0;
virtual angle::Result syncState(const gl::Context *context, virtual angle::Result syncState(const gl::Context *context,
GLenum binding,
const gl::Framebuffer::DirtyBits &dirtyBits) = 0; const gl::Framebuffer::DirtyBits &dirtyBits) = 0;
virtual angle::Result getSamplePosition(const gl::Context *context, virtual angle::Result getSamplePosition(const gl::Context *context,
......
...@@ -48,7 +48,8 @@ class MockFramebufferImpl : public rx::FramebufferImpl ...@@ -48,7 +48,8 @@ class MockFramebufferImpl : public rx::FramebufferImpl
MOCK_CONST_METHOD1(checkStatus, bool(const gl::Context *)); MOCK_CONST_METHOD1(checkStatus, bool(const gl::Context *));
MOCK_METHOD2(syncState, angle::Result(const gl::Context *, const gl::Framebuffer::DirtyBits &)); MOCK_METHOD3(syncState,
angle::Result(const gl::Context *, GLenum, const gl::Framebuffer::DirtyBits &));
MOCK_METHOD0(destructor, void()); MOCK_METHOD0(destructor, void());
}; };
......
...@@ -268,6 +268,7 @@ bool FramebufferD3D::checkStatus(const gl::Context *context) const ...@@ -268,6 +268,7 @@ bool FramebufferD3D::checkStatus(const gl::Context *context) const
} }
angle::Result FramebufferD3D::syncState(const gl::Context *context, angle::Result FramebufferD3D::syncState(const gl::Context *context,
GLenum binding,
const gl::Framebuffer::DirtyBits &dirtyBits) const gl::Framebuffer::DirtyBits &dirtyBits)
{ {
if (!mColorAttachmentsForRender.valid()) if (!mColorAttachmentsForRender.valid())
......
...@@ -96,6 +96,7 @@ class FramebufferD3D : public FramebufferImpl ...@@ -96,6 +96,7 @@ class FramebufferD3D : public FramebufferImpl
bool checkStatus(const gl::Context *context) const override; bool checkStatus(const gl::Context *context) const override;
angle::Result syncState(const gl::Context *context, angle::Result syncState(const gl::Context *context,
GLenum binding,
const gl::Framebuffer::DirtyBits &dirtyBits) override; const gl::Framebuffer::DirtyBits &dirtyBits) override;
const gl::AttachmentList &getColorAttachmentsForRender(const gl::Context *context); const gl::AttachmentList &getColorAttachmentsForRender(const gl::Context *context);
......
...@@ -386,10 +386,11 @@ const gl::InternalFormat &Framebuffer11::getImplementationColorReadFormat( ...@@ -386,10 +386,11 @@ const gl::InternalFormat &Framebuffer11::getImplementationColorReadFormat(
} }
angle::Result Framebuffer11::syncState(const gl::Context *context, angle::Result Framebuffer11::syncState(const gl::Context *context,
GLenum binding,
const gl::Framebuffer::DirtyBits &dirtyBits) const gl::Framebuffer::DirtyBits &dirtyBits)
{ {
ANGLE_TRY(mRenderTargetCache.update(context, mState, dirtyBits)); ANGLE_TRY(mRenderTargetCache.update(context, mState, dirtyBits));
ANGLE_TRY(FramebufferD3D::syncState(context, dirtyBits)); ANGLE_TRY(FramebufferD3D::syncState(context, binding, dirtyBits));
// Call this last to allow the state manager to take advantage of the cached render targets. // Call this last to allow the state manager to take advantage of the cached render targets.
mRenderer->getStateManager()->invalidateRenderTarget(); mRenderer->getStateManager()->invalidateRenderTarget();
......
...@@ -39,6 +39,7 @@ class Framebuffer11 : public FramebufferD3D ...@@ -39,6 +39,7 @@ class Framebuffer11 : public FramebufferD3D
angle::Result markAttachmentsDirty(const gl::Context *context) const; angle::Result markAttachmentsDirty(const gl::Context *context) const;
angle::Result syncState(const gl::Context *context, angle::Result syncState(const gl::Context *context,
GLenum binding,
const gl::Framebuffer::DirtyBits &dirtyBits) override; const gl::Framebuffer::DirtyBits &dirtyBits) override;
const gl::AttachmentArray<RenderTarget11 *> &getCachedColorRenderTargets() const const gl::AttachmentArray<RenderTarget11 *> &getCachedColorRenderTargets() const
......
...@@ -404,9 +404,10 @@ angle::Result Framebuffer9::getSamplePosition(const gl::Context *context, ...@@ -404,9 +404,10 @@ angle::Result Framebuffer9::getSamplePosition(const gl::Context *context,
} }
angle::Result Framebuffer9::syncState(const gl::Context *context, angle::Result Framebuffer9::syncState(const gl::Context *context,
GLenum binding,
const gl::Framebuffer::DirtyBits &dirtyBits) const gl::Framebuffer::DirtyBits &dirtyBits)
{ {
ANGLE_TRY(FramebufferD3D::syncState(context, dirtyBits)); ANGLE_TRY(FramebufferD3D::syncState(context, binding, dirtyBits));
ANGLE_TRY(mRenderTargetCache.update(context, mState, dirtyBits)); ANGLE_TRY(mRenderTargetCache.update(context, mState, dirtyBits));
return angle::Result::Continue; return angle::Result::Continue;
} }
......
...@@ -39,6 +39,7 @@ class Framebuffer9 : public FramebufferD3D ...@@ -39,6 +39,7 @@ class Framebuffer9 : public FramebufferD3D
GLfloat *xy) const override; GLfloat *xy) const override;
angle::Result syncState(const gl::Context *context, angle::Result syncState(const gl::Context *context,
GLenum binding,
const gl::Framebuffer::DirtyBits &dirtyBits) override; const gl::Framebuffer::DirtyBits &dirtyBits) override;
const gl::AttachmentArray<RenderTarget9 *> &getCachedColorRenderTargets() const const gl::AttachmentArray<RenderTarget9 *> &getCachedColorRenderTargets() const
......
...@@ -1185,6 +1185,7 @@ bool FramebufferGL::checkStatus(const gl::Context *context) const ...@@ -1185,6 +1185,7 @@ bool FramebufferGL::checkStatus(const gl::Context *context) const
} }
angle::Result FramebufferGL::syncState(const gl::Context *context, angle::Result FramebufferGL::syncState(const gl::Context *context,
GLenum binding,
const gl::Framebuffer::DirtyBits &dirtyBits) const gl::Framebuffer::DirtyBits &dirtyBits)
{ {
// Don't need to sync state for the default FBO. // Don't need to sync state for the default FBO.
......
...@@ -80,6 +80,7 @@ class FramebufferGL : public FramebufferImpl ...@@ -80,6 +80,7 @@ class FramebufferGL : public FramebufferImpl
bool checkStatus(const gl::Context *context) const override; bool checkStatus(const gl::Context *context) const override;
angle::Result syncState(const gl::Context *context, angle::Result syncState(const gl::Context *context,
GLenum binding,
const gl::Framebuffer::DirtyBits &dirtyBits) override; const gl::Framebuffer::DirtyBits &dirtyBits) override;
GLuint getFramebufferID() const; GLuint getFramebufferID() const;
......
...@@ -75,6 +75,7 @@ class FramebufferMtl : public FramebufferImpl ...@@ -75,6 +75,7 @@ class FramebufferMtl : public FramebufferImpl
bool checkStatus(const gl::Context *context) const override; bool checkStatus(const gl::Context *context) const override;
angle::Result syncState(const gl::Context *context, angle::Result syncState(const gl::Context *context,
GLenum binding,
const gl::Framebuffer::DirtyBits &dirtyBits) override; const gl::Framebuffer::DirtyBits &dirtyBits) override;
angle::Result getSamplePosition(const gl::Context *context, angle::Result getSamplePosition(const gl::Context *context,
......
...@@ -225,6 +225,7 @@ bool FramebufferMtl::checkStatus(const gl::Context *context) const ...@@ -225,6 +225,7 @@ bool FramebufferMtl::checkStatus(const gl::Context *context) const
} }
angle::Result FramebufferMtl::syncState(const gl::Context *context, angle::Result FramebufferMtl::syncState(const gl::Context *context,
GLenum binding,
const gl::Framebuffer::DirtyBits &dirtyBits) const gl::Framebuffer::DirtyBits &dirtyBits)
{ {
ContextMtl *contextMtl = mtl::GetImpl(context); ContextMtl *contextMtl = mtl::GetImpl(context);
......
...@@ -549,7 +549,7 @@ angle::Result SurfaceMtl::obtainNextDrawable(const gl::Context *context) ...@@ -549,7 +549,7 @@ angle::Result SurfaceMtl::obtainNextDrawable(const gl::Context *context)
if (defaultFbo) if (defaultFbo)
{ {
FramebufferMtl *framebufferMtl = mtl::GetImpl(defaultFbo); FramebufferMtl *framebufferMtl = mtl::GetImpl(defaultFbo);
ANGLE_TRY(framebufferMtl->syncState(context, fboDirtyBits)); ANGLE_TRY(framebufferMtl->syncState(context, GL_FRAMEBUFFER, fboDirtyBits));
} }
return angle::Result::Continue; return angle::Result::Continue;
......
...@@ -159,6 +159,7 @@ bool FramebufferNULL::checkStatus(const gl::Context *context) const ...@@ -159,6 +159,7 @@ bool FramebufferNULL::checkStatus(const gl::Context *context) const
} }
angle::Result FramebufferNULL::syncState(const gl::Context *context, angle::Result FramebufferNULL::syncState(const gl::Context *context,
GLenum binding,
const gl::Framebuffer::DirtyBits &dirtyBits) const gl::Framebuffer::DirtyBits &dirtyBits)
{ {
return angle::Result::Continue; return angle::Result::Continue;
......
...@@ -66,6 +66,7 @@ class FramebufferNULL : public FramebufferImpl ...@@ -66,6 +66,7 @@ class FramebufferNULL : public FramebufferImpl
bool checkStatus(const gl::Context *context) const override; bool checkStatus(const gl::Context *context) const override;
angle::Result syncState(const gl::Context *context, angle::Result syncState(const gl::Context *context,
GLenum binding,
const gl::Framebuffer::DirtyBits &dirtyBits) override; const gl::Framebuffer::DirtyBits &dirtyBits) override;
angle::Result getSamplePosition(const gl::Context *context, angle::Result getSamplePosition(const gl::Context *context,
......
...@@ -1042,6 +1042,7 @@ void FramebufferVk::updateDepthStencilAttachmentSerial(ContextVk *contextVk) ...@@ -1042,6 +1042,7 @@ void FramebufferVk::updateDepthStencilAttachmentSerial(ContextVk *contextVk)
} }
angle::Result FramebufferVk::syncState(const gl::Context *context, angle::Result FramebufferVk::syncState(const gl::Context *context,
GLenum binding,
const gl::Framebuffer::DirtyBits &dirtyBits) const gl::Framebuffer::DirtyBits &dirtyBits)
{ {
ContextVk *contextVk = vk::GetImpl(context); ContextVk *contextVk = vk::GetImpl(context);
......
...@@ -86,6 +86,7 @@ class FramebufferVk : public FramebufferImpl ...@@ -86,6 +86,7 @@ class FramebufferVk : public FramebufferImpl
bool checkStatus(const gl::Context *context) const override; bool checkStatus(const gl::Context *context) const override;
angle::Result syncState(const gl::Context *context, angle::Result syncState(const gl::Context *context,
GLenum binding,
const gl::Framebuffer::DirtyBits &dirtyBits) override; const gl::Framebuffer::DirtyBits &dirtyBits) override;
angle::Result getSamplePosition(const gl::Context *context, angle::Result getSamplePosition(const gl::Context *context,
......
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