Commit 11cd6af6 by Corentin Wallez

Revert "Make the default framebuffer owned by Surface"

Compilation warning on Windows This reverts commit 6cb2ae82. Change-Id: I4ecadf5d8e909f986da186a7326cfa0922ae8710 Reviewed-on: https://chromium-review.googlesource.com/294241Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 6cb2ae82
...@@ -94,10 +94,15 @@ Context::Context(const egl::Config *config, ...@@ -94,10 +94,15 @@ Context::Context(const egl::Config *config,
mState.initializeZeroTextures(mZeroTextures); mState.initializeZeroTextures(mZeroTextures);
// Allocate default FBO
mFramebufferMap[0] = new Framebuffer(mCaps, mRenderer, 0);
bindVertexArray(0); bindVertexArray(0);
bindArrayBuffer(0); bindArrayBuffer(0);
bindElementArrayBuffer(0); bindElementArrayBuffer(0);
bindReadFramebuffer(0);
bindDrawFramebuffer(0);
bindRenderbuffer(0); bindRenderbuffer(0);
bindGenericUniformBuffer(0); bindGenericUniformBuffer(0);
...@@ -131,13 +136,10 @@ Context::~Context() ...@@ -131,13 +136,10 @@ Context::~Context()
{ {
mState.reset(); mState.reset();
for (auto framebuffer : mFramebufferMap) while (!mFramebufferMap.empty())
{ {
// Default framebuffer are owned by their respective Surface // Delete the framebuffer in reverse order to destroy the framebuffer zero last.
if (framebuffer.second->id() != 0) deleteFramebuffer(mFramebufferMap.rbegin()->first);
{
SafeDelete(framebuffer.second);
}
} }
while (!mFenceNVMap.empty()) while (!mFenceNVMap.empty())
...@@ -202,43 +204,60 @@ void Context::makeCurrent(egl::Surface *surface) ...@@ -202,43 +204,60 @@ void Context::makeCurrent(egl::Surface *surface)
{ {
releaseSurface(); releaseSurface();
} }
surface->setIsCurrent(true);
ASSERT(mCurrentSurface == nullptr);
mCurrentSurface = surface; mCurrentSurface = surface;
surface->setIsCurrent(true);
// Update default framebuffer
Framebuffer *defaultFBO = mFramebufferMap[0];
GLenum drawBufferState = GL_BACK;
defaultFBO->setDrawBuffers(1, &drawBufferState);
defaultFBO->setReadBuffer(GL_BACK);
// Update default framebuffer, the binding of the previous default const FramebufferAttachment *backAttachment = defaultFBO->getAttachment(GL_BACK);
// framebuffer (or lack of) will have a nullptr.
if (backAttachment && backAttachment->getSurface() == surface)
{ {
Framebuffer *newDefault = surface->getDefaultFramebuffer(); // FBO already initialized to the surface.
if (mState.getReadFramebuffer() == nullptr) return;
{ }
mState.setReadFramebufferBinding(newDefault);
} const egl::Config *config = surface->getConfig();
if (mState.getDrawFramebuffer() == nullptr)
{ defaultFBO->setAttachment(GL_FRAMEBUFFER_DEFAULT, GL_BACK, ImageIndex::MakeInvalid(), surface);
mState.setDrawFramebufferBinding(newDefault);
} if (config->depthSize > 0)
mFramebufferMap[0] = newDefault; {
defaultFBO->setAttachment(GL_FRAMEBUFFER_DEFAULT, GL_DEPTH, ImageIndex::MakeInvalid(), surface);
}
else
{
defaultFBO->resetAttachment(GL_DEPTH);
}
if (config->stencilSize > 0)
{
defaultFBO->setAttachment(GL_FRAMEBUFFER_DEFAULT, GL_STENCIL, ImageIndex::MakeInvalid(), surface);
}
else
{
defaultFBO->resetAttachment(GL_STENCIL);
} }
} }
void Context::releaseSurface() void Context::releaseSurface()
{ {
ASSERT(mCurrentSurface != nullptr); Framebuffer *defaultFBO = mFramebufferMap[0];
if (defaultFBO)
// Remove the default framebuffer
{ {
Framebuffer *currentDefault = mCurrentSurface->getDefaultFramebuffer(); defaultFBO->resetAttachment(GL_BACK);
if (mState.getReadFramebuffer() == currentDefault) defaultFBO->resetAttachment(GL_DEPTH);
{ defaultFBO->resetAttachment(GL_STENCIL);
mState.setReadFramebufferBinding(nullptr);
}
if (mState.getDrawFramebuffer() == currentDefault)
{
mState.setDrawFramebufferBinding(nullptr);
}
mFramebufferMap.erase(0);
} }
ASSERT(mCurrentSurface != nullptr);
mCurrentSurface->setIsCurrent(false); mCurrentSurface->setIsCurrent(false);
mCurrentSurface = nullptr; mCurrentSurface = nullptr;
} }
...@@ -1383,19 +1402,10 @@ EGLenum Context::getClientType() const ...@@ -1383,19 +1402,10 @@ EGLenum Context::getClientType() const
EGLenum Context::getRenderBuffer() const EGLenum Context::getRenderBuffer() const
{ {
auto framebufferIt = mFramebufferMap.find(0); ASSERT(mFramebufferMap.count(0) > 0);
if (framebufferIt != mFramebufferMap.end()) const Framebuffer *framebuffer = mFramebufferMap.find(0)->second;
{ const FramebufferAttachment *backAttachment = framebuffer->getAttachment(GL_BACK);
const Framebuffer *framebuffer = framebufferIt->second; return backAttachment ? backAttachment->getSurface()->getRenderBuffer() : EGL_NONE;
const FramebufferAttachment *backAttachment = framebuffer->getAttachment(GL_BACK);
ASSERT(backAttachment != nullptr);
return backAttachment->getSurface()->getRenderBuffer();
}
else
{
return EGL_NONE;
}
} }
const Caps &Context::getCaps() const const Caps &Context::getCaps() const
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "libANGLE/renderer/FramebufferImpl.h" #include "libANGLE/renderer/FramebufferImpl.h"
#include "libANGLE/renderer/ImplFactory.h" #include "libANGLE/renderer/ImplFactory.h"
#include "libANGLE/renderer/RenderbufferImpl.h" #include "libANGLE/renderer/RenderbufferImpl.h"
#include "libANGLE/renderer/SurfaceImpl.h"
namespace gl namespace gl
{ {
...@@ -38,14 +37,6 @@ void DetachMatchingAttachment(FramebufferAttachment *attachment, GLenum matchTyp ...@@ -38,14 +37,6 @@ void DetachMatchingAttachment(FramebufferAttachment *attachment, GLenum matchTyp
} }
} }
Framebuffer::Data::Data()
: mColorAttachments(1),
mDrawBufferStates(1, GL_NONE),
mReadBufferState(GL_COLOR_ATTACHMENT0_EXT)
{
mDrawBufferStates[0] = GL_COLOR_ATTACHMENT0_EXT;
}
Framebuffer::Data::Data(const Caps &caps) Framebuffer::Data::Data(const Caps &caps)
: mColorAttachments(caps.maxColorAttachments), : mColorAttachments(caps.maxColorAttachments),
mDrawBufferStates(caps.maxDrawBuffers, GL_NONE), mDrawBufferStates(caps.maxDrawBuffers, GL_NONE),
...@@ -92,7 +83,7 @@ const FramebufferAttachment *Framebuffer::Data::getDepthOrStencilAttachment() co ...@@ -92,7 +83,7 @@ const FramebufferAttachment *Framebuffer::Data::getDepthOrStencilAttachment() co
return nullptr; return nullptr;
} }
const FramebufferAttachment *Framebuffer::Data::getColorAttachment(size_t colorAttachment) const const FramebufferAttachment *Framebuffer::Data::getColorAttachment(unsigned int colorAttachment) const
{ {
ASSERT(colorAttachment < mColorAttachments.size()); ASSERT(colorAttachment < mColorAttachments.size());
return mColorAttachments[colorAttachment].isAttached() ? return mColorAttachments[colorAttachment].isAttached() ?
...@@ -125,15 +116,18 @@ const FramebufferAttachment *Framebuffer::Data::getDepthStencilAttachment() cons ...@@ -125,15 +116,18 @@ const FramebufferAttachment *Framebuffer::Data::getDepthStencilAttachment() cons
} }
Framebuffer::Framebuffer(const Caps &caps, rx::ImplFactory *factory, GLuint id) Framebuffer::Framebuffer(const Caps &caps, rx::ImplFactory *factory, GLuint id)
: mData(caps), mImpl(factory->createFramebuffer(mData)), mId(id) : mData(caps),
{ mImpl(nullptr),
ASSERT(mId != 0); mId(id)
ASSERT(mImpl != nullptr);
}
Framebuffer::Framebuffer(rx::SurfaceImpl *surface)
: mData(), mImpl(surface->createDefaultFramebuffer(mData)), mId(0)
{ {
if (mId == 0)
{
mImpl = factory->createDefaultFramebuffer(mData);
}
else
{
mImpl = factory->createFramebuffer(mData);
}
ASSERT(mImpl != nullptr); ASSERT(mImpl != nullptr);
} }
...@@ -163,7 +157,7 @@ void Framebuffer::detachResourceById(GLenum resourceType, GLuint resourceId) ...@@ -163,7 +157,7 @@ void Framebuffer::detachResourceById(GLenum resourceType, GLuint resourceId)
DetachMatchingAttachment(&mData.mStencilAttachment, resourceType, resourceId); DetachMatchingAttachment(&mData.mStencilAttachment, resourceType, resourceId);
} }
const FramebufferAttachment *Framebuffer::getColorbuffer(size_t colorAttachment) const const FramebufferAttachment *Framebuffer::getColorbuffer(unsigned int colorAttachment) const
{ {
return mData.getColorAttachment(colorAttachment); return mData.getColorAttachment(colorAttachment);
} }
...@@ -263,7 +257,7 @@ void Framebuffer::setReadBuffer(GLenum buffer) ...@@ -263,7 +257,7 @@ void Framebuffer::setReadBuffer(GLenum buffer)
mImpl->setReadBuffer(buffer); mImpl->setReadBuffer(buffer);
} }
bool Framebuffer::isEnabledColorAttachment(size_t colorAttachment) const bool Framebuffer::isEnabledColorAttachment(unsigned int colorAttachment) const
{ {
ASSERT(colorAttachment < mData.mColorAttachments.size()); ASSERT(colorAttachment < mData.mColorAttachments.size());
return (mData.mColorAttachments[colorAttachment].isAttached() && return (mData.mColorAttachments[colorAttachment].isAttached() &&
...@@ -283,11 +277,6 @@ bool Framebuffer::hasEnabledColorAttachment() const ...@@ -283,11 +277,6 @@ bool Framebuffer::hasEnabledColorAttachment() const
return false; return false;
} }
size_t Framebuffer::getNumColorBuffers() const
{
return mData.mColorAttachments.size();
}
bool Framebuffer::hasStencil() const bool Framebuffer::hasStencil() const
{ {
return (mData.mStencilAttachment.isAttached() && mData.mStencilAttachment.getStencilSize() > 0); return (mData.mStencilAttachment.isAttached() && mData.mStencilAttachment.getStencilSize() > 0);
......
...@@ -23,7 +23,6 @@ namespace rx ...@@ -23,7 +23,6 @@ namespace rx
class ImplFactory; class ImplFactory;
class FramebufferImpl; class FramebufferImpl;
class RenderbufferImpl; class RenderbufferImpl;
class SurfaceImpl;
} }
namespace egl namespace egl
...@@ -51,14 +50,13 @@ class Framebuffer ...@@ -51,14 +50,13 @@ class Framebuffer
class Data final : angle::NonCopyable class Data final : angle::NonCopyable
{ {
public: public:
explicit Data();
explicit Data(const Caps &caps); explicit Data(const Caps &caps);
~Data(); ~Data();
const FramebufferAttachment *getReadAttachment() const; const FramebufferAttachment *getReadAttachment() const;
const FramebufferAttachment *getFirstColorAttachment() const; const FramebufferAttachment *getFirstColorAttachment() const;
const FramebufferAttachment *getDepthOrStencilAttachment() const; const FramebufferAttachment *getDepthOrStencilAttachment() const;
const FramebufferAttachment *getColorAttachment(size_t colorAttachment) const; const FramebufferAttachment *getColorAttachment(unsigned int colorAttachment) const;
const FramebufferAttachment *getDepthAttachment() const; const FramebufferAttachment *getDepthAttachment() const;
const FramebufferAttachment *getStencilAttachment() const; const FramebufferAttachment *getStencilAttachment() const;
const FramebufferAttachment *getDepthStencilAttachment() const; const FramebufferAttachment *getDepthStencilAttachment() const;
...@@ -78,7 +76,6 @@ class Framebuffer ...@@ -78,7 +76,6 @@ class Framebuffer
}; };
Framebuffer(const Caps &caps, rx::ImplFactory *factory, GLuint id); Framebuffer(const Caps &caps, rx::ImplFactory *factory, GLuint id);
Framebuffer(rx::SurfaceImpl *surface);
virtual ~Framebuffer(); virtual ~Framebuffer();
const rx::FramebufferImpl *getImplementation() const { return mImpl; } const rx::FramebufferImpl *getImplementation() const { return mImpl; }
...@@ -95,7 +92,7 @@ class Framebuffer ...@@ -95,7 +92,7 @@ class Framebuffer
void detachTexture(GLuint texture); void detachTexture(GLuint texture);
void detachRenderbuffer(GLuint renderbuffer); void detachRenderbuffer(GLuint renderbuffer);
const FramebufferAttachment *getColorbuffer(size_t colorAttachment) const; const FramebufferAttachment *getColorbuffer(unsigned int colorAttachment) const;
const FramebufferAttachment *getDepthbuffer() const; const FramebufferAttachment *getDepthbuffer() const;
const FramebufferAttachment *getStencilbuffer() const; const FramebufferAttachment *getStencilbuffer() const;
const FramebufferAttachment *getDepthStencilBuffer() const; const FramebufferAttachment *getDepthStencilBuffer() const;
...@@ -112,9 +109,8 @@ class Framebuffer ...@@ -112,9 +109,8 @@ class Framebuffer
GLenum getReadBufferState() const; GLenum getReadBufferState() const;
void setReadBuffer(GLenum buffer); void setReadBuffer(GLenum buffer);
bool isEnabledColorAttachment(size_t colorAttachment) const; bool isEnabledColorAttachment(unsigned int colorAttachment) const;
bool hasEnabledColorAttachment() const; bool hasEnabledColorAttachment() const;
size_t getNumColorBuffers() const;
bool hasStencil() const; bool hasStencil() const;
int getSamples(const gl::Data &data) const; int getSamples(const gl::Data &data) const;
bool usingExtendedDrawBuffers() const; bool usingExtendedDrawBuffers() const;
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "libANGLE/Surface.h" #include "libANGLE/Surface.h"
#include "libANGLE/Config.h" #include "libANGLE/Config.h"
#include "libANGLE/Framebuffer.h"
#include "libANGLE/Texture.h" #include "libANGLE/Texture.h"
#include <EGL/eglext.h> #include <EGL/eglext.h>
...@@ -27,7 +26,6 @@ Surface::Surface(rx::SurfaceImpl *impl, ...@@ -27,7 +26,6 @@ Surface::Surface(rx::SurfaceImpl *impl,
const AttributeMap &attributes) const AttributeMap &attributes)
: FramebufferAttachmentObject(), : FramebufferAttachmentObject(),
mImplementation(impl), mImplementation(impl),
mDefaultFramebuffer(nullptr),
mCurrentCount(0), mCurrentCount(0),
mDestroyed(false), mDestroyed(false),
mType(surfaceType), mType(surfaceType),
...@@ -57,9 +55,6 @@ Surface::Surface(rx::SurfaceImpl *impl, ...@@ -57,9 +55,6 @@ Surface::Surface(rx::SurfaceImpl *impl,
mTextureFormat = attributes.get(EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE); mTextureFormat = attributes.get(EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE);
mTextureTarget = attributes.get(EGL_TEXTURE_TARGET, EGL_NO_TEXTURE); mTextureTarget = attributes.get(EGL_TEXTURE_TARGET, EGL_NO_TEXTURE);
} }
mDefaultFramebuffer = createDefaultFramebuffer();
ASSERT(mDefaultFramebuffer != nullptr);
} }
Surface::~Surface() Surface::~Surface()
...@@ -218,30 +213,4 @@ GLuint Surface::getId() const ...@@ -218,30 +213,4 @@ GLuint Surface::getId() const
UNREACHABLE(); UNREACHABLE();
return 0; return 0;
} }
gl::Framebuffer *Surface::createDefaultFramebuffer()
{
gl::Framebuffer *framebuffer = new gl::Framebuffer(mImplementation);
GLenum drawBufferState = GL_BACK;
framebuffer->setDrawBuffers(1, &drawBufferState);
framebuffer->setReadBuffer(GL_BACK);
framebuffer->setAttachment(GL_FRAMEBUFFER_DEFAULT, GL_BACK, gl::ImageIndex::MakeInvalid(),
this);
if (mConfig->depthSize > 0)
{
framebuffer->setAttachment(GL_FRAMEBUFFER_DEFAULT, GL_DEPTH, gl::ImageIndex::MakeInvalid(),
this);
}
if (mConfig->stencilSize > 0)
{
framebuffer->setAttachment(GL_FRAMEBUFFER_DEFAULT, GL_STENCIL,
gl::ImageIndex::MakeInvalid(), this);
}
return framebuffer;
}
} }
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
namespace gl namespace gl
{ {
class Framebuffer;
class Texture; class Texture;
} }
...@@ -65,7 +64,6 @@ class Surface final : public gl::FramebufferAttachmentObject ...@@ -65,7 +64,6 @@ class Surface final : public gl::FramebufferAttachmentObject
EGLenum getTextureTarget() const; EGLenum getTextureTarget() const;
gl::Texture *getBoundTexture() const { return mTexture.get(); } gl::Texture *getBoundTexture() const { return mTexture.get(); }
gl::Framebuffer *getDefaultFramebuffer() { return mDefaultFramebuffer; }
EGLint isFixedSize() const; EGLint isFixedSize() const;
...@@ -83,14 +81,11 @@ class Surface final : public gl::FramebufferAttachmentObject ...@@ -83,14 +81,11 @@ class Surface final : public gl::FramebufferAttachmentObject
virtual ~Surface(); virtual ~Surface();
rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const override { return mImplementation; } rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const override { return mImplementation; }
gl::Framebuffer *createDefaultFramebuffer();
// ANGLE-only method, used internally // ANGLE-only method, used internally
friend class gl::Texture; friend class gl::Texture;
void releaseTexImageFromTexture(); void releaseTexImageFromTexture();
rx::SurfaceImpl *mImplementation; rx::SurfaceImpl *mImplementation;
gl::Framebuffer *mDefaultFramebuffer;
int mCurrentCount; int mCurrentCount;
bool mDestroyed; bool mDestroyed;
......
...@@ -6,13 +6,9 @@ ...@@ -6,13 +6,9 @@
#include "gmock/gmock.h" #include "gmock/gmock.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/AttributeMap.h" #include "libANGLE/AttributeMap.h"
#include "libANGLE/Config.h" #include "libANGLE/Config.h"
#include "libANGLE/Data.h"
#include "libANGLE/State.h"
#include "libANGLE/Surface.h" #include "libANGLE/Surface.h"
#include "libANGLE/renderer/FramebufferImpl.h"
#include "libANGLE/renderer/SurfaceImpl.h" #include "libANGLE/renderer/SurfaceImpl.h"
namespace namespace
...@@ -24,8 +20,6 @@ class MockSurfaceImpl : public rx::SurfaceImpl ...@@ -24,8 +20,6 @@ class MockSurfaceImpl : public rx::SurfaceImpl
virtual ~MockSurfaceImpl() { destroy(); } virtual ~MockSurfaceImpl() { destroy(); }
MOCK_METHOD0(initialize, egl::Error()); MOCK_METHOD0(initialize, egl::Error());
MOCK_METHOD1(createDefaultFramebuffer,
rx::FramebufferImpl *(const gl::Framebuffer::Data &data));
MOCK_METHOD0(swap, egl::Error()); MOCK_METHOD0(swap, egl::Error());
MOCK_METHOD4(postSubBuffer, egl::Error(EGLint, EGLint, EGLint, EGLint)); MOCK_METHOD4(postSubBuffer, egl::Error(EGLint, EGLint, EGLint, EGLint));
MOCK_METHOD2(querySurfacePointerANGLE, egl::Error(EGLint, void**)); MOCK_METHOD2(querySurfacePointerANGLE, egl::Error(EGLint, void**));
...@@ -41,71 +35,15 @@ class MockSurfaceImpl : public rx::SurfaceImpl ...@@ -41,71 +35,15 @@ class MockSurfaceImpl : public rx::SurfaceImpl
MOCK_METHOD0(destroy, void()); MOCK_METHOD0(destroy, void());
}; };
class MockFramebufferImpl : public rx::FramebufferImpl
{
public:
MockFramebufferImpl() : rx::FramebufferImpl(gl::Framebuffer::Data()) {}
virtual ~MockFramebufferImpl() { destroy(); }
MOCK_METHOD1(onUpdateColorAttachment, void(size_t));
MOCK_METHOD0(onUpdateDepthAttachment, void());
MOCK_METHOD0(onUpdateStencilAttachment, void());
MOCK_METHOD0(onUpdateDepthStencilAttachment, void());
MOCK_METHOD2(setDrawBuffers, void(size_t, const GLenum *));
MOCK_METHOD1(setReadBuffer, void(GLenum));
MOCK_METHOD2(discard, gl::Error(size_t, const GLenum *));
MOCK_METHOD2(invalidate, gl::Error(size_t, const GLenum *));
MOCK_METHOD3(invalidateSub, gl::Error(size_t, const GLenum *, const gl::Rectangle &));
MOCK_METHOD2(clear, gl::Error(const gl::Data &, GLbitfield));
MOCK_METHOD4(clearBufferfv, gl::Error(const gl::State &, GLenum, GLint, const GLfloat *));
MOCK_METHOD4(clearBufferuiv, gl::Error(const gl::State &, GLenum, GLint, const GLuint *));
MOCK_METHOD4(clearBufferiv, gl::Error(const gl::State &, GLenum, GLint, const GLint *));
MOCK_METHOD5(clearBufferfi, gl::Error(const gl::State &, GLenum, GLint, GLfloat, GLint));
MOCK_CONST_METHOD0(getImplementationColorReadFormat, GLenum());
MOCK_CONST_METHOD0(getImplementationColorReadType, GLenum());
MOCK_CONST_METHOD5(
readPixels,
gl::Error(const gl::State &, const gl::Rectangle &, GLenum, GLenum, GLvoid *));
MOCK_METHOD6(blit,
gl::Error(const gl::State &,
const gl::Rectangle &,
const gl::Rectangle &,
GLbitfield,
GLenum,
const gl::Framebuffer *));
MOCK_CONST_METHOD0(checkStatus, GLenum());
MOCK_METHOD0(destroy, void());
};
class SurfaceTest : public testing::Test class SurfaceTest : public testing::Test
{ {
protected: protected:
virtual void SetUp() virtual void SetUp()
{ {
MockFramebufferImpl *framebuffer = new MockFramebufferImpl; mImpl = new MockSurfaceImpl;
EXPECT_CALL(*mImpl, getSwapBehavior());
mSurfaceImpl = new MockSurfaceImpl; EXPECT_CALL(*mImpl, destroy());
mSurface = new egl::Surface(mImpl, EGL_WINDOW_BIT, &mConfig, egl::AttributeMap());
EXPECT_CALL(*mSurfaceImpl, getSwapBehavior());
EXPECT_CALL(*mSurfaceImpl, createDefaultFramebuffer(testing::_))
.WillOnce(testing::Return(framebuffer));
EXPECT_CALL(*mSurfaceImpl, destroy());
EXPECT_CALL(*framebuffer, setDrawBuffers(1, testing::_));
EXPECT_CALL(*framebuffer, setReadBuffer(GL_BACK));
EXPECT_CALL(*framebuffer, onUpdateColorAttachment(0));
mSurface = new egl::Surface(mSurfaceImpl, EGL_WINDOW_BIT, &mConfig, egl::AttributeMap());
EXPECT_CALL(*framebuffer, destroy());
SafeDelete(framebuffer);
} }
virtual void TearDown() virtual void TearDown()
...@@ -113,31 +51,20 @@ class SurfaceTest : public testing::Test ...@@ -113,31 +51,20 @@ class SurfaceTest : public testing::Test
mSurface->onDestroy(); mSurface->onDestroy();
} }
MockSurfaceImpl *mSurfaceImpl; MockSurfaceImpl *mImpl;
egl::Surface *mSurface; egl::Surface *mSurface;
egl::Config mConfig; egl::Config mConfig;
}; };
TEST_F(SurfaceTest, DestructionDeletesImpl) TEST_F(SurfaceTest, DestructionDeletesImpl)
{ {
MockFramebufferImpl *framebuffer = new MockFramebufferImpl;
MockSurfaceImpl *impl = new MockSurfaceImpl; MockSurfaceImpl *impl = new MockSurfaceImpl;
EXPECT_CALL(*impl, getSwapBehavior()); EXPECT_CALL(*impl, getSwapBehavior());
EXPECT_CALL(*impl, createDefaultFramebuffer(testing::_)).WillOnce(testing::Return(framebuffer));
EXPECT_CALL(*framebuffer, setDrawBuffers(1, testing::_));
EXPECT_CALL(*framebuffer, setReadBuffer(GL_BACK));
EXPECT_CALL(*framebuffer, onUpdateColorAttachment(0));
EXPECT_CALL(*impl, destroy()).Times(1).RetiresOnSaturation(); EXPECT_CALL(*impl, destroy()).Times(1).RetiresOnSaturation();
egl::Surface *surface = new egl::Surface(impl, EGL_WINDOW_BIT, &mConfig, egl::AttributeMap()); egl::Surface *surface = new egl::Surface(impl, EGL_WINDOW_BIT, &mConfig, egl::AttributeMap());
surface->onDestroy(); surface->onDestroy();
EXPECT_CALL(*framebuffer, destroy());
SafeDelete(framebuffer);
// Only needed because the mock is leaked if bugs are present, // Only needed because the mock is leaked if bugs are present,
// which logs an error, but does not cause the test to fail. // which logs an error, but does not cause the test to fail.
// Ordinarily mocks are verified when destroyed. // Ordinarily mocks are verified when destroyed.
......
...@@ -29,8 +29,8 @@ DisplayImpl::~DisplayImpl() ...@@ -29,8 +29,8 @@ DisplayImpl::~DisplayImpl()
void DisplayImpl::destroySurface(egl::Surface *surface) void DisplayImpl::destroySurface(egl::Surface *surface)
{ {
mSurfaceSet.erase(surface);
surface->onDestroy(); surface->onDestroy();
mSurfaceSet.erase(surface);
} }
const egl::DisplayExtensions &DisplayImpl::getExtensions() const const egl::DisplayExtensions &DisplayImpl::getExtensions() const
......
...@@ -41,6 +41,7 @@ class ImplFactory : angle::NonCopyable ...@@ -41,6 +41,7 @@ class ImplFactory : angle::NonCopyable
virtual ProgramImpl *createProgram(const gl::Program::Data &data) = 0; virtual ProgramImpl *createProgram(const gl::Program::Data &data) = 0;
// Framebuffer creation // Framebuffer creation
virtual FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) = 0;
virtual FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &data) = 0; virtual FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &data) = 0;
// Texture creation // Texture creation
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libANGLE/Error.h" #include "libANGLE/Error.h"
#include "libANGLE/Framebuffer.h"
#include "libANGLE/FramebufferAttachment.h" #include "libANGLE/FramebufferAttachment.h"
namespace egl namespace egl
...@@ -23,8 +22,6 @@ struct Config; ...@@ -23,8 +22,6 @@ struct Config;
namespace rx namespace rx
{ {
class FramebufferImpl;
class SurfaceImpl : public FramebufferAttachmentObjectImpl class SurfaceImpl : public FramebufferAttachmentObjectImpl
{ {
public: public:
...@@ -32,7 +29,6 @@ class SurfaceImpl : public FramebufferAttachmentObjectImpl ...@@ -32,7 +29,6 @@ class SurfaceImpl : public FramebufferAttachmentObjectImpl
virtual ~SurfaceImpl(); virtual ~SurfaceImpl();
virtual egl::Error initialize() = 0; virtual egl::Error initialize() = 0;
virtual FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) = 0;
virtual egl::Error swap() = 0; virtual egl::Error swap() = 0;
virtual egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) = 0; virtual egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) = 0;
virtual egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) = 0; virtual egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) = 0;
......
...@@ -519,7 +519,7 @@ size_t RendererD3D::getBoundFramebufferTextures(const gl::Data &data, Framebuffe ...@@ -519,7 +519,7 @@ size_t RendererD3D::getBoundFramebufferTextures(const gl::Data &data, Framebuffe
size_t textureCount = 0; size_t textureCount = 0;
const gl::Framebuffer *drawFramebuffer = data.state->getDrawFramebuffer(); const gl::Framebuffer *drawFramebuffer = data.state->getDrawFramebuffer();
for (int i = 0; i < drawFramebuffer->getNumColorBuffers(); i++) for (unsigned int i = 0; i < data.caps->maxColorAttachments; i++)
{ {
const gl::FramebufferAttachment *attachment = drawFramebuffer->getColorbuffer(i); const gl::FramebufferAttachment *attachment = drawFramebuffer->getColorbuffer(i);
if (attachment && attachment->type() == GL_TEXTURE) if (attachment && attachment->type() == GL_TEXTURE)
......
...@@ -80,11 +80,6 @@ egl::Error SurfaceD3D::initialize() ...@@ -80,11 +80,6 @@ egl::Error SurfaceD3D::initialize()
return egl::Error(EGL_SUCCESS); return egl::Error(EGL_SUCCESS);
} }
FramebufferImpl *SurfaceD3D::createDefaultFramebuffer(const gl::Framebuffer::Data &data)
{
return mRenderer->createFramebuffer(data);
}
egl::Error SurfaceD3D::bindTexImage(EGLint) egl::Error SurfaceD3D::bindTexImage(EGLint)
{ {
return egl::Error(EGL_SUCCESS); return egl::Error(EGL_SUCCESS);
......
...@@ -33,7 +33,6 @@ class SurfaceD3D : public SurfaceImpl ...@@ -33,7 +33,6 @@ class SurfaceD3D : public SurfaceImpl
void releaseSwapChain(); void releaseSwapChain();
egl::Error initialize() override; egl::Error initialize() override;
FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) override;
egl::Error swap() override; egl::Error swap() override;
egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) override; egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) override;
......
...@@ -2962,6 +2962,11 @@ gl::Error Renderer11::createRenderTarget(int width, int height, GLenum format, G ...@@ -2962,6 +2962,11 @@ gl::Error Renderer11::createRenderTarget(int width, int height, GLenum format, G
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
} }
FramebufferImpl *Renderer11::createDefaultFramebuffer(const gl::Framebuffer::Data &data)
{
return createFramebuffer(data);
}
FramebufferImpl *Renderer11::createFramebuffer(const gl::Framebuffer::Data &data) FramebufferImpl *Renderer11::createFramebuffer(const gl::Framebuffer::Data &data)
{ {
return new Framebuffer11(data, this); return new Framebuffer11(data, this);
......
...@@ -182,6 +182,7 @@ class Renderer11 : public RendererD3D ...@@ -182,6 +182,7 @@ class Renderer11 : public RendererD3D
virtual gl::Error createRenderTarget(int width, int height, GLenum format, GLsizei samples, RenderTargetD3D **outRT); virtual gl::Error createRenderTarget(int width, int height, GLenum format, GLsizei samples, RenderTargetD3D **outRT);
// Framebuffer creation // Framebuffer creation
FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) override;
FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &data) override; FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &data) override;
// Shader creation // Shader creation
......
...@@ -2652,6 +2652,11 @@ gl::Error Renderer9::createRenderTarget(int width, int height, GLenum format, GL ...@@ -2652,6 +2652,11 @@ gl::Error Renderer9::createRenderTarget(int width, int height, GLenum format, GL
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
} }
FramebufferImpl *Renderer9::createDefaultFramebuffer(const gl::Framebuffer::Data &data)
{
return createFramebuffer(data);
}
FramebufferImpl *Renderer9::createFramebuffer(const gl::Framebuffer::Data &data) FramebufferImpl *Renderer9::createFramebuffer(const gl::Framebuffer::Data &data)
{ {
return new Framebuffer9(data, this); return new Framebuffer9(data, this);
......
...@@ -167,6 +167,7 @@ class Renderer9 : public RendererD3D ...@@ -167,6 +167,7 @@ class Renderer9 : public RendererD3D
virtual gl::Error createRenderTarget(int width, int height, GLenum format, GLsizei samples, RenderTargetD3D **outRT); virtual gl::Error createRenderTarget(int width, int height, GLenum format, GLsizei samples, RenderTargetD3D **outRT);
// Framebuffer creation // Framebuffer creation
FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) override;
FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &data) override; FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &data) override;
// Shader creation // Shader creation
......
...@@ -36,7 +36,6 @@ class DisplayGL : public DisplayImpl ...@@ -36,7 +36,6 @@ class DisplayGL : public DisplayImpl
egl::Error makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context) override; egl::Error makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context) override;
protected: protected:
RendererGL *getRenderer() const { return mRenderer; };
const gl::Version &getMaxSupportedESVersion() const; const gl::Version &getMaxSupportedESVersion() const;
private: private:
......
...@@ -181,6 +181,11 @@ ProgramImpl *RendererGL::createProgram(const gl::Program::Data &data) ...@@ -181,6 +181,11 @@ ProgramImpl *RendererGL::createProgram(const gl::Program::Data &data)
return new ProgramGL(data, mFunctions, mStateManager); return new ProgramGL(data, mFunctions, mStateManager);
} }
FramebufferImpl *RendererGL::createDefaultFramebuffer(const gl::Framebuffer::Data &data)
{
return new FramebufferGL(data, mFunctions, mStateManager, true);
}
FramebufferImpl *RendererGL::createFramebuffer(const gl::Framebuffer::Data &data) FramebufferImpl *RendererGL::createFramebuffer(const gl::Framebuffer::Data &data)
{ {
return new FramebufferGL(data, mFunctions, mStateManager, false); return new FramebufferGL(data, mFunctions, mStateManager, false);
......
...@@ -39,6 +39,7 @@ class RendererGL : public Renderer ...@@ -39,6 +39,7 @@ class RendererGL : public Renderer
ProgramImpl *createProgram(const gl::Program::Data &data) override; ProgramImpl *createProgram(const gl::Program::Data &data) override;
// Framebuffer creation // Framebuffer creation
FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) override;
FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &data) override; FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &data) override;
// Texture creation // Texture creation
...@@ -79,8 +80,6 @@ class RendererGL : public Renderer ...@@ -79,8 +80,6 @@ class RendererGL : public Renderer
void syncState(const gl::State &state, const gl::State::DirtyBits &dirtyBits) override; void syncState(const gl::State &state, const gl::State::DirtyBits &dirtyBits) override;
const gl::Version &getMaxSupportedESVersion() const; const gl::Version &getMaxSupportedESVersion() const;
const FunctionsGL *getFunctions() const { return mFunctions; }
StateManagerGL *getStateManager() const { return mStateManager; }
private: private:
void generateCaps(gl::Caps *outCaps, gl::TextureCapsMap* outTextureCaps, void generateCaps(gl::Caps *outCaps, gl::TextureCapsMap* outTextureCaps,
......
...@@ -8,13 +8,11 @@ ...@@ -8,13 +8,11 @@
#include "libANGLE/renderer/gl/SurfaceGL.h" #include "libANGLE/renderer/gl/SurfaceGL.h"
#include "libANGLE/renderer/gl/FramebufferGL.h"
#include "libANGLE/renderer/gl/RendererGL.h"
namespace rx namespace rx
{ {
SurfaceGL::SurfaceGL(RendererGL *renderer) : SurfaceImpl(), mRenderer(renderer) SurfaceGL::SurfaceGL()
: SurfaceImpl()
{ {
} }
...@@ -22,8 +20,4 @@ SurfaceGL::~SurfaceGL() ...@@ -22,8 +20,4 @@ SurfaceGL::~SurfaceGL()
{ {
} }
FramebufferImpl *SurfaceGL::createDefaultFramebuffer(const gl::Framebuffer::Data &data)
{
return new FramebufferGL(data, mRenderer->getFunctions(), mRenderer->getStateManager(), true);
}
} }
...@@ -14,12 +14,10 @@ ...@@ -14,12 +14,10 @@
namespace rx namespace rx
{ {
class RendererGL;
class SurfaceGL : public SurfaceImpl class SurfaceGL : public SurfaceImpl
{ {
public: public:
SurfaceGL(RendererGL *renderer); SurfaceGL();
~SurfaceGL() override; ~SurfaceGL() override;
gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target, gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target,
...@@ -28,12 +26,7 @@ class SurfaceGL : public SurfaceImpl ...@@ -28,12 +26,7 @@ class SurfaceGL : public SurfaceImpl
return gl::Error(GL_OUT_OF_MEMORY, "Not supported on OpenGL"); return gl::Error(GL_OUT_OF_MEMORY, "Not supported on OpenGL");
} }
FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) override;
virtual egl::Error makeCurrent() = 0; virtual egl::Error makeCurrent() = 0;
private:
RendererGL *mRenderer;
}; };
} }
......
...@@ -42,7 +42,7 @@ SurfaceImpl *DisplayCGL::createWindowSurface(const egl::Config *configuration, ...@@ -42,7 +42,7 @@ SurfaceImpl *DisplayCGL::createWindowSurface(const egl::Config *configuration,
const egl::AttributeMap &attribs) const egl::AttributeMap &attribs)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
return new WindowSurfaceCGL(this->getRenderer()); return new WindowSurfaceCGL();
} }
SurfaceImpl *DisplayCGL::createPbufferSurface(const egl::Config *configuration, SurfaceImpl *DisplayCGL::createPbufferSurface(const egl::Config *configuration,
......
...@@ -17,7 +17,7 @@ namespace rx ...@@ -17,7 +17,7 @@ namespace rx
class WindowSurfaceCGL : public SurfaceGL class WindowSurfaceCGL : public SurfaceGL
{ {
public: public:
WindowSurfaceCGL(RendererGL *renderer); WindowSurfaceCGL();
~WindowSurfaceCGL() override; ~WindowSurfaceCGL() override;
egl::Error initialize() override; egl::Error initialize() override;
......
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
#include "libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h" #include "libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h"
#include "common/debug.h" #include "common/debug.h"
#include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
namespace rx namespace rx
{ {
WindowSurfaceCGL::WindowSurfaceCGL(RendererGL *renderer) : SurfaceGL(renderer) WindowSurfaceCGL::WindowSurfaceCGL()
: SurfaceGL()
{ {
} }
......
...@@ -197,8 +197,7 @@ SurfaceImpl *DisplayGLX::createWindowSurface(const egl::Config *configuration, ...@@ -197,8 +197,7 @@ SurfaceImpl *DisplayGLX::createWindowSurface(const egl::Config *configuration,
ASSERT(configIdToGLXConfig.count(configuration->configID) > 0); ASSERT(configIdToGLXConfig.count(configuration->configID) > 0);
glx::FBConfig fbConfig = configIdToGLXConfig[configuration->configID]; glx::FBConfig fbConfig = configIdToGLXConfig[configuration->configID];
return new WindowSurfaceGLX(mGLX, this, this->getRenderer(), window, mGLX.getDisplay(), return new WindowSurfaceGLX(mGLX, *this, window, mGLX.getDisplay(), mContext, fbConfig);
mContext, fbConfig);
} }
SurfaceImpl *DisplayGLX::createPbufferSurface(const egl::Config *configuration, SurfaceImpl *DisplayGLX::createPbufferSurface(const egl::Config *configuration,
...@@ -211,8 +210,7 @@ SurfaceImpl *DisplayGLX::createPbufferSurface(const egl::Config *configuration, ...@@ -211,8 +210,7 @@ SurfaceImpl *DisplayGLX::createPbufferSurface(const egl::Config *configuration,
EGLint height = attribs.get(EGL_HEIGHT, 0); EGLint height = attribs.get(EGL_HEIGHT, 0);
bool largest = (attribs.get(EGL_LARGEST_PBUFFER, EGL_FALSE) == EGL_TRUE); bool largest = (attribs.get(EGL_LARGEST_PBUFFER, EGL_FALSE) == EGL_TRUE);
return new PbufferSurfaceGLX(this->getRenderer(), width, height, largest, mGLX, mContext, return new PbufferSurfaceGLX(width, height, largest, mGLX, mContext, fbConfig);
fbConfig);
} }
SurfaceImpl* DisplayGLX::createPbufferFromClientBuffer(const egl::Config *configuration, SurfaceImpl* DisplayGLX::createPbufferFromClientBuffer(const egl::Config *configuration,
......
...@@ -9,20 +9,14 @@ ...@@ -9,20 +9,14 @@
#include "libANGLE/renderer/gl/glx/PbufferSurfaceGLX.h" #include "libANGLE/renderer/gl/glx/PbufferSurfaceGLX.h"
#include "common/debug.h" #include "common/debug.h"
#include "libANGLE/renderer/gl/glx/DisplayGLX.h"
#include "libANGLE/renderer/gl/glx/FunctionsGLX.h" #include "libANGLE/renderer/gl/glx/FunctionsGLX.h"
namespace rx namespace rx
{ {
PbufferSurfaceGLX::PbufferSurfaceGLX(RendererGL *renderer, PbufferSurfaceGLX::PbufferSurfaceGLX(EGLint width, EGLint height, bool largest, const FunctionsGLX &glx,
EGLint width, glx::Context context, glx::FBConfig fbConfig)
EGLint height, : SurfaceGL(),
bool largest,
const FunctionsGLX &glx,
glx::Context context,
glx::FBConfig fbConfig)
: SurfaceGL(renderer),
mWidth(width), mWidth(width),
mHeight(height), mHeight(height),
mLargest(largest), mLargest(largest),
......
...@@ -15,19 +15,13 @@ ...@@ -15,19 +15,13 @@
namespace rx namespace rx
{ {
class DisplayGLX;
class FunctionsGLX; class FunctionsGLX;
class PbufferSurfaceGLX : public SurfaceGL class PbufferSurfaceGLX : public SurfaceGL
{ {
public: public:
PbufferSurfaceGLX(RendererGL *renderer, PbufferSurfaceGLX(EGLint width, EGLint height, bool largest, const FunctionsGLX &glx,
EGLint width, glx::Context context, glx::FBConfig fbConfig);
EGLint height,
bool largest,
const FunctionsGLX &glx,
glx::Context context,
glx::FBConfig fbConfig);
~PbufferSurfaceGLX() override; ~PbufferSurfaceGLX() override;
egl::Error initialize() override; egl::Error initialize() override;
......
...@@ -16,19 +16,14 @@ ...@@ -16,19 +16,14 @@
namespace rx namespace rx
{ {
WindowSurfaceGLX::WindowSurfaceGLX(const FunctionsGLX &glx, WindowSurfaceGLX::WindowSurfaceGLX(const FunctionsGLX &glx, const DisplayGLX &glxDisplay, Window window, Display *display,
DisplayGLX *glxDisplay, glx::Context context, glx::FBConfig fbConfig)
RendererGL *renderer, : SurfaceGL(),
Window window,
Display *display,
glx::Context context,
glx::FBConfig fbConfig)
: SurfaceGL(renderer),
mParent(window), mParent(window),
mWindow(0), mWindow(0),
mDisplay(display), mDisplay(display),
mGLX(glx), mGLX(glx),
mGLXDisplay(*glxDisplay), mGLXDisplay(glxDisplay),
mContext(context), mContext(context),
mFBConfig(fbConfig), mFBConfig(fbConfig),
mGLXWindow(0), mGLXWindow(0),
......
...@@ -21,13 +21,8 @@ class FunctionsGLX; ...@@ -21,13 +21,8 @@ class FunctionsGLX;
class WindowSurfaceGLX : public SurfaceGL class WindowSurfaceGLX : public SurfaceGL
{ {
public: public:
WindowSurfaceGLX(const FunctionsGLX &glx, WindowSurfaceGLX(const FunctionsGLX &glx, const DisplayGLX &glxDisplay, Window window, Display *display,
DisplayGLX *glxDisplay, glx::Context context, glx::FBConfig fbConfig);
RendererGL *renderer,
Window window,
Display *display,
glx::Context context,
glx::FBConfig fbConfig);
~WindowSurfaceGLX() override; ~WindowSurfaceGLX() override;
egl::Error initialize() override; egl::Error initialize() override;
......
...@@ -321,8 +321,7 @@ SurfaceImpl *DisplayWGL::createWindowSurface(const egl::Config *configuration, ...@@ -321,8 +321,7 @@ SurfaceImpl *DisplayWGL::createWindowSurface(const egl::Config *configuration,
EGLNativeWindowType window, EGLNativeWindowType window,
const egl::AttributeMap &attribs) const egl::AttributeMap &attribs)
{ {
return new WindowSurfaceWGL(this->getRenderer(), window, mPixelFormat, mWGLContext, return new WindowSurfaceWGL(window, mPixelFormat, mWGLContext, mFunctionsWGL);
mFunctionsWGL);
} }
SurfaceImpl *DisplayWGL::createPbufferSurface(const egl::Config *configuration, SurfaceImpl *DisplayWGL::createPbufferSurface(const egl::Config *configuration,
...@@ -334,8 +333,8 @@ SurfaceImpl *DisplayWGL::createPbufferSurface(const egl::Config *configuration, ...@@ -334,8 +333,8 @@ SurfaceImpl *DisplayWGL::createPbufferSurface(const egl::Config *configuration,
EGLenum textureFormat = attribs.get(EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE); EGLenum textureFormat = attribs.get(EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE);
EGLenum textureTarget = attribs.get(EGL_TEXTURE_TARGET, EGL_NO_TEXTURE); EGLenum textureTarget = attribs.get(EGL_TEXTURE_TARGET, EGL_NO_TEXTURE);
return new PbufferSurfaceWGL(this->getRenderer(), width, height, textureFormat, textureTarget, return new PbufferSurfaceWGL(width, height, textureFormat, textureTarget, largest,
largest, mPixelFormat, mDeviceContext, mWGLContext, mFunctionsWGL); mPixelFormat, mDeviceContext, mWGLContext, mFunctionsWGL);
} }
SurfaceImpl *DisplayWGL::createPbufferFromClientBuffer(const egl::Config *configuration, SurfaceImpl *DisplayWGL::createPbufferFromClientBuffer(const egl::Config *configuration,
......
...@@ -9,24 +9,16 @@ ...@@ -9,24 +9,16 @@
#include "libANGLE/renderer/gl/wgl/PbufferSurfaceWGL.h" #include "libANGLE/renderer/gl/wgl/PbufferSurfaceWGL.h"
#include "common/debug.h" #include "common/debug.h"
#include "libANGLE/renderer/gl/RendererGL.h"
#include "libANGLE/renderer/gl/wgl/FunctionsWGL.h" #include "libANGLE/renderer/gl/wgl/FunctionsWGL.h"
#include "libANGLE/renderer/gl/wgl/wgl_utils.h" #include "libANGLE/renderer/gl/wgl/wgl_utils.h"
namespace rx namespace rx
{ {
PbufferSurfaceWGL::PbufferSurfaceWGL(RendererGL *renderer, PbufferSurfaceWGL::PbufferSurfaceWGL(EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureTarget,
EGLint width, bool largest, int pixelFormat, HDC deviceContext, HGLRC wglContext,
EGLint height,
EGLenum textureFormat,
EGLenum textureTarget,
bool largest,
int pixelFormat,
HDC deviceContext,
HGLRC wglContext,
const FunctionsWGL *functions) const FunctionsWGL *functions)
: SurfaceGL(renderer), : SurfaceGL(),
mWidth(width), mWidth(width),
mHeight(height), mHeight(height),
mLargest(largest), mLargest(largest),
......
...@@ -21,15 +21,8 @@ class FunctionsWGL; ...@@ -21,15 +21,8 @@ class FunctionsWGL;
class PbufferSurfaceWGL : public SurfaceGL class PbufferSurfaceWGL : public SurfaceGL
{ {
public: public:
PbufferSurfaceWGL(RendererGL *renderer, PbufferSurfaceWGL(EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureTarget,
EGLint width, bool largest, int pixelFormat, HDC deviceContext, HGLRC wglContext,
EGLint height,
EGLenum textureFormat,
EGLenum textureTarget,
bool largest,
int pixelFormat,
HDC deviceContext,
HGLRC wglContext,
const FunctionsWGL *functions); const FunctionsWGL *functions);
~PbufferSurfaceWGL() override; ~PbufferSurfaceWGL() override;
......
...@@ -9,19 +9,17 @@ ...@@ -9,19 +9,17 @@
#include "libANGLE/renderer/gl/wgl/WindowSurfaceWGL.h" #include "libANGLE/renderer/gl/wgl/WindowSurfaceWGL.h"
#include "common/debug.h" #include "common/debug.h"
#include "libANGLE/renderer/gl/RendererGL.h"
#include "libANGLE/renderer/gl/wgl/FunctionsWGL.h" #include "libANGLE/renderer/gl/wgl/FunctionsWGL.h"
#include "libANGLE/renderer/gl/wgl/wgl_utils.h" #include "libANGLE/renderer/gl/wgl/wgl_utils.h"
namespace rx namespace rx
{ {
WindowSurfaceWGL::WindowSurfaceWGL(RendererGL *renderer, WindowSurfaceWGL::WindowSurfaceWGL(EGLNativeWindowType window,
EGLNativeWindowType window,
int pixelFormat, int pixelFormat,
HGLRC wglContext, HGLRC wglContext,
const FunctionsWGL *functions) const FunctionsWGL *functions)
: SurfaceGL(renderer), : SurfaceGL(),
mPixelFormat(pixelFormat), mPixelFormat(pixelFormat),
mWGLContext(wglContext), mWGLContext(wglContext),
mWindow(window), mWindow(window),
......
...@@ -21,11 +21,7 @@ class FunctionsWGL; ...@@ -21,11 +21,7 @@ class FunctionsWGL;
class WindowSurfaceWGL : public SurfaceGL class WindowSurfaceWGL : public SurfaceGL
{ {
public: public:
WindowSurfaceWGL(RendererGL *renderer, WindowSurfaceWGL(EGLNativeWindowType window, int pixelFormat, HGLRC wglContext, const FunctionsWGL *functions);
EGLNativeWindowType window,
int pixelFormat,
HGLRC wglContext,
const FunctionsWGL *functions);
~WindowSurfaceWGL() override; ~WindowSurfaceWGL() override;
egl::Error initialize() override; egl::Error initialize() override;
......
...@@ -605,7 +605,7 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint ...@@ -605,7 +605,7 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint
GLenum readInternalFormat = readColorBuffer->getInternalFormat(); GLenum readInternalFormat = readColorBuffer->getInternalFormat();
const InternalFormat &readFormatInfo = GetInternalFormatInfo(readInternalFormat); const InternalFormat &readFormatInfo = GetInternalFormatInfo(readInternalFormat);
for (size_t i = 0; i < drawFramebuffer->getNumColorBuffers(); i++) for (GLuint i = 0; i < context->getCaps().maxColorAttachments; i++)
{ {
if (drawFramebuffer->isEnabledColorAttachment(i)) if (drawFramebuffer->isEnabledColorAttachment(i))
{ {
...@@ -661,8 +661,7 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint ...@@ -661,8 +661,7 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint
return false; return false;
} }
for (size_t colorAttachment = 0; for (GLuint colorAttachment = 0; colorAttachment < context->getCaps().maxColorAttachments; ++colorAttachment)
colorAttachment < drawFramebuffer->getNumColorBuffers(); ++colorAttachment)
{ {
if (drawFramebuffer->isEnabledColorAttachment(colorAttachment)) if (drawFramebuffer->isEnabledColorAttachment(colorAttachment))
{ {
......
...@@ -26,6 +26,7 @@ class NullFactory : public ImplFactory ...@@ -26,6 +26,7 @@ class NullFactory : public ImplFactory
ProgramImpl *createProgram(const gl::Program::Data &data) override { return nullptr; } ProgramImpl *createProgram(const gl::Program::Data &data) override { return nullptr; }
// Framebuffer creation // Framebuffer creation
FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &data) override { return nullptr; }
FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &data) override { return nullptr; } FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &data) override { return nullptr; }
// Texture creation // Texture creation
......
...@@ -55,7 +55,7 @@ class D3D11EmulatedIndexedBufferTest : public ANGLETest ...@@ -55,7 +55,7 @@ class D3D11EmulatedIndexedBufferTest : public ANGLETest
void TearDown() override void TearDown() override
{ {
SafeDelete(mSourceBuffer); SafeDelete(mSourceBuffer);
ANGLETest::TearDown(); ANGLETest::TearDown();
} }
void createMappableCompareBufferFromEmulatedBuffer(ID3D11Buffer *sourceBuffer, GLuint size, ID3D11Buffer **mappableBuffer) void createMappableCompareBufferFromEmulatedBuffer(ID3D11Buffer *sourceBuffer, GLuint size, ID3D11Buffer **mappableBuffer)
......
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