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

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

Issue 821243003: removing coord change matrices (Closed) Base URL: https://skia.googlesource.com/skia.git@no-coordchange-on-drawstate
Patch Set: rebase Created 5 years, 11 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/GrGLProgram.cpp ('k') | src/gpu/gl/builders/GrGLLegacyNvprProgramBuilder.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 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 /** 62 /**
63 * We specialize the vertex code for each of these matrix types. 63 * We specialize the vertex code for each of these matrix types.
64 */ 64 */
65 enum MatrixType { 65 enum MatrixType {
66 kNoPersp_MatrixType = 0, 66 kNoPersp_MatrixType = 0,
67 kGeneral_MatrixType = 1, 67 kGeneral_MatrixType = 1,
68 }; 68 };
69 69
70 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) {
71 uint32_t totalKey = 0; 71 uint32_t totalKey = 0;
72 int numTransforms = stage.getProcessor()->numTransforms(); 72 int numTransforms = stage.processor()->numTransforms();
73 for (int t = 0; t < numTransforms; ++t) { 73 for (int t = 0; t < numTransforms; ++t) {
74 uint32_t key = 0; 74 uint32_t key = 0;
75 if (stage.isPerspectiveCoordTransform(t)) { 75 if (stage.isPerspectiveCoordTransform(t)) {
76 key |= kGeneral_MatrixType; 76 key |= kGeneral_MatrixType;
77 } else { 77 } else {
78 key |= kNoPersp_MatrixType; 78 key |= kNoPersp_MatrixType;
79 } 79 }
80 80
81 const GrCoordTransform& coordTransform = stage.getProcessor()->coordTran sform(t); 81 const GrCoordTransform& coordTransform = stage.processor()->coordTransfo rm(t);
82 if (kLocal_GrCoordSet == coordTransform.sourceCoords() && !useExplicitLo calCoords) { 82 if (kLocal_GrCoordSet == coordTransform.sourceCoords() && !useExplicitLo calCoords) {
83 key |= kPositionCoords_Flag; 83 key |= kPositionCoords_Flag;
84 } else if (kDevice_GrCoordSet == coordTransform.sourceCoords()) { 84 } else if (kDevice_GrCoordSet == coordTransform.sourceCoords()) {
85 key |= kDeviceCoords_Flag; 85 key |= kDeviceCoords_Flag;
86 } 86 }
87 87
88 GR_STATIC_ASSERT(kGrSLPrecisionCount <= (1 << kPrecisionBits)); 88 GR_STATIC_ASSERT(kGrSLPrecisionCount <= (1 << kPrecisionBits));
89 key |= (coordTransform.precision() << kPrecisionShift); 89 key |= (coordTransform.precision() << kPrecisionShift);
90 90
91 key <<= kTransformKeyBits * t; 91 key <<= kTransformKeyBits * t;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 const GrPrimitiveProcessor& primProc = *optState.getPrimitiveProcessor(); 164 const GrPrimitiveProcessor& primProc = *optState.getPrimitiveProcessor();
165 primProc.getGLProcessorKey(optState.getBatchTracker(), gpu->glCaps(), &b); 165 primProc.getGLProcessorKey(optState.getBatchTracker(), gpu->glCaps(), &b);
166 if (!get_meta_key(primProc, gpu->glCaps(), 0, &b)) { 166 if (!get_meta_key(primProc, gpu->glCaps(), 0, &b)) {
167 desc->fKey.reset(); 167 desc->fKey.reset();
168 return false; 168 return false;
169 } 169 }
170 170
171 for (int s = 0; s < optState.numFragmentStages(); ++s) { 171 for (int s = 0; s < optState.numFragmentStages(); ++s) {
172 const GrPendingFragmentStage& fps = optState.getFragmentStage(s); 172 const GrPendingFragmentStage& fps = optState.getFragmentStage(s);
173 const GrFragmentProcessor& fp = *fps.getProcessor(); 173 const GrFragmentProcessor& fp = *fps.processor();
174 fp.getGLProcessorKey(gpu->glCaps(), &b); 174 fp.getGLProcessorKey(gpu->glCaps(), &b);
175 if (!get_meta_key(fp, gpu->glCaps(), 175 if (!get_meta_key(fp, gpu->glCaps(),
176 gen_transform_key(fps, requiresLocalCoordAttrib), &b)) { 176 gen_transform_key(fps, requiresLocalCoordAttrib), &b)) {
177 desc->fKey.reset(); 177 desc->fKey.reset();
178 return false; 178 return false;
179 } 179 }
180 } 180 }
181 181
182 const GrXferProcessor& xp = *optState.getXferProcessor(); 182 const GrXferProcessor& xp = *optState.getXferProcessor();
183 xp.getGLProcessorKey(gpu->glCaps(), &b); 183 xp.getGLProcessorKey(gpu->glCaps(), &b);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 gpu->glCaps()) ; 222 gpu->glCaps()) ;
223 } else { 223 } else {
224 header->fFragPosKey = 0; 224 header->fFragPosKey = 0;
225 } 225 }
226 226
227 header->fColorEffectCnt = optState.numColorStages(); 227 header->fColorEffectCnt = optState.numColorStages();
228 header->fCoverageEffectCnt = optState.numCoverageStages(); 228 header->fCoverageEffectCnt = optState.numCoverageStages();
229 desc->finalize(); 229 desc->finalize();
230 return true; 230 return true;
231 } 231 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgram.cpp ('k') | src/gpu/gl/builders/GrGLLegacyNvprProgramBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698