Refactor DefaultAttachments.
Instead of using an Impl type for default attachments, store the
egl::Surface pointer where possible.
BUG=angleproject:963
Change-Id: I3e34849e8b1ccae0c91a79617ec6f64aaaab6b10
Reviewed-on: https://chromium-review.googlesource.com/263483
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/FramebufferAttachment.cpp b/src/libANGLE/FramebufferAttachment.cpp
index 8e745d2..3c8f4af 100644
--- a/src/libANGLE/FramebufferAttachment.cpp
+++ b/src/libANGLE/FramebufferAttachment.cpp
@@ -10,7 +10,9 @@
#include "libANGLE/FramebufferAttachment.h"
#include "common/utilities.h"
+#include "libANGLE/Config.h"
#include "libANGLE/Renderbuffer.h"
+#include "libANGLE/Surface.h"
#include "libANGLE/Texture.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/DefaultAttachmentImpl.h"
@@ -222,36 +224,37 @@
}
-DefaultAttachment::DefaultAttachment(GLenum binding, rx::DefaultAttachmentImpl *impl)
- : FramebufferAttachment(binding),
- mImpl(impl)
+DefaultAttachment::DefaultAttachment(GLenum binding, egl::Surface *surface)
+ : FramebufferAttachment(binding)
{
- ASSERT(mImpl);
+ mSurface.set(surface);
}
DefaultAttachment::~DefaultAttachment()
{
- SafeDelete(mImpl);
+ mSurface.set(nullptr);
}
GLsizei DefaultAttachment::getWidth() const
{
- return mImpl->getWidth();
+ return mSurface->getWidth();
}
GLsizei DefaultAttachment::getHeight() const
{
- return mImpl->getHeight();
+ return mSurface->getHeight();
}
GLenum DefaultAttachment::getInternalFormat() const
{
- return mImpl->getInternalFormat();
+ const egl::Config *config = mSurface->getConfig();
+ return (getBinding() == GL_BACK ? config->renderTargetFormat : config->depthStencilFormat);
}
GLsizei DefaultAttachment::getSamples() const
{
- return mImpl->getSamples();
+ const egl::Config *config = mSurface->getConfig();
+ return config->samples;
}
GLuint DefaultAttachment::id() const
@@ -297,9 +300,4 @@
return NULL;
}
-rx::DefaultAttachmentImpl *DefaultAttachment::getImplementation() const
-{
- return mImpl;
-}
-
}