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

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

Issue 1127273007: Iterate over instanced draws in GrGpu rather than above GrBatchTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove dead code Created 5 years, 7 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 8
9 #include "GrGLGpu.h" 9 #include "GrGLGpu.h"
10 #include "GrGLStencilAttachment.h" 10 #include "GrGLStencilAttachment.h"
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 this->flushHWAAState(glRT, pipeline.isHWAntialiasState()); 1445 this->flushHWAAState(glRT, pipeline.isHWAntialiasState());
1446 1446
1447 // This must come after textures are flushed because a texture may need 1447 // This must come after textures are flushed because a texture may need
1448 // to be msaa-resolved (which will modify bound FBO state). 1448 // to be msaa-resolved (which will modify bound FBO state).
1449 this->flushRenderTarget(glRT, NULL); 1449 this->flushRenderTarget(glRT, NULL);
1450 1450
1451 return true; 1451 return true;
1452 } 1452 }
1453 1453
1454 void GrGLGpu::setupGeometry(const GrPrimitiveProcessor& primProc, 1454 void GrGLGpu::setupGeometry(const GrPrimitiveProcessor& primProc,
1455 const GrVertices& info, 1455 const GrNonInstancedVertices& vertices,
1456 size_t* indexOffsetInBytes) { 1456 size_t* indexOffsetInBytes) {
1457 GrGLVertexBuffer* vbuf; 1457 GrGLVertexBuffer* vbuf;
1458 vbuf = (GrGLVertexBuffer*) info.vertexBuffer(); 1458 vbuf = (GrGLVertexBuffer*) vertices.vertexBuffer();
1459 1459
1460 SkASSERT(vbuf); 1460 SkASSERT(vbuf);
1461 SkASSERT(!vbuf->isMapped()); 1461 SkASSERT(!vbuf->isMapped());
1462 1462
1463 GrGLIndexBuffer* ibuf = NULL; 1463 GrGLIndexBuffer* ibuf = NULL;
1464 if (info.isIndexed()) { 1464 if (vertices.isIndexed()) {
1465 SkASSERT(indexOffsetInBytes); 1465 SkASSERT(indexOffsetInBytes);
1466 1466
1467 *indexOffsetInBytes = 0; 1467 *indexOffsetInBytes = 0;
1468 ibuf = (GrGLIndexBuffer*)info.indexBuffer(); 1468 ibuf = (GrGLIndexBuffer*)vertices.indexBuffer();
1469 1469
1470 SkASSERT(ibuf); 1470 SkASSERT(ibuf);
1471 SkASSERT(!ibuf->isMapped()); 1471 SkASSERT(!ibuf->isMapped());
1472 *indexOffsetInBytes += ibuf->baseOffset(); 1472 *indexOffsetInBytes += ibuf->baseOffset();
1473 } 1473 }
1474 GrGLAttribArrayState* attribState = 1474 GrGLAttribArrayState* attribState =
1475 fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf); 1475 fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf);
1476 1476
1477 int vaCount = primProc.numAttribs(); 1477 int vaCount = primProc.numAttribs();
1478 if (vaCount > 0) { 1478 if (vaCount > 0) {
1479 1479
1480 GrGLsizei stride = static_cast<GrGLsizei>(primProc.getVertexStride()); 1480 GrGLsizei stride = static_cast<GrGLsizei>(primProc.getVertexStride());
1481 1481
1482 size_t vertexOffsetInBytes = stride * info.startVertex(); 1482 size_t vertexOffsetInBytes = stride * vertices.startVertex();
1483 1483
1484 vertexOffsetInBytes += vbuf->baseOffset(); 1484 vertexOffsetInBytes += vbuf->baseOffset();
1485 1485
1486 uint32_t usedAttribArraysMask = 0; 1486 uint32_t usedAttribArraysMask = 0;
1487 size_t offset = 0; 1487 size_t offset = 0;
1488 1488
1489 for (int attribIndex = 0; attribIndex < vaCount; attribIndex++) { 1489 for (int attribIndex = 0; attribIndex < vaCount; attribIndex++) {
1490 const GrGeometryProcessor::Attribute& attrib = primProc.getAttrib(at tribIndex); 1490 const GrGeometryProcessor::Attribute& attrib = primProc.getAttrib(at tribIndex);
1491 usedAttribArraysMask |= (1 << attribIndex); 1491 usedAttribArraysMask |= (1 << attribIndex);
1492 GrVertexAttribType attribType = attrib.fType; 1492 GrVertexAttribType attribType = attrib.fType;
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 GetWindowThreadProcessId(hwnd, &wndProcID); 1888 GetWindowThreadProcessId(hwnd, &wndProcID);
1889 if(wndProcID == procID) { 1889 if(wndProcID == procID) {
1890 SwapBuffers(GetDC(hwnd)); 1890 SwapBuffers(GetDC(hwnd));
1891 } 1891 }
1892 hwnd = GetNextWindow(hwnd, GW_HWNDNEXT); 1892 hwnd = GetNextWindow(hwnd, GW_HWNDNEXT);
1893 } 1893 }
1894 } 1894 }
1895 #endif 1895 #endif
1896 #endif 1896 #endif
1897 1897
1898 void GrGLGpu::onDraw(const DrawArgs& args, const GrVertices& vertices) { 1898 void GrGLGpu::onDraw(const DrawArgs& args, const GrNonInstancedVertices& vertice s) {
1899 if (!this->flushGLState(args)) { 1899 if (!this->flushGLState(args)) {
1900 return; 1900 return;
1901 } 1901 }
1902 1902
1903 size_t indexOffsetInBytes = 0; 1903 size_t indexOffsetInBytes = 0;
1904 this->setupGeometry(*args.fPrimitiveProcessor, vertices, &indexOffsetInBytes ); 1904 this->setupGeometry(*args.fPrimitiveProcessor, vertices, &indexOffsetInBytes );
1905 1905
1906 SkASSERT((size_t)vertices.primitiveType() < SK_ARRAY_COUNT(gPrimitiveType2GL Mode)); 1906 SkASSERT((size_t)vertices.primitiveType() < SK_ARRAY_COUNT(gPrimitiveType2GL Mode));
1907 1907
1908 if (vertices.isIndexed()) { 1908 if (vertices.isIndexed()) {
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
2851 this->setVertexArrayID(gpu, 0); 2851 this->setVertexArrayID(gpu, 0);
2852 } 2852 }
2853 int attrCount = gpu->glCaps().maxVertexAttributes(); 2853 int attrCount = gpu->glCaps().maxVertexAttributes();
2854 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2854 if (fDefaultVertexArrayAttribState.count() != attrCount) {
2855 fDefaultVertexArrayAttribState.resize(attrCount); 2855 fDefaultVertexArrayAttribState.resize(attrCount);
2856 } 2856 }
2857 attribState = &fDefaultVertexArrayAttribState; 2857 attribState = &fDefaultVertexArrayAttribState;
2858 } 2858 }
2859 return attribState; 2859 return attribState;
2860 } 2860 }
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