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

Side by Side Diff: src/gpu/GrGpu.cpp

Issue 1806983002: Update how we send draws to gpu backend to reduce state setting. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright 2010 Google Inc. 2 * Copyright 2010 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 "GrGpu.h" 9 #include "GrGpu.h"
10 10
11 #include "GrCaps.h" 11 #include "GrCaps.h"
12 #include "GrContext.h" 12 #include "GrContext.h"
13 #include "GrGpuResourcePriv.h" 13 #include "GrGpuResourcePriv.h"
14 #include "GrIndexBuffer.h" 14 #include "GrIndexBuffer.h"
15 #include "GrPathRendering.h" 15 #include "GrPathRendering.h"
16 #include "GrPipeline.h" 16 #include "GrPipeline.h"
17 #include "GrResourceCache.h" 17 #include "GrResourceCache.h"
18 #include "GrResourceProvider.h" 18 #include "GrResourceProvider.h"
19 #include "GrRenderTargetPriv.h" 19 #include "GrRenderTargetPriv.h"
20 #include "GrStencilAttachment.h" 20 #include "GrStencilAttachment.h"
21 #include "GrSurfacePriv.h" 21 #include "GrSurfacePriv.h"
22 #include "GrTransferBuffer.h" 22 #include "GrTransferBuffer.h"
23 #include "GrVertexBuffer.h" 23 #include "GrVertexBuffer.h"
24 #include "GrVertices.h" 24 #include "GrVertices.h"
25 #include "SkTypes.h" 25 #include "SkTypes.h"
26 26
27 GrVertices& GrVertices::operator =(const GrVertices& di) { 27 GrVertices& GrVertices::operator =(const GrVertices& di) {
28 fPrimitiveType = di.fPrimitiveType;
29 fStartVertex = di.fStartVertex; 28 fStartVertex = di.fStartVertex;
30 fStartIndex = di.fStartIndex; 29 fStartIndex = di.fStartIndex;
31 fVertexCount = di.fVertexCount; 30 fVertexCount = di.fVertexCount;
32 fIndexCount = di.fIndexCount; 31 fIndexCount = di.fIndexCount;
33 32
34 fInstanceCount = di.fInstanceCount; 33 fInstanceCount = di.fInstanceCount;
35 fVerticesPerInstance = di.fVerticesPerInstance; 34 fVerticesPerInstance = di.fVerticesPerInstance;
36 fIndicesPerInstance = di.fIndicesPerInstance; 35 fIndicesPerInstance = di.fIndicesPerInstance;
37 fMaxInstancesPerDraw = di.fMaxInstancesPerDraw; 36 fMaxInstancesPerDraw = di.fMaxInstancesPerDraw;
38 37
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 fMultisampleSpecsMap[effectiveKey] = &specs; 484 fMultisampleSpecsMap[effectiveKey] = &specs;
486 if (effectiveSampleCnt != desc.fSampleCnt) { 485 if (effectiveSampleCnt != desc.fSampleCnt) {
487 SkASSERT(surfDescKey < effectiveKey); 486 SkASSERT(surfDescKey < effectiveKey);
488 fMultisampleSpecsMap[surfDescKey] = &specs; 487 fMultisampleSpecsMap[surfDescKey] = &specs;
489 } 488 }
490 return specs; 489 return specs;
491 } 490 }
492 491
493 //////////////////////////////////////////////////////////////////////////////// 492 ////////////////////////////////////////////////////////////////////////////////
494 493
495 void GrGpu::draw(const DrawArgs& args, const GrVertices& vertices) { 494 void GrGpu::draw(const GrPipeline& pipeline,
495 const GrPrimitiveProcessor& primProc,
496 GrPrimitiveType primitiveType,
497 const GrVertices* vertArray,
498 int drawCount) {
496 this->handleDirtyContext(); 499 this->handleDirtyContext();
497 if (GrXferBarrierType barrierType = args.fPipeline->xferBarrierType(*this->c aps())) {
498 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType);
499 }
500 500
501 GrVertices::Iterator iter; 501 this->onDraw(pipeline, primProc, primitiveType, vertArray, drawCount);
502 const GrNonInstancedVertices* verts = iter.init(vertices);
503 do {
504 this->onDraw(args, *verts);
505 fStats.incNumDraws();
506 } while ((verts = iter.next()));
507 } 502 }
508 503
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698