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

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

Issue 809843002: Remove GrGpu::flushGraphicsState (Closed) Base URL: https://skia.googlesource.com/skia.git@master
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 | « src/gpu/gl/GrGpuGL.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 8
9 #include "GrGpuGL.h" 9 #include "GrGpuGL.h"
10 #include "GrGLStencilBuffer.h" 10 #include "GrGLStencilBuffer.h"
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 fHWScissorSettings.fEnabled = kYes_TriState; 1337 fHWScissorSettings.fEnabled = kYes_TriState;
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::flushGraphicsState(const GrOptDrawState& optState) { 1347 bool GrGLGpu::flushGLState(const GrOptDrawState& optState) {
1348 // GrGpu::setupClipAndFlushState should have already checked this and bailed if not true. 1348 // GrGpu::setupClipAndFlushState should have already checked this and bailed if not true.
1349 SkASSERT(optState.getRenderTarget()); 1349 SkASSERT(optState.getRenderTarget());
1350 1350
1351 if (kStencilPath_DrawType == optState.drawType()) { 1351 if (kStencilPath_DrawType == optState.drawType()) {
1352 const GrRenderTarget* rt = optState.getRenderTarget(); 1352 const GrRenderTarget* rt = optState.getRenderTarget();
1353 SkISize size; 1353 SkISize size;
1354 size.set(rt->width(), rt->height()); 1354 size.set(rt->width(), rt->height());
1355 this->glPathRendering()->setProjectionMatrix(optState.getViewMatrix(), s ize, rt->origin()); 1355 this->glPathRendering()->setProjectionMatrix(optState.getViewMatrix(), s ize, rt->origin());
1356 } else { 1356 } else {
1357 this->flushMiscFixedFunctionState(optState); 1357 this->flushMiscFixedFunctionState(optState);
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 if(wndProcID == procID) { 1827 if(wndProcID == procID) {
1828 SwapBuffers(GetDC(hwnd)); 1828 SwapBuffers(GetDC(hwnd));
1829 } 1829 }
1830 hwnd = GetNextWindow(hwnd, GW_HWNDNEXT); 1830 hwnd = GetNextWindow(hwnd, GW_HWNDNEXT);
1831 } 1831 }
1832 } 1832 }
1833 #endif 1833 #endif
1834 #endif 1834 #endif
1835 1835
1836 void GrGLGpu::onDraw(const GrOptDrawState& ds, const GrDrawTarget::DrawInfo& inf o) { 1836 void GrGLGpu::onDraw(const GrOptDrawState& ds, const GrDrawTarget::DrawInfo& inf o) {
1837 if (!this->flushGLState(ds)) {
1838 return;
1839 }
1840
1837 size_t indexOffsetInBytes; 1841 size_t indexOffsetInBytes;
1838 this->setupGeometry(ds, info, &indexOffsetInBytes); 1842 this->setupGeometry(ds, info, &indexOffsetInBytes);
1839 1843
1840 SkASSERT((size_t)info.primitiveType() < SK_ARRAY_COUNT(gPrimitiveType2GLMode )); 1844 SkASSERT((size_t)info.primitiveType() < SK_ARRAY_COUNT(gPrimitiveType2GLMode ));
1841 1845
1842 if (info.isIndexed()) { 1846 if (info.isIndexed()) {
1843 GrGLvoid* indices = 1847 GrGLvoid* indices =
1844 reinterpret_cast<GrGLvoid*>(indexOffsetInBytes + sizeof(uint16_t) * info.startIndex()); 1848 reinterpret_cast<GrGLvoid*>(indexOffsetInBytes + sizeof(uint16_t) * info.startIndex());
1845 // info.startVertex() was accounted for by setupGeometry. 1849 // info.startVertex() was accounted for by setupGeometry.
1846 GL_CALL(DrawElements(gPrimitiveType2GLMode[info.primitiveType()], 1850 GL_CALL(DrawElements(gPrimitiveType2GLMode[info.primitiveType()],
(...skipping 13 matching lines...) Expand all
1860 int set_a_break_pt_here = 9; 1864 int set_a_break_pt_here = 9;
1861 aglSwapBuffers(aglGetCurrentContext()); 1865 aglSwapBuffers(aglGetCurrentContext());
1862 #elif defined(SK_BUILD_FOR_WIN32) 1866 #elif defined(SK_BUILD_FOR_WIN32)
1863 SwapBuf(); 1867 SwapBuf();
1864 int set_a_break_pt_here = 9; 1868 int set_a_break_pt_here = 9;
1865 SwapBuf(); 1869 SwapBuf();
1866 #endif 1870 #endif
1867 #endif 1871 #endif
1868 } 1872 }
1869 1873
1874 void GrGLGpu::onStencilPath(const GrOptDrawState& ds,
1875 const GrPath* path,
1876 const GrStencilSettings& stencil) {
1877 if (!this->flushGLState(ds)) {
1878 return;
1879 }
1880 fPathRendering->stencilPath(path, stencil);
1881 }
1882
1883 void GrGLGpu::onDrawPath(const GrOptDrawState& ds, const GrPath* path,
1884 const GrStencilSettings& stencil) {
1885 if (!this->flushGLState(ds)) {
1886 return;
1887 }
1888 fPathRendering->drawPath(path, stencil);
1889 }
1890
1891 void GrGLGpu::onDrawPaths(const GrOptDrawState& ds,
1892 const GrPathRange* pathRange,
1893 const void* indices,
1894 GrDrawTarget::PathIndexType indexType,
1895 const float transformValues[],
1896 GrDrawTarget::PathTransformType transformType,
1897 int count,
1898 const GrStencilSettings& stencil) {
1899 if (!this->flushGLState(ds)) {
1900 return;
1901 }
1902 fPathRendering->drawPaths(pathRange, indices, indexType, transformValues,
1903 transformType, count, stencil);
1904 }
1905
1870 void GrGLGpu::onResolveRenderTarget(GrRenderTarget* target) { 1906 void GrGLGpu::onResolveRenderTarget(GrRenderTarget* target) {
1871 GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(target); 1907 GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(target);
1872 if (rt->needsResolve()) { 1908 if (rt->needsResolve()) {
1873 // Some extensions automatically resolves the texture when it is read. 1909 // Some extensions automatically resolves the texture when it is read.
1874 if (this->glCaps().usesMSAARenderBuffers()) { 1910 if (this->glCaps().usesMSAARenderBuffers()) {
1875 SkASSERT(rt->textureFBOID() != rt->renderFBOID()); 1911 SkASSERT(rt->textureFBOID() != rt->renderFBOID());
1876 fGPUStats.incRenderTargetBinds(); 1912 fGPUStats.incRenderTargetBinds();
1877 fGPUStats.incRenderTargetBinds(); 1913 fGPUStats.incRenderTargetBinds();
1878 GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, rt->renderFBOID())); 1914 GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, rt->renderFBOID()));
1879 GL_CALL(BindFramebuffer(GR_GL_DRAW_FRAMEBUFFER, rt->textureFBOID())) ; 1915 GL_CALL(BindFramebuffer(GR_GL_DRAW_FRAMEBUFFER, rt->textureFBOID())) ;
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
2695 this->setVertexArrayID(gpu, 0); 2731 this->setVertexArrayID(gpu, 0);
2696 } 2732 }
2697 int attrCount = gpu->glCaps().maxVertexAttributes(); 2733 int attrCount = gpu->glCaps().maxVertexAttributes();
2698 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2734 if (fDefaultVertexArrayAttribState.count() != attrCount) {
2699 fDefaultVertexArrayAttribState.resize(attrCount); 2735 fDefaultVertexArrayAttribState.resize(attrCount);
2700 } 2736 }
2701 attribState = &fDefaultVertexArrayAttribState; 2737 attribState = &fDefaultVertexArrayAttribState;
2702 } 2738 }
2703 return attribState; 2739 return attribState;
2704 } 2740 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGpuGL.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698