Commit 66f0d2c1 by Jamie Madill Committed by Commit Bot

Make Framebuffer attachments angle::Subjects.

Now that there's storage change notifications in the GL front-end we no longer need to give the back-end access to the angle::Subject. The Texture object is a special case where it has mirrored dirty bits. To keep the gl::Texture class notified of when the Impl has dirty bits we make the TextureImpl class an angle::Subject that is observed by the gl::Texture class. This will enable further dirty bits improvements. Bug: angleproject:2966 Change-Id: Id22da0926f51ff4679e58af3e62903f4d7948915 Reviewed-on: https://chromium-review.googlesource.com/c/1347670Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent c10a023a
...@@ -1788,7 +1788,7 @@ void Framebuffer::updateAttachment(const Context *context, ...@@ -1788,7 +1788,7 @@ void Framebuffer::updateAttachment(const Context *context,
multiviewLayout, viewportOffsets); multiviewLayout, viewportOffsets);
mDirtyBits.set(dirtyBit); mDirtyBits.set(dirtyBit);
mState.mResourceNeedsInit.set(dirtyBit, attachment->initState() == InitState::MayNeedInit); mState.mResourceNeedsInit.set(dirtyBit, attachment->initState() == InitState::MayNeedInit);
onDirtyBinding->bind(resource ? resource->getSubject() : nullptr); onDirtyBinding->bind(resource);
invalidateCompletenessCache(context); invalidateCompletenessCache(context);
} }
......
...@@ -340,11 +340,6 @@ angle::Result FramebufferAttachmentObject::getAttachmentRenderTarget( ...@@ -340,11 +340,6 @@ angle::Result FramebufferAttachmentObject::getAttachmentRenderTarget(
return getAttachmentImpl()->getAttachmentRenderTarget(context, binding, imageIndex, rtOut); return getAttachmentImpl()->getAttachmentRenderTarget(context, binding, imageIndex, rtOut);
} }
void FramebufferAttachmentObject::onStorageChange(const gl::Context *context) const
{
return getAttachmentImpl()->onStateChange(context, angle::SubjectMessage::STORAGE_CHANGED);
}
angle::Result FramebufferAttachmentObject::initializeContents(const Context *context, angle::Result FramebufferAttachmentObject::initializeContents(const Context *context,
const ImageIndex &imageIndex) const ImageIndex &imageIndex)
{ {
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libANGLE/Error.h" #include "libANGLE/Error.h"
#include "libANGLE/ImageIndex.h" #include "libANGLE/ImageIndex.h"
#include "libANGLE/Observer.h"
#include "libANGLE/formatutils.h" #include "libANGLE/formatutils.h"
#include "libANGLE/renderer/FramebufferAttachmentObjectImpl.h" #include "libANGLE/renderer/FramebufferAttachmentObjectImpl.h"
...@@ -36,11 +37,6 @@ class FramebufferAttachmentRenderTarget : angle::NonCopyable ...@@ -36,11 +37,6 @@ class FramebufferAttachmentRenderTarget : angle::NonCopyable
class FramebufferAttachmentObjectImpl; class FramebufferAttachmentObjectImpl;
} // namespace rx } // namespace rx
namespace angle
{
class Subject;
} // namespace angle
namespace gl namespace gl
{ {
class FramebufferAttachmentObject; class FramebufferAttachmentObject;
...@@ -194,7 +190,7 @@ class FramebufferAttachment final ...@@ -194,7 +190,7 @@ class FramebufferAttachment final
}; };
// A base class for objects that FBO Attachments may point to. // A base class for objects that FBO Attachments may point to.
class FramebufferAttachmentObject class FramebufferAttachmentObject : public angle::Subject
{ {
public: public:
FramebufferAttachmentObject(); FramebufferAttachmentObject();
...@@ -222,9 +218,6 @@ class FramebufferAttachmentObject ...@@ -222,9 +218,6 @@ class FramebufferAttachmentObject
angle::Result initializeContents(const Context *context, const ImageIndex &imageIndex); angle::Result initializeContents(const Context *context, const ImageIndex &imageIndex);
void onStorageChange(const gl::Context *context) const;
angle::Subject *getSubject() const { return getAttachmentImpl(); }
protected: protected:
virtual rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const = 0; virtual rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const = 0;
}; };
......
...@@ -102,7 +102,7 @@ angle::Result Renderbuffer::setStorage(const Context *context, ...@@ -102,7 +102,7 @@ angle::Result Renderbuffer::setStorage(const Context *context,
mState.update(static_cast<GLsizei>(width), static_cast<GLsizei>(height), Format(internalformat), mState.update(static_cast<GLsizei>(width), static_cast<GLsizei>(height), Format(internalformat),
0, InitState::MayNeedInit); 0, InitState::MayNeedInit);
onStorageChange(context); onStateChange(context, angle::SubjectMessage::STORAGE_CHANGED);
return angle::Result::Continue(); return angle::Result::Continue();
} }
...@@ -119,7 +119,7 @@ angle::Result Renderbuffer::setStorageMultisample(const Context *context, ...@@ -119,7 +119,7 @@ angle::Result Renderbuffer::setStorageMultisample(const Context *context,
mState.update(static_cast<GLsizei>(width), static_cast<GLsizei>(height), Format(internalformat), mState.update(static_cast<GLsizei>(width), static_cast<GLsizei>(height), Format(internalformat),
static_cast<GLsizei>(samples), InitState::MayNeedInit); static_cast<GLsizei>(samples), InitState::MayNeedInit);
onStorageChange(context); onStateChange(context, angle::SubjectMessage::STORAGE_CHANGED);
return angle::Result::Continue(); return angle::Result::Continue();
} }
...@@ -133,7 +133,7 @@ angle::Result Renderbuffer::setStorageEGLImageTarget(const Context *context, egl ...@@ -133,7 +133,7 @@ angle::Result Renderbuffer::setStorageEGLImageTarget(const Context *context, egl
mState.update(static_cast<GLsizei>(image->getWidth()), static_cast<GLsizei>(image->getHeight()), mState.update(static_cast<GLsizei>(image->getWidth()), static_cast<GLsizei>(image->getHeight()),
Format(image->getFormat()), 0, image->sourceInitState()); Format(image->getFormat()), 0, image->sourceInitState());
onStorageChange(context); onStateChange(context, angle::SubjectMessage::STORAGE_CHANGED);
return angle::Result::Continue(); return angle::Result::Continue();
} }
......
...@@ -468,7 +468,7 @@ ANGLE_INLINE angle::Result State::updateActiveTexture(const Context *context, ...@@ -468,7 +468,7 @@ ANGLE_INLINE angle::Result State::updateActiveTexture(const Context *context,
return angle::Result::Continue(); return angle::Result::Continue();
} }
mCompleteTextureBindings[textureIndex].bind(texture->getImplementation()); mCompleteTextureBindings[textureIndex].bind(texture);
if (!texture->isSamplerComplete(context, sampler)) if (!texture->isSamplerComplete(context, sampler))
{ {
......
...@@ -134,7 +134,7 @@ void Surface::postSwap(const gl::Context *context) ...@@ -134,7 +134,7 @@ void Surface::postSwap(const gl::Context *context)
if (mRobustResourceInitialization && mSwapBehavior != EGL_BUFFER_PRESERVED) if (mRobustResourceInitialization && mSwapBehavior != EGL_BUFFER_PRESERVED)
{ {
mInitState = gl::InitState::MayNeedInit; mInitState = gl::InitState::MayNeedInit;
onStorageChange(context); onStateChange(context, angle::SubjectMessage::STORAGE_CHANGED);
} }
} }
......
...@@ -966,7 +966,7 @@ GLint Texture::getLevelMemorySize(TextureTarget target, GLint level) const ...@@ -966,7 +966,7 @@ GLint Texture::getLevelMemorySize(TextureTarget target, GLint level) const
void Texture::signalDirty(const Context *context, InitState initState) void Texture::signalDirty(const Context *context, InitState initState)
{ {
mState.mInitState = initState; mState.mInitState = initState;
onStorageChange(context); onStateChange(context, angle::SubjectMessage::STORAGE_CHANGED);
invalidateCompletenessCache(); invalidateCompletenessCache();
} }
......
...@@ -18,7 +18,7 @@ namespace rx ...@@ -18,7 +18,7 @@ namespace rx
{ {
class FramebufferAttachmentRenderTarget; class FramebufferAttachmentRenderTarget;
class FramebufferAttachmentObjectImpl : public angle::Subject class FramebufferAttachmentObjectImpl : angle::NonCopyable
{ {
public: public:
FramebufferAttachmentObjectImpl() {} FramebufferAttachmentObjectImpl() {}
......
...@@ -40,7 +40,7 @@ namespace rx ...@@ -40,7 +40,7 @@ namespace rx
{ {
class ContextImpl; class ContextImpl;
class TextureImpl : public FramebufferAttachmentObjectImpl class TextureImpl : public FramebufferAttachmentObjectImpl, public angle::Subject
{ {
public: public:
TextureImpl(const gl::TextureState &state); TextureImpl(const gl::TextureState &state);
......
...@@ -82,7 +82,7 @@ angle::Result EGLImageD3D::copyToLocalRendertarget(const gl::Context *context) ...@@ -82,7 +82,7 @@ angle::Result EGLImageD3D::copyToLocalRendertarget(const gl::Context *context)
// Invalidate FBOs with this Image attached. Only currently applies to D3D11. // Invalidate FBOs with this Image attached. Only currently applies to D3D11.
for (egl::ImageSibling *target : mState.targets) for (egl::ImageSibling *target : mState.targets)
{ {
target->getSubject()->onStateChange(context, angle::SubjectMessage::STORAGE_CHANGED); target->onStateChange(context, angle::SubjectMessage::STORAGE_CHANGED);
} }
return mRenderer->createRenderTargetCopy(context, curRenderTarget, &mRenderTarget); return mRenderer->createRenderTargetCopy(context, curRenderTarget, &mRenderTarget);
......
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