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

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

Issue 812063002: Change to create device coord coordset (Closed) Base URL: https://skia.googlesource.com/skia.git@vm-off-context
Patch Set: ignoring bleed 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/GrGLProgram.cpp ('k') | src/gpu/gl/builders/GrGLProgramBuilder.h » ('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 2013 Google Inc. 2 * Copyright 2013 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 #include "GrGLProgramDesc.h" 7 #include "GrGLProgramDesc.h"
8 8
9 #include "GrGLProcessor.h" 9 #include "GrGLProcessor.h"
10 #include "GrProcessor.h" 10 #include "GrProcessor.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 * that indicates the source of the input coords. 45 * that indicates the source of the input coords.
46 */ 46 */
47 enum { 47 enum {
48 kMatrixTypeKeyBits = 1, 48 kMatrixTypeKeyBits = 1,
49 kMatrixTypeKeyMask = (1 << kMatrixTypeKeyBits) - 1, 49 kMatrixTypeKeyMask = (1 << kMatrixTypeKeyBits) - 1,
50 50
51 kPrecisionBits = 2, 51 kPrecisionBits = 2,
52 kPrecisionShift = kMatrixTypeKeyBits, 52 kPrecisionShift = kMatrixTypeKeyBits,
53 53
54 kPositionCoords_Flag = (1 << (kPrecisionShift + kPrecisionBits)), 54 kPositionCoords_Flag = (1 << (kPrecisionShift + kPrecisionBits)),
55 kDeviceCoords_Flag = kPositionCoords_Flag + kPositionCoords_Flag,
55 56
56 kTransformKeyBits = kMatrixTypeKeyBits + kPrecisionBits + 1, 57 kTransformKeyBits = kMatrixTypeKeyBits + kPrecisionBits + 2,
57 }; 58 };
58 59
59 GR_STATIC_ASSERT(kHigh_GrSLPrecision < (1 << kPrecisionBits)); 60 GR_STATIC_ASSERT(kHigh_GrSLPrecision < (1 << kPrecisionBits));
60 61
61 /** 62 /**
62 * We specialize the vertex code for each of these matrix types. 63 * We specialize the vertex code for each of these matrix types.
63 */ 64 */
64 enum MatrixType { 65 enum MatrixType {
65 kNoPersp_MatrixType = 0, 66 kNoPersp_MatrixType = 0,
66 kGeneral_MatrixType = 1, 67 kGeneral_MatrixType = 1,
67 }; 68 };
68 69
69 static uint32_t gen_transform_key(const GrPendingFragmentStage& stage, bool useE xplicitLocalCoords) { 70 static uint32_t gen_transform_key(const GrPendingFragmentStage& stage, bool useE xplicitLocalCoords) {
70 uint32_t totalKey = 0; 71 uint32_t totalKey = 0;
71 int numTransforms = stage.getProcessor()->numTransforms(); 72 int numTransforms = stage.getProcessor()->numTransforms();
72 for (int t = 0; t < numTransforms; ++t) { 73 for (int t = 0; t < numTransforms; ++t) {
73 uint32_t key = 0; 74 uint32_t key = 0;
74 if (stage.isPerspectiveCoordTransform(t)) { 75 if (stage.isPerspectiveCoordTransform(t)) {
75 key |= kGeneral_MatrixType; 76 key |= kGeneral_MatrixType;
76 } else { 77 } else {
77 key |= kNoPersp_MatrixType; 78 key |= kNoPersp_MatrixType;
78 } 79 }
79 80
80 const GrCoordTransform& coordTransform = stage.getProcessor()->coordTran sform(t); 81 const GrCoordTransform& coordTransform = stage.getProcessor()->coordTran sform(t);
81 if (kLocal_GrCoordSet != coordTransform.sourceCoords() && useExplicitLoc alCoords) { 82 if (kLocal_GrCoordSet == coordTransform.sourceCoords() && !useExplicitLo calCoords) {
82 key |= kPositionCoords_Flag; 83 key |= kPositionCoords_Flag;
84 } else if (kDevice_GrCoordSet == coordTransform.sourceCoords()) {
85 key |= kDeviceCoords_Flag;
83 } 86 }
84 87
85 GR_STATIC_ASSERT(kGrSLPrecisionCount <= (1 << kPrecisionBits)); 88 GR_STATIC_ASSERT(kGrSLPrecisionCount <= (1 << kPrecisionBits));
86 key |= (coordTransform.precision() << kPrecisionShift); 89 key |= (coordTransform.precision() << kPrecisionShift);
87 90
88 key <<= kTransformKeyBits * t; 91 key <<= kTransformKeyBits * t;
89 92
90 SkASSERT(0 == (totalKey & key)); // keys for each transform ought not to overlap 93 SkASSERT(0 == (totalKey & key)); // keys for each transform ought not to overlap
91 totalKey |= key; 94 totalKey |= key;
92 } 95 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 gpu->glCaps()) ; 222 gpu->glCaps()) ;
220 } else { 223 } else {
221 header->fFragPosKey = 0; 224 header->fFragPosKey = 0;
222 } 225 }
223 226
224 header->fColorEffectCnt = optState.numColorStages(); 227 header->fColorEffectCnt = optState.numColorStages();
225 header->fCoverageEffectCnt = optState.numCoverageStages(); 228 header->fCoverageEffectCnt = optState.numCoverageStages();
226 desc->finalize(); 229 desc->finalize();
227 return true; 230 return true;
228 } 231 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgram.cpp ('k') | src/gpu/gl/builders/GrGLProgramBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698