Commit 6ab01b9a by Corentin Wallez

FramebufferGL: Add a member to know if we are the default FBO

On CGL, the default framebuffer will have a name different than 0 and without this change it wouldn't get special-cased as on the other platforms. It is assumed that the default framebuffer will get initialized directly by the driver or other parts of the code. BUG=angleproject:891 Change-Id: Ifbe4ada58f27ad9ddb5b43697c234cb17e7504f0 Reviewed-on: https://chromium-review.googlesource.com/290147Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent c384d2a3
...@@ -26,9 +26,10 @@ FramebufferGL::FramebufferGL(const gl::Framebuffer::Data &data, const FunctionsG ...@@ -26,9 +26,10 @@ FramebufferGL::FramebufferGL(const gl::Framebuffer::Data &data, const FunctionsG
: FramebufferImpl(data), : FramebufferImpl(data),
mFunctions(functions), mFunctions(functions),
mStateManager(stateManager), mStateManager(stateManager),
mFramebufferID(0) mFramebufferID(0),
mIsDefault(isDefault)
{ {
if (!isDefault) if (!mIsDefault)
{ {
mFunctions->genFramebuffers(1, &mFramebufferID); mFunctions->genFramebuffers(1, &mFramebufferID);
} }
...@@ -92,7 +93,7 @@ static void BindFramebufferAttachment(const FunctionsGL *functions, GLenum attac ...@@ -92,7 +93,7 @@ static void BindFramebufferAttachment(const FunctionsGL *functions, GLenum attac
void FramebufferGL::onUpdateColorAttachment(size_t index) void FramebufferGL::onUpdateColorAttachment(size_t index)
{ {
if (mFramebufferID != 0) if (!mIsDefault)
{ {
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID); mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
BindFramebufferAttachment(mFunctions, BindFramebufferAttachment(mFunctions,
...@@ -103,7 +104,7 @@ void FramebufferGL::onUpdateColorAttachment(size_t index) ...@@ -103,7 +104,7 @@ void FramebufferGL::onUpdateColorAttachment(size_t index)
void FramebufferGL::onUpdateDepthAttachment() void FramebufferGL::onUpdateDepthAttachment()
{ {
if (mFramebufferID != 0) if (!mIsDefault)
{ {
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID); mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
BindFramebufferAttachment(mFunctions, BindFramebufferAttachment(mFunctions,
...@@ -114,7 +115,7 @@ void FramebufferGL::onUpdateDepthAttachment() ...@@ -114,7 +115,7 @@ void FramebufferGL::onUpdateDepthAttachment()
void FramebufferGL::onUpdateStencilAttachment() void FramebufferGL::onUpdateStencilAttachment()
{ {
if (mFramebufferID != 0) if (!mIsDefault)
{ {
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID); mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
BindFramebufferAttachment(mFunctions, BindFramebufferAttachment(mFunctions,
...@@ -125,7 +126,7 @@ void FramebufferGL::onUpdateStencilAttachment() ...@@ -125,7 +126,7 @@ void FramebufferGL::onUpdateStencilAttachment()
void FramebufferGL::onUpdateDepthStencilAttachment() void FramebufferGL::onUpdateDepthStencilAttachment()
{ {
if (mFramebufferID != 0) if (!mIsDefault)
{ {
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID); mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
BindFramebufferAttachment(mFunctions, BindFramebufferAttachment(mFunctions,
...@@ -136,7 +137,7 @@ void FramebufferGL::onUpdateDepthStencilAttachment() ...@@ -136,7 +137,7 @@ void FramebufferGL::onUpdateDepthStencilAttachment()
void FramebufferGL::setDrawBuffers(size_t count, const GLenum *buffers) void FramebufferGL::setDrawBuffers(size_t count, const GLenum *buffers)
{ {
if (mFramebufferID != 0) if (!mIsDefault)
{ {
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID); mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
mFunctions->drawBuffers(count, buffers); mFunctions->drawBuffers(count, buffers);
...@@ -145,7 +146,7 @@ void FramebufferGL::setDrawBuffers(size_t count, const GLenum *buffers) ...@@ -145,7 +146,7 @@ void FramebufferGL::setDrawBuffers(size_t count, const GLenum *buffers)
void FramebufferGL::setReadBuffer(GLenum buffer) void FramebufferGL::setReadBuffer(GLenum buffer)
{ {
if (mFramebufferID != 0) if (!mIsDefault)
{ {
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID); mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
mFunctions->readBuffer(buffer); mFunctions->readBuffer(buffer);
......
...@@ -57,6 +57,7 @@ class FramebufferGL : public FramebufferImpl ...@@ -57,6 +57,7 @@ class FramebufferGL : public FramebufferImpl
StateManagerGL *mStateManager; StateManagerGL *mStateManager;
GLuint mFramebufferID; GLuint mFramebufferID;
bool mIsDefault;
}; };
} }
......
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