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

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

Issue 1297503007: Generating gl processor key is now recursive (Closed) Base URL: https://skia.googlesource.com/skia@cs3_numExclChildren
Patch Set: rebased Created 5 years, 4 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/GrPrimitiveProcessor.h ('k') | src/gpu/gl/GrGLProgramDesc.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 2014 Google Inc. 2 * Copyright 2014 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 #include "GrPrimitiveProcessor.h" 8 #include "GrPrimitiveProcessor.h"
9 9
10 #include "GrCoordTransform.h" 10 #include "GrCoordTransform.h"
(...skipping 19 matching lines...) Expand all
30 30
31 /** 31 /**
32 * We specialize the vertex code for each of these matrix types. 32 * We specialize the vertex code for each of these matrix types.
33 */ 33 */
34 enum MatrixType { 34 enum MatrixType {
35 kNoPersp_MatrixType = 0, 35 kNoPersp_MatrixType = 0,
36 kGeneral_MatrixType = 1, 36 kGeneral_MatrixType = 1,
37 }; 37 };
38 38
39 uint32_t 39 uint32_t
40 GrPrimitiveProcessor::getTransformKey(const SkTArray<const GrCoordTransform*, tr ue>& coords) const { 40 GrPrimitiveProcessor::getTransformKey(const SkTArray<const GrCoordTransform*, tr ue>& coords,
41 int numCoords) const {
41 uint32_t totalKey = 0; 42 uint32_t totalKey = 0;
42 for (int t = 0; t < coords.count(); ++t) { 43 for (int t = 0; t < numCoords; ++t) {
43 uint32_t key = 0; 44 uint32_t key = 0;
44 const GrCoordTransform* coordTransform = coords[t]; 45 const GrCoordTransform* coordTransform = coords[t];
45 if (coordTransform->getMatrix().hasPerspective()) { 46 if (coordTransform->getMatrix().hasPerspective()) {
46 key |= kGeneral_MatrixType; 47 key |= kGeneral_MatrixType;
47 } else { 48 } else {
48 key |= kNoPersp_MatrixType; 49 key |= kNoPersp_MatrixType;
49 } 50 }
50 51
51 if (kLocal_GrCoordSet == coordTransform->sourceCoords() && 52 if (kLocal_GrCoordSet == coordTransform->sourceCoords() &&
52 !this->hasExplicitLocalCoords()) { 53 !this->hasExplicitLocalCoords()) {
53 key |= kPositionCoords_Flag; 54 key |= kPositionCoords_Flag;
54 } else if (kDevice_GrCoordSet == coordTransform->sourceCoords()) { 55 } else if (kDevice_GrCoordSet == coordTransform->sourceCoords()) {
55 key |= kDeviceCoords_Flag; 56 key |= kDeviceCoords_Flag;
56 } 57 }
57 58
58 GR_STATIC_ASSERT(kGrSLPrecisionCount <= (1 << kPrecisionBits)); 59 GR_STATIC_ASSERT(kGrSLPrecisionCount <= (1 << kPrecisionBits));
59 key |= (coordTransform->precision() << kPrecisionShift); 60 key |= (coordTransform->precision() << kPrecisionShift);
60 61
61 key <<= kTransformKeyBits * t; 62 key <<= kTransformKeyBits * t;
62 63
63 SkASSERT(0 == (totalKey & key)); // keys for each transform ought not to overlap 64 SkASSERT(0 == (totalKey & key)); // keys for each transform ought not to overlap
64 totalKey |= key; 65 totalKey |= key;
65 } 66 }
66 return totalKey; 67 return totalKey;
67 } 68 }
OLDNEW
« no previous file with comments | « src/gpu/GrPrimitiveProcessor.h ('k') | src/gpu/gl/GrGLProgramDesc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698