Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Unified Diff: src/gpu/gl/GrGLGpu.cpp

Issue 1830303002: Require sRGB write control for sRGB support. Add flag to GrPaint to suppress linear -> sRGB convers… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added comment to srgbSupport() Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLGpu.cpp
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 3a293610f2f8e34fcc79c41462822274207c1bae..3bbc77aa9b128529bb66e27804466b64bf8eb4b5 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -2114,7 +2114,7 @@ bool GrGLGpu::flushGLState(const GrPipeline& pipeline, const GrPrimitiveProcesso
// This must come after textures are flushed because a texture may need
// to be msaa-resolved (which will modify bound FBO state).
- this->flushRenderTarget(glRT, nullptr);
+ this->flushRenderTarget(glRT, nullptr, pipeline.getDisableOutputConversionToSRGB());
return true;
}
@@ -2833,7 +2833,7 @@ void GrGLGpu::finishDrawTarget() {
}
}
-void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bounds) {
+void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bounds, bool disableSRGB) {
SkASSERT(target);
uint32_t rtID = target->getUniqueID();
@@ -2855,17 +2855,19 @@ void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bounds)
#endif
fHWBoundRenderTargetUniqueID = rtID;
this->flushViewport(target->getViewport());
- if (this->glCaps().srgbWriteControl()) {
- bool enableSRGBWrite = GrPixelConfigIsSRGB(target->config());
- if (enableSRGBWrite && kYes_TriState != fHWSRGBFramebuffer) {
- GL_CALL(Enable(GR_GL_FRAMEBUFFER_SRGB));
- fHWSRGBFramebuffer = kYes_TriState;
- } else if (!enableSRGBWrite && kNo_TriState != fHWSRGBFramebuffer) {
- GL_CALL(Disable(GR_GL_FRAMEBUFFER_SRGB));
- fHWSRGBFramebuffer = kNo_TriState;
- }
+ }
+
+ if (this->glCaps().srgbSupport()) {
+ bool enableSRGBWrite = GrPixelConfigIsSRGB(target->config()) && !disableSRGB;
+ if (enableSRGBWrite && kYes_TriState != fHWSRGBFramebuffer) {
+ GL_CALL(Enable(GR_GL_FRAMEBUFFER_SRGB));
+ fHWSRGBFramebuffer = kYes_TriState;
+ } else if (!enableSRGBWrite && kNo_TriState != fHWSRGBFramebuffer) {
+ GL_CALL(Disable(GR_GL_FRAMEBUFFER_SRGB));
+ fHWSRGBFramebuffer = kNo_TriState;
}
}
+
this->didWriteToSurface(target, bounds);
}
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698