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

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

Issue 805293003: Stop calling flushGLState in onStencilPath (Closed) Base URL: https://skia.googlesource.com/skia.git@flush
Patch Set: Created 6 years 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 | « no previous file | 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 8
9 #include "GrGpuGL.h" 9 #include "GrGpuGL.h"
10 #include "GrGLStencilBuffer.h" 10 #include "GrGLStencilBuffer.h"
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 } 1338 }
1339 return; 1339 return;
1340 } 1340 }
1341 } 1341 }
1342 1342
1343 // See fall through note above 1343 // See fall through note above
1344 this->disableScissor(); 1344 this->disableScissor();
1345 } 1345 }
1346 1346
1347 bool GrGLGpu::flushGLState(const GrOptDrawState& optState) { 1347 bool GrGLGpu::flushGLState(const GrOptDrawState& optState) {
1348 // GrGpu::setupClipAndFlushState should have already checked this and bailed if not true. 1348 SkASSERT(kStencilPath_DrawType != optState.drawType());
1349 SkASSERT(optState.getRenderTarget()); 1349 this->flushMiscFixedFunctionState(optState);
1350 1350
1351 if (kStencilPath_DrawType == optState.drawType()) { 1351 fCurrentProgram.reset(fProgramCache->getProgram(optState));
1352 const GrRenderTarget* rt = optState.getRenderTarget(); 1352 if (NULL == fCurrentProgram.get()) {
1353 SkISize size; 1353 SkDEBUGFAIL("Failed to create program!");
1354 size.set(rt->width(), rt->height()); 1354 return false;
1355 this->glPathRendering()->setProjectionMatrix(optState.getViewMatrix(), s ize, rt->origin()); 1355 }
1356 } else {
1357 this->flushMiscFixedFunctionState(optState);
1358 1356
1359 fCurrentProgram.reset(fProgramCache->getProgram(optState)); 1357 fCurrentProgram.get()->ref();
1360 if (NULL == fCurrentProgram.get()) {
1361 SkDEBUGFAIL("Failed to create program!");
1362 return false;
1363 }
1364 1358
1365 fCurrentProgram.get()->ref(); 1359 GrGLuint programID = fCurrentProgram->programID();
1360 if (fHWProgramID != programID) {
1361 GL_CALL(UseProgram(programID));
1362 fHWProgramID = programID;
1363 }
1366 1364
1367 GrGLuint programID = fCurrentProgram->programID(); 1365 this->flushBlend(optState);
1368 if (fHWProgramID != programID) {
1369 GL_CALL(UseProgram(programID));
1370 fHWProgramID = programID;
1371 }
1372 1366
1373 this->flushBlend(optState); 1367 fCurrentProgram->setData(optState);
1374
1375 fCurrentProgram->setData(optState);
1376 }
1377 1368
1378 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(optState.getRenderTa rget()); 1369 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(optState.getRenderTa rget());
1379 this->flushStencil(optState.getStencil(), optState.drawType()); 1370 this->flushStencil(optState.getStencil(), optState.drawType());
1380 this->flushScissor(optState.getScissorState(), glRT->getViewport(), glRT->or igin()); 1371 this->flushScissor(optState.getScissorState(), glRT->getViewport(), glRT->or igin());
1381 this->flushAAState(optState); 1372 this->flushAAState(optState);
1382 1373
1383 // This must come after textures are flushed because a texture may need 1374 // This must come after textures are flushed because a texture may need
1384 // to be msaa-resolved (which will modify bound FBO state). 1375 // to be msaa-resolved (which will modify bound FBO state).
1385 this->flushRenderTarget(glRT, NULL); 1376 this->flushRenderTarget(glRT, NULL);
1386 1377
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1867 SwapBuf(); 1858 SwapBuf();
1868 int set_a_break_pt_here = 9; 1859 int set_a_break_pt_here = 9;
1869 SwapBuf(); 1860 SwapBuf();
1870 #endif 1861 #endif
1871 #endif 1862 #endif
1872 } 1863 }
1873 1864
1874 void GrGLGpu::onStencilPath(const GrOptDrawState& ds, 1865 void GrGLGpu::onStencilPath(const GrOptDrawState& ds,
1875 const GrPath* path, 1866 const GrPath* path,
1876 const GrStencilSettings& stencil) { 1867 const GrStencilSettings& stencil) {
1877 if (!this->flushGLState(ds)) { 1868 this->flushMiscFixedFunctionState(ds);
1878 return; 1869 GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(ds.getRenderTarget());
1879 } 1870 SkISize size = SkISize::Make(rt->width(), rt->height());
1871 this->glPathRendering()->setProjectionMatrix(ds.getViewMatrix(), size, rt->o rigin());
1872 this->flushStencil(ds.getStencil(), ds.drawType());
1873 this->flushScissor(ds.getScissorState(), rt->getViewport(), rt->origin());
1874 this->flushAAState(ds);
1875 this->flushRenderTarget(rt, NULL);
1876
1880 fPathRendering->stencilPath(path, stencil); 1877 fPathRendering->stencilPath(path, stencil);
1881 } 1878 }
1882 1879
1883 void GrGLGpu::onDrawPath(const GrOptDrawState& ds, const GrPath* path, 1880 void GrGLGpu::onDrawPath(const GrOptDrawState& ds, const GrPath* path,
1884 const GrStencilSettings& stencil) { 1881 const GrStencilSettings& stencil) {
1885 if (!this->flushGLState(ds)) { 1882 if (!this->flushGLState(ds)) {
1886 return; 1883 return;
1887 } 1884 }
1888 fPathRendering->drawPath(path, stencil); 1885 fPathRendering->drawPath(path, stencil);
1889 } 1886 }
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
2731 this->setVertexArrayID(gpu, 0); 2728 this->setVertexArrayID(gpu, 0);
2732 } 2729 }
2733 int attrCount = gpu->glCaps().maxVertexAttributes(); 2730 int attrCount = gpu->glCaps().maxVertexAttributes();
2734 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2731 if (fDefaultVertexArrayAttribState.count() != attrCount) {
2735 fDefaultVertexArrayAttribState.resize(attrCount); 2732 fDefaultVertexArrayAttribState.resize(attrCount);
2736 } 2733 }
2737 attribState = &fDefaultVertexArrayAttribState; 2734 attribState = &fDefaultVertexArrayAttribState;
2738 } 2735 }
2739 return attribState; 2736 return attribState;
2740 } 2737 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698