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/Framebuffer.cpp b/src/libANGLE/Framebuffer.cpp
index 7e27bb7..5fa7513 100644
--- a/src/libANGLE/Framebuffer.cpp
+++ b/src/libANGLE/Framebuffer.cpp
@@ -8,18 +8,20 @@
// objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105.
#include "libANGLE/Framebuffer.h"
-#include "libANGLE/formatutils.h"
-#include "libANGLE/Texture.h"
+
+#include "common/utilities.h"
+#include "libANGLE/Config.h"
#include "libANGLE/Context.h"
-#include "libANGLE/Renderbuffer.h"
#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/Renderbuffer.h"
+#include "libANGLE/Surface.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/FramebufferImpl.h"
#include "libANGLE/renderer/ImplFactory.h"
#include "libANGLE/renderer/RenderbufferImpl.h"
#include "libANGLE/renderer/Workarounds.h"
-#include "common/utilities.h"
-
namespace gl
{
@@ -633,20 +635,17 @@
DefaultFramebuffer::DefaultFramebuffer(const Caps &caps, rx::ImplFactory *factory, egl::Surface *surface)
: Framebuffer(caps, factory, 0)
{
- rx::DefaultAttachmentImpl *colorAttachment = factory->createDefaultAttachment(GL_BACK, surface);
- rx::DefaultAttachmentImpl *depthAttachment = factory->createDefaultAttachment(GL_DEPTH, surface);
- rx::DefaultAttachmentImpl *stencilAttachment = factory->createDefaultAttachment(GL_STENCIL, surface);
+ const egl::Config *config = surface->getConfig();
- ASSERT(colorAttachment);
- setAttachment(GL_BACK, new DefaultAttachment(GL_BACK, colorAttachment));
+ setAttachment(GL_BACK, new DefaultAttachment(GL_BACK, surface));
- if (depthAttachment)
+ if (config->depthSize > 0)
{
- setAttachment(GL_DEPTH, new DefaultAttachment(GL_DEPTH, depthAttachment));
+ setAttachment(GL_DEPTH, new DefaultAttachment(GL_DEPTH, surface));
}
- if (stencilAttachment)
+ if (config->stencilSize > 0)
{
- setAttachment(GL_STENCIL, new DefaultAttachment(GL_STENCIL, stencilAttachment));
+ setAttachment(GL_STENCIL, new DefaultAttachment(GL_STENCIL, surface));
}
GLenum drawBufferState = GL_BACK;