Revert "Explicitly enable framebuffer SRGB blending in StateManagerGL."
More compile errors on mac.
This reverts commit 056fae4a01db306b8f9c1e57374e18ebffbdf8eb.
Change-Id: I579b9e50ded7240be4f488a48588a89ecb4bea44
Reviewed-on: https://chromium-review.googlesource.com/302571
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/gl/FramebufferGL.cpp b/src/libANGLE/renderer/gl/FramebufferGL.cpp
index 92e08cc..35712dc 100644
--- a/src/libANGLE/renderer/gl/FramebufferGL.cpp
+++ b/src/libANGLE/renderer/gl/FramebufferGL.cpp
@@ -18,20 +18,14 @@
#include "libANGLE/renderer/gl/RenderbufferGL.h"
#include "libANGLE/renderer/gl/StateManagerGL.h"
#include "libANGLE/renderer/gl/TextureGL.h"
-#include "libANGLE/renderer/gl/WorkaroundsGL.h"
namespace rx
{
-FramebufferGL::FramebufferGL(const gl::Framebuffer::Data &data,
- const FunctionsGL *functions,
- StateManagerGL *stateManager,
- const WorkaroundsGL &workarounds,
- bool isDefault)
+FramebufferGL::FramebufferGL(const gl::Framebuffer::Data &data, const FunctionsGL *functions, StateManagerGL *stateManager, bool isDefault)
: FramebufferImpl(data),
mFunctions(functions),
mStateManager(stateManager),
- mWorkarounds(workarounds),
mFramebufferID(0),
mIsDefault(isDefault)
{
@@ -44,12 +38,10 @@
FramebufferGL::FramebufferGL(GLuint id,
const gl::Framebuffer::Data &data,
const FunctionsGL *functions,
- const WorkaroundsGL &workarounds,
StateManagerGL *stateManager)
: FramebufferImpl(data),
mFunctions(functions),
mStateManager(stateManager),
- mWorkarounds(workarounds),
mFramebufferID(id),
mIsDefault(true)
{
@@ -205,7 +197,6 @@
gl::Error FramebufferGL::clear(const gl::Data &data, GLbitfield mask)
{
- syncClearState(mask);
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
mFunctions->clear(mask);
@@ -214,7 +205,6 @@
gl::Error FramebufferGL::clearBufferfv(const gl::State &state, GLenum buffer, GLint drawbuffer, const GLfloat *values)
{
- syncClearBufferState(buffer, drawbuffer);
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
mFunctions->clearBufferfv(buffer, drawbuffer, values);
@@ -223,7 +213,6 @@
gl::Error FramebufferGL::clearBufferuiv(const gl::State &state, GLenum buffer, GLint drawbuffer, const GLuint *values)
{
- syncClearBufferState(buffer, drawbuffer);
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
mFunctions->clearBufferuiv(buffer, drawbuffer, values);
@@ -232,7 +221,6 @@
gl::Error FramebufferGL::clearBufferiv(const gl::State &state, GLenum buffer, GLint drawbuffer, const GLint *values)
{
- syncClearBufferState(buffer, drawbuffer);
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
mFunctions->clearBufferiv(buffer, drawbuffer, values);
@@ -241,7 +229,6 @@
gl::Error FramebufferGL::clearBufferfi(const gl::State &state, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
{
- syncClearBufferState(buffer, drawbuffer);
mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
mFunctions->clearBufferfi(buffer, drawbuffer, depth, stencil);
@@ -303,72 +290,4 @@
return mFramebufferID;
}
-void FramebufferGL::syncDrawState() const
-{
- if (mFunctions->standard == STANDARD_GL_DESKTOP)
- {
- // Enable SRGB blending for all framebuffers except the default framebuffer on Desktop
- // OpenGL.
- // When SRGB blending is enabled, only SRGB capable formats will use it but the default
- // framebuffer will always use it if it is enabled.
- // TODO(geofflang): Update this when the framebuffer binding dirty changes, when it exists.
- mStateManager->setFramebufferSRGBEnabled(!mIsDefault);
- }
-}
-
-void FramebufferGL::syncClearState(GLbitfield mask)
-{
- if (mWorkarounds.doesSRGBClearsOnLinearFramebufferAttachments &&
- (mask & GL_COLOR_BUFFER_BIT) != 0 && !mIsDefault)
- {
- bool hasSRBAttachment = false;
- for (const auto &attachment : mData.getColorAttachments())
- {
- if (attachment.isAttached() && attachment.getColorEncoding() == GL_SRGB)
- {
- hasSRBAttachment = true;
- break;
- }
- }
-
- mStateManager->setFramebufferSRGBEnabled(hasSRBAttachment);
- }
- else
- {
- mStateManager->setFramebufferSRGBEnabled(!mIsDefault);
- }
-}
-
-void FramebufferGL::syncClearBufferState(GLenum buffer, GLint drawBuffer)
-{
- if (mFunctions->standard == STANDARD_GL_DESKTOP)
- {
- if (mWorkarounds.doesSRGBClearsOnLinearFramebufferAttachments && buffer == GL_COLOR &&
- !mIsDefault)
- {
- // If doing a clear on a color buffer, set SRGB blend enabled only if the color buffer
- // is an SRGB format.
- const auto &drawbufferState = mData.getDrawBufferStates();
- const auto &colorAttachments = mData.getColorAttachments();
-
- const gl::FramebufferAttachment *attachment = nullptr;
- if (drawbufferState[drawBuffer] >= GL_COLOR_ATTACHMENT0 &&
- drawbufferState[drawBuffer] < GL_COLOR_ATTACHMENT0 + colorAttachments.size())
- {
- size_t attachmentIdx =
- static_cast<size_t>(drawbufferState[drawBuffer] - GL_COLOR_ATTACHMENT0);
- attachment = &colorAttachments[attachmentIdx];
- }
-
- if (attachment != nullptr)
- {
- mStateManager->setFramebufferSRGBEnabled(attachment->getColorEncoding() == GL_SRGB);
- }
- }
- else
- {
- mStateManager->setFramebufferSRGBEnabled(!mIsDefault);
- }
- }
-}
}