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

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

Issue 385713005: Allow GrGLEffects to produce variable length keys. (Closed) Base URL: https://skia.googlesource.com/skia.git@key
Patch Set: rebase Created 6 years, 5 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/GrGLProgramEffects.h ('k') | src/gpu/gl/GrGLShaderBuilder.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 7
8 #include "GrGLProgramEffects.h" 8 #include "GrGLProgramEffects.h"
9 #include "GrDrawEffect.h" 9 #include "GrDrawEffect.h"
10 #include "gl/GrGLEffect.h" 10 #include "gl/GrGLEffect.h"
11 #include "gl/GrGLShaderBuilder.h" 11 #include "gl/GrGLShaderBuilder.h"
12 #include "gl/GrGLVertexEffect.h" 12 #include "gl/GrGLVertexEffect.h"
13 #include "gl/GrGpuGL.h" 13 #include "gl/GrGpuGL.h"
14 14
15 typedef GrGLProgramEffects::EffectKey EffectKey;
16 typedef GrGLProgramEffects::TransformedCoords TransformedCoords; 15 typedef GrGLProgramEffects::TransformedCoords TransformedCoords;
17 typedef GrGLProgramEffects::TransformedCoordsArray TransformedCoordsArray; 16 typedef GrGLProgramEffects::TransformedCoordsArray TransformedCoordsArray;
18 typedef GrGLProgramEffects::TextureSampler TextureSampler; 17 typedef GrGLProgramEffects::TextureSampler TextureSampler;
19 typedef GrGLProgramEffects::TextureSamplerArray TextureSamplerArray; 18 typedef GrGLProgramEffects::TextureSamplerArray TextureSamplerArray;
20 19
21 /** 20 /**
22 * We specialize the vertex code for each of these matrix types. 21 * We specialize the vertex code for each of these matrix types.
23 */ 22 */
24 enum MatrixType { 23 enum MatrixType {
25 kNoPersp_MatrixType = 0, 24 kNoPersp_MatrixType = 0,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // alpha-only textures smear alpha across all four channels when rea d. 61 // alpha-only textures smear alpha across all four channels when rea d.
63 return true; 62 return true;
64 } 63 }
65 } 64 }
66 return false; 65 return false;
67 } 66 }
68 67
69 /** 68 /**
70 * Retrieves the matrix type from transformKey for the transform at transformIdx . 69 * Retrieves the matrix type from transformKey for the transform at transformIdx .
71 */ 70 */
72 MatrixType get_matrix_type(EffectKey transformKey, int transformIdx) { 71 MatrixType get_matrix_type(uint32_t transformKey, int transformIdx) {
73 return static_cast<MatrixType>( 72 return static_cast<MatrixType>(
74 (transformKey >> (kTransformKeyBits * transformIdx)) & kMatrixTyp eKeyMask); 73 (transformKey >> (kTransformKeyBits * transformIdx)) & kMatrixTyp eKeyMask);
75 } 74 }
76 75
77 /** 76 /**
78 * Retrieves the source coords from transformKey for the transform at transformI dx. It may not be 77 * Retrieves the source coords from transformKey for the transform at transformI dx. It may not be
79 * the same coordinate set as the original GrCoordTransform if the position and local coords are 78 * the same coordinate set as the original GrCoordTransform if the position and local coords are
80 * identical for this program. 79 * identical for this program.
81 */ 80 */
82 GrCoordSet get_source_coords(EffectKey transformKey, int transformIdx) { 81 GrCoordSet get_source_coords(uint32_t transformKey, int transformIdx) {
83 return (transformKey >> (kTransformKeyBits * transformIdx)) & kPositionCoord s_Flag ? 82 return (transformKey >> (kTransformKeyBits * transformIdx)) & kPositionCoord s_Flag ?
84 kPosition_GrCoordSet : 83 kPosition_GrCoordSet :
85 kLocal_GrCoordSet; 84 kLocal_GrCoordSet;
86 } 85 }
87 86
88 /** 87 /**
89 * Retrieves the final matrix that a transform needs to apply to its source coor ds. 88 * Retrieves the final matrix that a transform needs to apply to its source coor ds.
90 */ 89 */
91 SkMatrix get_transform_matrix(const GrDrawEffect& drawEffect, int transformIdx) { 90 SkMatrix get_transform_matrix(const GrDrawEffect& drawEffect, int transformIdx) {
92 const GrCoordTransform& coordTransform = drawEffect.effect()->coordTransform (transformIdx); 91 const GrCoordTransform& coordTransform = drawEffect.effect()->coordTransform (transformIdx);
(...skipping 17 matching lines...) Expand all
110 return combined; 109 return combined;
111 } 110 }
112 111
113 } 112 }
114 113
115 //////////////////////////////////////////////////////////////////////////////// 114 ////////////////////////////////////////////////////////////////////////////////
116 115
117 bool GrGLProgramEffects::GenEffectMetaKey(const GrDrawEffect& drawEffect, const GrGLCaps& caps, 116 bool GrGLProgramEffects::GenEffectMetaKey(const GrDrawEffect& drawEffect, const GrGLCaps& caps,
118 GrEffectKeyBuilder* b) { 117 GrEffectKeyBuilder* b) {
119 118
120 EffectKey textureKey = GrGLProgramEffects::GenTextureKey(drawEffect, caps); 119 uint32_t textureKey = GrGLProgramEffects::GenTextureKey(drawEffect, caps);
121 EffectKey transformKey = GrGLProgramEffects::GenTransformKey(drawEffect); 120 uint32_t transformKey = GrGLProgramEffects::GenTransformKey(drawEffect);
122 EffectKey attribKey = GrGLProgramEffects::GenAttribKey(drawEffect); 121 uint32_t attribKey = GrGLProgramEffects::GenAttribKey(drawEffect);
123 uint32_t classID = drawEffect.effect()->getFactory().effectClassID(); 122 uint32_t classID = drawEffect.effect()->getFactory().effectClassID();
124 123
125 // Currently we allow 16 bits for each of the above portions of the meta-key . Fail if they 124 // Currently we allow 16 bits for each of the above portions of the meta-key . Fail if they
126 // don't fit. 125 // don't fit.
127 static const uint32_t kMetaKeyInvalidMask = ~((uint32_t) SK_MaxU16); 126 static const uint32_t kMetaKeyInvalidMask = ~((uint32_t) SK_MaxU16);
128 if ((textureKey | transformKey | attribKey | classID) & kMetaKeyInvalidMask) { 127 if ((textureKey | transformKey | attribKey | classID) & kMetaKeyInvalidMask) {
129 return false; 128 return false;
130 } 129 }
131 130
132 uint32_t* key = b->add32n(2); 131 uint32_t* key = b->add32n(2);
133 key[0] = (textureKey << 16 | transformKey); 132 key[0] = (textureKey << 16 | transformKey);
134 key[1] = (classID << 16 | attribKey); 133 key[1] = (classID << 16 | attribKey);
135 return true; 134 return true;
136 } 135 }
137 136
138 EffectKey GrGLProgramEffects::GenAttribKey(const GrDrawEffect& drawEffect) { 137 uint32_t GrGLProgramEffects::GenAttribKey(const GrDrawEffect& drawEffect) {
139 EffectKey key = 0; 138 uint32_t key = 0;
140 int numAttributes = drawEffect.getVertexAttribIndexCount(); 139 int numAttributes = drawEffect.getVertexAttribIndexCount();
141 SkASSERT(numAttributes <= 2); 140 SkASSERT(numAttributes <= 2);
142 const int* attributeIndices = drawEffect.getVertexAttribIndices(); 141 const int* attributeIndices = drawEffect.getVertexAttribIndices();
143 for (int a = 0; a < numAttributes; ++a) { 142 for (int a = 0; a < numAttributes; ++a) {
144 EffectKey value = attributeIndices[a] << 3 * a; 143 uint32_t value = attributeIndices[a] << 3 * a;
145 SkASSERT(0 == (value & key)); // keys for each attribute ought not to ov erlap 144 SkASSERT(0 == (value & key)); // keys for each attribute ought not to ov erlap
146 key |= value; 145 key |= value;
147 } 146 }
148 return key; 147 return key;
149 } 148 }
150 149
151 EffectKey GrGLProgramEffects::GenTransformKey(const GrDrawEffect& drawEffect) { 150 uint32_t GrGLProgramEffects::GenTransformKey(const GrDrawEffect& drawEffect) {
152 EffectKey totalKey = 0; 151 uint32_t totalKey = 0;
153 int numTransforms = drawEffect.effect()->numTransforms(); 152 int numTransforms = drawEffect.effect()->numTransforms();
154 for (int t = 0; t < numTransforms; ++t) { 153 for (int t = 0; t < numTransforms; ++t) {
155 EffectKey key = 0; 154 uint32_t key = 0;
156 const GrCoordTransform& coordTransform = drawEffect.effect()->coordTrans form(t); 155 const GrCoordTransform& coordTransform = drawEffect.effect()->coordTrans form(t);
157 SkMatrix::TypeMask type0 = coordTransform.getMatrix().getType(); 156 SkMatrix::TypeMask type0 = coordTransform.getMatrix().getType();
158 SkMatrix::TypeMask type1; 157 SkMatrix::TypeMask type1;
159 if (kLocal_GrCoordSet == coordTransform.sourceCoords()) { 158 if (kLocal_GrCoordSet == coordTransform.sourceCoords()) {
160 type1 = drawEffect.getCoordChangeMatrix().getType(); 159 type1 = drawEffect.getCoordChangeMatrix().getType();
161 } else { 160 } else {
162 if (drawEffect.programHasExplicitLocalCoords()) { 161 if (drawEffect.programHasExplicitLocalCoords()) {
163 // We only make the key indicate that device coords are referenc ed when the local coords 162 // We only make the key indicate that device coords are referenc ed when the local coords
164 // are not actually determined by positions. Otherwise the local coords var and position 163 // are not actually determined by positions. Otherwise the local coords var and position
165 // var are identical. 164 // var are identical.
166 key |= kPositionCoords_Flag; 165 key |= kPositionCoords_Flag;
167 } 166 }
168 type1 = SkMatrix::kIdentity_Mask; 167 type1 = SkMatrix::kIdentity_Mask;
169 } 168 }
170 169
171 int combinedTypes = type0 | type1; 170 int combinedTypes = type0 | type1;
172 171
173 if (SkMatrix::kPerspective_Mask & combinedTypes) { 172 if (SkMatrix::kPerspective_Mask & combinedTypes) {
174 key |= kGeneral_MatrixType; 173 key |= kGeneral_MatrixType;
175 } else { 174 } else {
176 key |= kNoPersp_MatrixType; 175 key |= kNoPersp_MatrixType;
177 } 176 }
178 key <<= kTransformKeyBits * t; 177 key <<= kTransformKeyBits * t;
179 SkASSERT(0 == (totalKey & key)); // keys for each transform ought not to overlap 178 SkASSERT(0 == (totalKey & key)); // keys for each transform ought not to overlap
180 totalKey |= key; 179 totalKey |= key;
181 } 180 }
182 return totalKey; 181 return totalKey;
183 } 182 }
184 183
185 EffectKey GrGLProgramEffects::GenTextureKey(const GrDrawEffect& drawEffect, cons t GrGLCaps& caps) { 184 uint32_t GrGLProgramEffects::GenTextureKey(const GrDrawEffect& drawEffect, const GrGLCaps& caps) {
186 EffectKey key = 0; 185 uint32_t key = 0;
187 int numTextures = drawEffect.effect()->numTextures(); 186 int numTextures = drawEffect.effect()->numTextures();
188 for (int t = 0; t < numTextures; ++t) { 187 for (int t = 0; t < numTextures; ++t) {
189 const GrTextureAccess& access = drawEffect.effect()->textureAccess(t); 188 const GrTextureAccess& access = drawEffect.effect()->textureAccess(t);
190 uint32_t configComponentMask = GrPixelConfigComponentMask(access.getText ure()->config()); 189 uint32_t configComponentMask = GrPixelConfigComponentMask(access.getText ure()->config());
191 if (swizzle_requires_alpha_remapping(caps, configComponentMask, access.s wizzleMask())) { 190 if (swizzle_requires_alpha_remapping(caps, configComponentMask, access.s wizzleMask())) {
192 key |= 1 << t; 191 key |= 1 << t;
193 } 192 }
194 } 193 }
195 return key; 194 return key;
196 } 195 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 gpu->bindTexture(samplers[s].fTextureUnit, 242 gpu->bindTexture(samplers[s].fTextureUnit,
244 textureAccess.getParams(), 243 textureAccess.getParams(),
245 static_cast<GrGLTexture*>(textureAccess.getTexture())); 244 static_cast<GrGLTexture*>(textureAccess.getTexture()));
246 } 245 }
247 } 246 }
248 247
249 //////////////////////////////////////////////////////////////////////////////// 248 ////////////////////////////////////////////////////////////////////////////////
250 249
251 void GrGLVertexProgramEffects::emitEffect(GrGLFullShaderBuilder* builder, 250 void GrGLVertexProgramEffects::emitEffect(GrGLFullShaderBuilder* builder,
252 const GrEffectStage& stage, 251 const GrEffectStage& stage,
253 EffectKey key, 252 const GrEffectKey& key,
254 const char* outColor, 253 const char* outColor,
255 const char* inColor, 254 const char* inColor,
256 int stageIndex) { 255 int stageIndex) {
257 GrDrawEffect drawEffect(stage, fHasExplicitLocalCoords); 256 GrDrawEffect drawEffect(stage, fHasExplicitLocalCoords);
258 const GrEffect* effect = stage.getEffect(); 257 const GrEffect* effect = stage.getEffect();
259 SkSTArray<2, TransformedCoords> coords(effect->numTransforms()); 258 SkSTArray<2, TransformedCoords> coords(effect->numTransforms());
260 SkSTArray<4, TextureSampler> samplers(effect->numTextures()); 259 SkSTArray<4, TextureSampler> samplers(effect->numTextures());
261 260
262 this->emitAttributes(builder, stage); 261 this->emitAttributes(builder, stage);
263 this->emitTransforms(builder, drawEffect, &coords); 262 this->emitTransforms(builder, drawEffect, &coords);
(...skipping 30 matching lines...) Expand all
294 builder->addEffectAttribute(attributeIndices[a], 293 builder->addEffectAttribute(attributeIndices[a],
295 stage.getEffect()->vertexAttribType(a), 294 stage.getEffect()->vertexAttribType(a),
296 attributeName); 295 attributeName);
297 } 296 }
298 } 297 }
299 298
300 void GrGLVertexProgramEffects::emitTransforms(GrGLFullShaderBuilder* builder, 299 void GrGLVertexProgramEffects::emitTransforms(GrGLFullShaderBuilder* builder,
301 const GrDrawEffect& drawEffect, 300 const GrDrawEffect& drawEffect,
302 TransformedCoordsArray* outCoords) { 301 TransformedCoordsArray* outCoords) {
303 SkTArray<Transform, true>& transforms = fTransforms.push_back(); 302 SkTArray<Transform, true>& transforms = fTransforms.push_back();
304 EffectKey totalKey = GenTransformKey(drawEffect); 303 uint32_t totalKey = GenTransformKey(drawEffect);
305 int numTransforms = drawEffect.effect()->numTransforms(); 304 int numTransforms = drawEffect.effect()->numTransforms();
306 transforms.push_back_n(numTransforms); 305 transforms.push_back_n(numTransforms);
307 for (int t = 0; t < numTransforms; t++) { 306 for (int t = 0; t < numTransforms; t++) {
308 GrSLType varyingType = kVoid_GrSLType; 307 GrSLType varyingType = kVoid_GrSLType;
309 const char* uniName; 308 const char* uniName;
310 switch (get_matrix_type(totalKey, t)) { 309 switch (get_matrix_type(totalKey, t)) {
311 case kNoPersp_MatrixType: 310 case kNoPersp_MatrixType:
312 uniName = "StageMatrix"; 311 uniName = "StageMatrix";
313 varyingType = kVec2f_GrSLType; 312 varyingType = kVec2f_GrSLType;
314 break; 313 break;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 } 388 }
390 389
391 GrGLVertexProgramEffectsBuilder::GrGLVertexProgramEffectsBuilder(GrGLFullShaderB uilder* builder, 390 GrGLVertexProgramEffectsBuilder::GrGLVertexProgramEffectsBuilder(GrGLFullShaderB uilder* builder,
392 int reserveCoun t) 391 int reserveCoun t)
393 : fBuilder(builder) 392 : fBuilder(builder)
394 , fProgramEffects(SkNEW_ARGS(GrGLVertexProgramEffects, 393 , fProgramEffects(SkNEW_ARGS(GrGLVertexProgramEffects,
395 (reserveCount, fBuilder->hasExplicitLocalCoords ()))) { 394 (reserveCount, fBuilder->hasExplicitLocalCoords ()))) {
396 } 395 }
397 396
398 void GrGLVertexProgramEffectsBuilder::emitEffect(const GrEffectStage& stage, 397 void GrGLVertexProgramEffectsBuilder::emitEffect(const GrEffectStage& stage,
399 GrGLProgramEffects::EffectKey k ey, 398 const GrEffectKey& key,
400 const char* outColor, 399 const char* outColor,
401 const char* inColor, 400 const char* inColor,
402 int stageIndex) { 401 int stageIndex) {
403 SkASSERT(NULL != fProgramEffects.get()); 402 SkASSERT(NULL != fProgramEffects.get());
404 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn dex); 403 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn dex);
405 } 404 }
406 405
407 //////////////////////////////////////////////////////////////////////////////// 406 ////////////////////////////////////////////////////////////////////////////////
408 407
409 void GrGLPathTexGenProgramEffects::emitEffect(GrGLFragmentOnlyShaderBuilder* bui lder, 408 void GrGLPathTexGenProgramEffects::emitEffect(GrGLFragmentOnlyShaderBuilder* bui lder,
410 const GrEffectStage& stage, 409 const GrEffectStage& stage,
411 EffectKey key, 410 const GrEffectKey& key,
412 const char* outColor, 411 const char* outColor,
413 const char* inColor, 412 const char* inColor,
414 int stageIndex) { 413 int stageIndex) {
415 GrDrawEffect drawEffect(stage, false); 414 GrDrawEffect drawEffect(stage, false);
416 const GrEffect* effect = stage.getEffect(); 415 const GrEffect* effect = stage.getEffect();
417 SkSTArray<2, TransformedCoords> coords(effect->numTransforms()); 416 SkSTArray<2, TransformedCoords> coords(effect->numTransforms());
418 SkSTArray<4, TextureSampler> samplers(effect->numTextures()); 417 SkSTArray<4, TextureSampler> samplers(effect->numTextures());
419 418
420 SkASSERT(0 == stage.getVertexAttribIndexCount()); 419 SkASSERT(0 == stage.getVertexAttribIndexCount());
421 this->setupPathTexGen(builder, drawEffect, &coords); 420 this->setupPathTexGen(builder, drawEffect, &coords);
(...skipping 10 matching lines...) Expand all
432 SkASSERT(!glEffect->isVertexEffect()); 431 SkASSERT(!glEffect->isVertexEffect());
433 glEffect->emitCode(builder, drawEffect, key, outColor, inColor, coords, samp lers); 432 glEffect->emitCode(builder, drawEffect, key, outColor, inColor, coords, samp lers);
434 433
435 builder->fsCodeAppend("\t}\n"); 434 builder->fsCodeAppend("\t}\n");
436 } 435 }
437 436
438 void GrGLPathTexGenProgramEffects::setupPathTexGen(GrGLFragmentOnlyShaderBuilder * builder, 437 void GrGLPathTexGenProgramEffects::setupPathTexGen(GrGLFragmentOnlyShaderBuilder * builder,
439 const GrDrawEffect& drawEffect, 438 const GrDrawEffect& drawEffect,
440 TransformedCoordsArray* outCoords) { 439 TransformedCoordsArray* outCoords) {
441 int numTransforms = drawEffect.effect()->numTransforms(); 440 int numTransforms = drawEffect.effect()->numTransforms();
442 EffectKey totalKey = GenTransformKey(drawEffect); 441 uint32_t totalKey = GenTransformKey(drawEffect);
443 int texCoordIndex = builder->addTexCoordSets(numTransforms); 442 int texCoordIndex = builder->addTexCoordSets(numTransforms);
444 SkNEW_APPEND_TO_TARRAY(&fTransforms, Transforms, (totalKey, texCoordIndex)); 443 SkNEW_APPEND_TO_TARRAY(&fTransforms, Transforms, (totalKey, texCoordIndex));
445 SkString name; 444 SkString name;
446 for (int t = 0; t < numTransforms; ++t) { 445 for (int t = 0; t < numTransforms; ++t) {
447 GrSLType type = kGeneral_MatrixType == get_matrix_type(totalKey, t) ? 446 GrSLType type = kGeneral_MatrixType == get_matrix_type(totalKey, t) ?
448 kVec3f_GrSLType : 447 kVec3f_GrSLType :
449 kVec2f_GrSLType; 448 kVec2f_GrSLType;
450 name.printf("%s(gl_TexCoord[%i])", GrGLSLTypeString(type), texCoordIndex ++); 449 name.printf("%s(gl_TexCoord[%i])", GrGLSLTypeString(type), texCoordIndex ++);
451 SkNEW_APPEND_TO_TARRAY(outCoords, TransformedCoords, (name, type)); 450 SkNEW_APPEND_TO_TARRAY(outCoords, TransformedCoords, (name, type));
452 } 451 }
453 } 452 }
454 453
455 void GrGLPathTexGenProgramEffects::setData(GrGpuGL* gpu, 454 void GrGLPathTexGenProgramEffects::setData(GrGpuGL* gpu,
456 const GrGLUniformManager& uniformManager, 455 const GrGLUniformManager& uniformManager,
457 const GrEffectStage* effectStages[]) { 456 const GrEffectStage* effectStages[]) {
458 int numEffects = fGLEffects.count(); 457 int numEffects = fGLEffects.count();
459 SkASSERT(numEffects == fTransforms.count()); 458 SkASSERT(numEffects == fTransforms.count());
460 SkASSERT(numEffects == fSamplers.count()); 459 SkASSERT(numEffects == fSamplers.count());
461 for (int e = 0; e < numEffects; ++e) { 460 for (int e = 0; e < numEffects; ++e) {
462 GrDrawEffect drawEffect(*effectStages[e], false); 461 GrDrawEffect drawEffect(*effectStages[e], false);
463 fGLEffects[e]->setData(uniformManager, drawEffect); 462 fGLEffects[e]->setData(uniformManager, drawEffect);
464 this->setPathTexGenState(gpu, drawEffect, e); 463 this->setPathTexGenState(gpu, drawEffect, e);
465 this->bindTextures(gpu, drawEffect.effect(), e); 464 this->bindTextures(gpu, drawEffect.effect(), e);
466 } 465 }
467 } 466 }
468 467
469 void GrGLPathTexGenProgramEffects::setPathTexGenState(GrGpuGL* gpu, 468 void GrGLPathTexGenProgramEffects::setPathTexGenState(GrGpuGL* gpu,
470 const GrDrawEffect& drawEffect, 469 const GrDrawEffect& drawEffect,
471 int effectIdx) { 470 int effectIdx) {
472 EffectKey totalKey = fTransforms[effectIdx].fTransformKey; 471 uint32_t totalKey = fTransforms[effectIdx].fTransformKey;
473 int texCoordIndex = fTransforms[effectIdx].fTexCoordIndex; 472 int texCoordIndex = fTransforms[effectIdx].fTexCoordIndex;
474 int numTransforms = drawEffect.effect()->numTransforms(); 473 int numTransforms = drawEffect.effect()->numTransforms();
475 for (int t = 0; t < numTransforms; ++t) { 474 for (int t = 0; t < numTransforms; ++t) {
476 switch (get_matrix_type(totalKey, t)) { 475 switch (get_matrix_type(totalKey, t)) {
477 case kNoPersp_MatrixType: { 476 case kNoPersp_MatrixType: {
478 const SkMatrix& transform = get_transform_matrix(drawEffect, t); 477 const SkMatrix& transform = get_transform_matrix(drawEffect, t);
479 gpu->enablePathTexGen(texCoordIndex++, 478 gpu->enablePathTexGen(texCoordIndex++,
480 GrGpuGL::kST_PathTexGenComponents, 479 GrGpuGL::kST_PathTexGenComponents,
481 transform); 480 transform);
482 break; 481 break;
(...skipping 12 matching lines...) Expand all
495 } 494 }
496 495
497 GrGLPathTexGenProgramEffectsBuilder::GrGLPathTexGenProgramEffectsBuilder( 496 GrGLPathTexGenProgramEffectsBuilder::GrGLPathTexGenProgramEffectsBuilder(
498 GrGLFragmentOnlyShaderBuilder* builder, 497 GrGLFragmentOnlyShaderBuilder* builder,
499 int reserveCount) 498 int reserveCount)
500 : fBuilder(builder) 499 : fBuilder(builder)
501 , fProgramEffects(SkNEW_ARGS(GrGLPathTexGenProgramEffects, (reserveCount))) { 500 , fProgramEffects(SkNEW_ARGS(GrGLPathTexGenProgramEffects, (reserveCount))) {
502 } 501 }
503 502
504 void GrGLPathTexGenProgramEffectsBuilder::emitEffect(const GrEffectStage& stage, 503 void GrGLPathTexGenProgramEffectsBuilder::emitEffect(const GrEffectStage& stage,
505 GrGLProgramEffects::EffectK ey key, 504 const GrEffectKey& key,
506 const char* outColor, 505 const char* outColor,
507 const char* inColor, 506 const char* inColor,
508 int stageIndex) { 507 int stageIndex) {
509 SkASSERT(NULL != fProgramEffects.get()); 508 SkASSERT(NULL != fProgramEffects.get());
510 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn dex); 509 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn dex);
511 } 510 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgramEffects.h ('k') | src/gpu/gl/GrGLShaderBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698