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

Side by Side 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, 8 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 unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrGLGpu.h" 8 #include "GrGLGpu.h"
9 #include "GrGLGLSL.h" 9 #include "GrGLGLSL.h"
10 #include "GrGLStencilAttachment.h" 10 #include "GrGLStencilAttachment.h"
(...skipping 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after
2107 this->bindTexture(i, textureAccesses[i]->getParams(), allowSRGB, 2107 this->bindTexture(i, textureAccesses[i]->getParams(), allowSRGB,
2108 static_cast<GrGLTexture*>(textureAccesses[i]->getTextu re())); 2108 static_cast<GrGLTexture*>(textureAccesses[i]->getTextu re()));
2109 } 2109 }
2110 2110
2111 this->flushStencil(pipeline.getStencil()); 2111 this->flushStencil(pipeline.getStencil());
2112 this->flushScissor(pipeline.getScissorState(), glRT->getViewport(), glRT->or igin()); 2112 this->flushScissor(pipeline.getScissorState(), glRT->getViewport(), glRT->or igin());
2113 this->flushHWAAState(glRT, pipeline.isHWAntialiasState(), !pipeline.getStenc il().isDisabled()); 2113 this->flushHWAAState(glRT, pipeline.isHWAntialiasState(), !pipeline.getStenc il().isDisabled());
2114 2114
2115 // This must come after textures are flushed because a texture may need 2115 // This must come after textures are flushed because a texture may need
2116 // to be msaa-resolved (which will modify bound FBO state). 2116 // to be msaa-resolved (which will modify bound FBO state).
2117 this->flushRenderTarget(glRT, nullptr); 2117 this->flushRenderTarget(glRT, nullptr, pipeline.getDisableOutputConversionTo SRGB());
2118 2118
2119 return true; 2119 return true;
2120 } 2120 }
2121 2121
2122 void GrGLGpu::setupGeometry(const GrPrimitiveProcessor& primProc, 2122 void GrGLGpu::setupGeometry(const GrPrimitiveProcessor& primProc,
2123 const GrNonInstancedMesh& mesh, 2123 const GrNonInstancedMesh& mesh,
2124 size_t* indexOffsetInBytes) { 2124 size_t* indexOffsetInBytes) {
2125 GrGLVertexBuffer* vbuf; 2125 GrGLVertexBuffer* vbuf;
2126 vbuf = (GrGLVertexBuffer*) mesh.vertexBuffer(); 2126 vbuf = (GrGLVertexBuffer*) mesh.vertexBuffer();
2127 2127
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
2826 SkASSERT(fMSAAEnabled != kYes_TriState); 2826 SkASSERT(fMSAAEnabled != kYes_TriState);
2827 GL_CALL(Enable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE)); 2827 GL_CALL(Enable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE));
2828 this->stampRectUsingProgram(fPLSSetupProgram.fProgram, 2828 this->stampRectUsingProgram(fPLSSetupProgram.fProgram,
2829 SkRect::MakeXYWH(-100.0f, -100.0f, 0.01f, 0. 01f), 2829 SkRect::MakeXYWH(-100.0f, -100.0f, 0.01f, 0. 01f),
2830 fPLSSetupProgram.fPosXformUniform, 2830 fPLSSetupProgram.fPosXformUniform,
2831 fPLSSetupProgram.fArrayBuffer); 2831 fPLSSetupProgram.fArrayBuffer);
2832 GL_CALL(Disable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE)); 2832 GL_CALL(Disable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE));
2833 } 2833 }
2834 } 2834 }
2835 2835
2836 void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bounds) { 2836 void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bounds, bool disableSRGB) {
2837 SkASSERT(target); 2837 SkASSERT(target);
2838 2838
2839 uint32_t rtID = target->getUniqueID(); 2839 uint32_t rtID = target->getUniqueID();
2840 if (fHWBoundRenderTargetUniqueID != rtID) { 2840 if (fHWBoundRenderTargetUniqueID != rtID) {
2841 fStats.incRenderTargetBinds(); 2841 fStats.incRenderTargetBinds();
2842 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, target->renderFBOID())); 2842 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, target->renderFBOID()));
2843 #ifdef SK_DEBUG 2843 #ifdef SK_DEBUG
2844 // don't do this check in Chromium -- this is causing 2844 // don't do this check in Chromium -- this is causing
2845 // lots of repeated command buffer flushes when the compositor is 2845 // lots of repeated command buffer flushes when the compositor is
2846 // rendering with Ganesh, which is really slow; even too slow for 2846 // rendering with Ganesh, which is really slow; even too slow for
2847 // Debug mode. 2847 // Debug mode.
2848 if (kChromium_GrGLDriver != this->glContext().driver()) { 2848 if (kChromium_GrGLDriver != this->glContext().driver()) {
2849 GrGLenum status; 2849 GrGLenum status;
2850 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); 2850 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
2851 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { 2851 if (status != GR_GL_FRAMEBUFFER_COMPLETE) {
2852 SkDebugf("GrGLGpu::flushRenderTarget glCheckFramebufferStatus %x \n", status); 2852 SkDebugf("GrGLGpu::flushRenderTarget glCheckFramebufferStatus %x \n", status);
2853 } 2853 }
2854 } 2854 }
2855 #endif 2855 #endif
2856 fHWBoundRenderTargetUniqueID = rtID; 2856 fHWBoundRenderTargetUniqueID = rtID;
2857 this->flushViewport(target->getViewport()); 2857 this->flushViewport(target->getViewport());
2858 if (this->glCaps().srgbWriteControl()) { 2858 }
2859 bool enableSRGBWrite = GrPixelConfigIsSRGB(target->config()); 2859
2860 if (enableSRGBWrite && kYes_TriState != fHWSRGBFramebuffer) { 2860 if (this->glCaps().srgbSupport()) {
2861 GL_CALL(Enable(GR_GL_FRAMEBUFFER_SRGB)); 2861 bool enableSRGBWrite = GrPixelConfigIsSRGB(target->config()) && !disable SRGB;
2862 fHWSRGBFramebuffer = kYes_TriState; 2862 if (enableSRGBWrite && kYes_TriState != fHWSRGBFramebuffer) {
2863 } else if (!enableSRGBWrite && kNo_TriState != fHWSRGBFramebuffer) { 2863 GL_CALL(Enable(GR_GL_FRAMEBUFFER_SRGB));
2864 GL_CALL(Disable(GR_GL_FRAMEBUFFER_SRGB)); 2864 fHWSRGBFramebuffer = kYes_TriState;
2865 fHWSRGBFramebuffer = kNo_TriState; 2865 } else if (!enableSRGBWrite && kNo_TriState != fHWSRGBFramebuffer) {
2866 } 2866 GL_CALL(Disable(GR_GL_FRAMEBUFFER_SRGB));
2867 fHWSRGBFramebuffer = kNo_TriState;
2867 } 2868 }
2868 } 2869 }
2870
2869 this->didWriteToSurface(target, bounds); 2871 this->didWriteToSurface(target, bounds);
2870 } 2872 }
2871 2873
2872 void GrGLGpu::flushViewport(const GrGLIRect& viewport) { 2874 void GrGLGpu::flushViewport(const GrGLIRect& viewport) {
2873 if (fHWViewport != viewport) { 2875 if (fHWViewport != viewport) {
2874 viewport.pushToGLViewport(this->glInterface()); 2876 viewport.pushToGLViewport(this->glInterface());
2875 fHWViewport = viewport; 2877 fHWViewport = viewport;
2876 } 2878 }
2877 } 2879 }
2878 2880
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after
4415 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || 4417 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() ||
4416 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { 4418 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) {
4417 copyParams->fFilter = GrTextureParams::kNone_FilterMode; 4419 copyParams->fFilter = GrTextureParams::kNone_FilterMode;
4418 copyParams->fWidth = texture->width(); 4420 copyParams->fWidth = texture->width();
4419 copyParams->fHeight = texture->height(); 4421 copyParams->fHeight = texture->height();
4420 return true; 4422 return true;
4421 } 4423 }
4422 } 4424 }
4423 return false; 4425 return false;
4424 } 4426 }
OLDNEW
« 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