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

Side by Side Diff: src/gpu/gl/GrGLGpu.cpp

Issue 1426993007: Revert of Enable stencil clipping in mixed sampled render targets (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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') | src/gpu/gl/GrGLInterface.cpp » ('j') | 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 8
9 #include "GrGLGpu.h" 9 #include "GrGLGpu.h"
10 #include "GrGLGLSL.h" 10 #include "GrGLGLSL.h"
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 1469
1470 int numTextureAccesses = textureAccesses.count(); 1470 int numTextureAccesses = textureAccesses.count();
1471 for (int i = 0; i < numTextureAccesses; i++) { 1471 for (int i = 0; i < numTextureAccesses; i++) {
1472 this->bindTexture(i, textureAccesses[i]->getParams(), 1472 this->bindTexture(i, textureAccesses[i]->getParams(),
1473 static_cast<GrGLTexture*>(textureAccesses[i]->getTextu re())); 1473 static_cast<GrGLTexture*>(textureAccesses[i]->getTextu re()));
1474 } 1474 }
1475 1475
1476 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(pipeline.getRenderTa rget()); 1476 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(pipeline.getRenderTa rget());
1477 this->flushStencil(pipeline.getStencil()); 1477 this->flushStencil(pipeline.getStencil());
1478 this->flushScissor(pipeline.getScissorState(), glRT->getViewport(), glRT->or igin()); 1478 this->flushScissor(pipeline.getScissorState(), glRT->getViewport(), glRT->or igin());
1479 this->flushHWAAState(glRT, pipeline.isHWAntialiasState(), !pipeline.getStenc il().isDisabled()); 1479 this->flushHWAAState(glRT, pipeline.isHWAntialiasState());
1480 1480
1481 // This must come after textures are flushed because a texture may need 1481 // This must come after textures are flushed because a texture may need
1482 // to be msaa-resolved (which will modify bound FBO state). 1482 // to be msaa-resolved (which will modify bound FBO state).
1483 this->flushRenderTarget(glRT, nullptr); 1483 this->flushRenderTarget(glRT, nullptr);
1484 1484
1485 return true; 1485 return true;
1486 } 1486 }
1487 1487
1488 void GrGLGpu::setupGeometry(const GrPrimitiveProcessor& primProc, 1488 void GrGLGpu::setupGeometry(const GrPrimitiveProcessor& primProc,
1489 const GrNonInstancedVertices& vertices, 1489 const GrNonInstancedVertices& vertices,
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1892 if (!flipY) { 1892 if (!flipY) {
1893 dst += rowBytes; 1893 dst += rowBytes;
1894 } else { 1894 } else {
1895 dst -= rowBytes; 1895 dst -= rowBytes;
1896 } 1896 }
1897 } 1897 }
1898 } 1898 }
1899 return true; 1899 return true;
1900 } 1900 }
1901 1901
1902 void GrGLGpu::setColocatedSampleLocations(GrRenderTarget* rt, bool useColocatedS ampleLocations) {
1903 GrGLRenderTarget* target = static_cast<GrGLRenderTarget*>(rt->asRenderTarget ());
1904 SkASSERT(0 != target->renderFBOID());
1905
1906 if (!rt->isStencilBufferMultisampled() ||
1907 useColocatedSampleLocations == target->usesColocatedSampleLocations()) {
1908 return;
1909 }
1910
1911 GL_CALL(NamedFramebufferParameteri(target->renderFBOID(),
1912 GR_GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOC ATIONS,
1913 useColocatedSampleLocations));
1914
1915 target->flagAsUsingColocatedSampleLocations(useColocatedSampleLocations);
1916 }
1917
1918 void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bound) { 1902 void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bound) {
1919 1903
1920 SkASSERT(target); 1904 SkASSERT(target);
1921 1905
1922 uint32_t rtID = target->getUniqueID(); 1906 uint32_t rtID = target->getUniqueID();
1923 if (fHWBoundRenderTargetUniqueID != rtID) { 1907 if (fHWBoundRenderTargetUniqueID != rtID) {
1924 fStats.incRenderTargetBinds(); 1908 fStats.incRenderTargetBinds();
1925 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, target->renderFBOID())); 1909 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, target->renderFBOID()));
1926 #ifdef SK_DEBUG 1910 #ifdef SK_DEBUG
1927 // don't do this check in Chromium -- this is causing 1911 // don't do this check in Chromium -- this is causing
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 set_gl_stencil(this->glInterface(), 2139 set_gl_stencil(this->glInterface(),
2156 stencilSettings, 2140 stencilSettings,
2157 GR_GL_FRONT_AND_BACK, 2141 GR_GL_FRONT_AND_BACK,
2158 GrStencilSettings::kFront_Face); 2142 GrStencilSettings::kFront_Face);
2159 } 2143 }
2160 } 2144 }
2161 fHWStencilSettings = stencilSettings; 2145 fHWStencilSettings = stencilSettings;
2162 } 2146 }
2163 } 2147 }
2164 2148
2165 void GrGLGpu::flushHWAAState(GrRenderTarget* rt, bool useHWAA, bool stencilEnabl ed) { 2149 void GrGLGpu::flushHWAAState(GrRenderTarget* rt, bool useHWAA) {
2166 SkASSERT(!useHWAA || rt->isStencilBufferMultisampled()); 2150 SkASSERT(!useHWAA || rt->isStencilBufferMultisampled());
2167 2151
2168 if (rt->hasMixedSamples() && stencilEnabled &&
2169 this->glCaps().glslCaps()->programmableSampleLocationsSupport()) {
2170 if (useHWAA) {
2171 this->setColocatedSampleLocations(rt, false);
2172 } else {
2173 this->setColocatedSampleLocations(rt, true);
2174 }
2175 useHWAA = true;
2176 }
2177
2178 if (this->glCaps().multisampleDisableSupport()) { 2152 if (this->glCaps().multisampleDisableSupport()) {
2179 if (useHWAA) { 2153 if (useHWAA) {
2180 if (kYes_TriState != fMSAAEnabled) { 2154 if (kYes_TriState != fMSAAEnabled) {
2181 GL_CALL(Enable(GR_GL_MULTISAMPLE)); 2155 GL_CALL(Enable(GR_GL_MULTISAMPLE));
2182 fMSAAEnabled = kYes_TriState; 2156 fMSAAEnabled = kYes_TriState;
2183 } 2157 }
2184 } else { 2158 } else {
2185 if (kNo_TriState != fMSAAEnabled) { 2159 if (kNo_TriState != fMSAAEnabled) {
2186 GL_CALL(Disable(GR_GL_MULTISAMPLE)); 2160 GL_CALL(Disable(GR_GL_MULTISAMPLE));
2187 fMSAAEnabled = kNo_TriState; 2161 fMSAAEnabled = kNo_TriState;
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
2947 2921
2948 GL_CALL(Uniform4f(fCopyProgram.fPosXformUniform, dx1 - dx0, dy1 - dy0, dx0, dy0)); 2922 GL_CALL(Uniform4f(fCopyProgram.fPosXformUniform, dx1 - dx0, dy1 - dy0, dx0, dy0));
2949 GL_CALL(Uniform4f(fCopyProgram.fTexCoordXformUniform, sx1 - sx0, sy1 - sy0, sx0, sy0)); 2923 GL_CALL(Uniform4f(fCopyProgram.fTexCoordXformUniform, sx1 - sx0, sy1 - sy0, sx0, sy0));
2950 GL_CALL(Uniform1i(fCopyProgram.fTextureUniform, 0)); 2924 GL_CALL(Uniform1i(fCopyProgram.fTextureUniform, 0));
2951 2925
2952 GrXferProcessor::BlendInfo blendInfo; 2926 GrXferProcessor::BlendInfo blendInfo;
2953 blendInfo.reset(); 2927 blendInfo.reset();
2954 this->flushBlend(blendInfo); 2928 this->flushBlend(blendInfo);
2955 this->flushColorWrite(true); 2929 this->flushColorWrite(true);
2956 this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace); 2930 this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
2957 this->flushHWAAState(dstRT, false, false); 2931 this->flushHWAAState(dstRT, false);
2958 this->disableScissor(); 2932 this->disableScissor();
2959 GrStencilSettings stencil; 2933 GrStencilSettings stencil;
2960 stencil.setDisabled(); 2934 stencil.setDisabled();
2961 this->flushStencil(stencil); 2935 this->flushStencil(stencil);
2962 2936
2963 GL_CALL(DrawArrays(GR_GL_TRIANGLE_STRIP, 0, 4)); 2937 GL_CALL(DrawArrays(GR_GL_TRIANGLE_STRIP, 0, 4));
2964 } 2938 }
2965 2939
2966 void GrGLGpu::copySurfaceAsCopyTexSubImage(GrSurface* dst, 2940 void GrGLGpu::copySurfaceAsCopyTexSubImage(GrSurface* dst,
2967 GrSurface* src, 2941 GrSurface* src,
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
3182 this->setVertexArrayID(gpu, 0); 3156 this->setVertexArrayID(gpu, 0);
3183 } 3157 }
3184 int attrCount = gpu->glCaps().maxVertexAttributes(); 3158 int attrCount = gpu->glCaps().maxVertexAttributes();
3185 if (fDefaultVertexArrayAttribState.count() != attrCount) { 3159 if (fDefaultVertexArrayAttribState.count() != attrCount) {
3186 fDefaultVertexArrayAttribState.resize(attrCount); 3160 fDefaultVertexArrayAttribState.resize(attrCount);
3187 } 3161 }
3188 attribState = &fDefaultVertexArrayAttribState; 3162 attribState = &fDefaultVertexArrayAttribState;
3189 } 3163 }
3190 return attribState; 3164 return attribState;
3191 } 3165 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698