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

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

Issue 394213002: Revert of Makes GrGLProgramDesc's key store the lengths as well as offsets of the effect keys. (Closed) Base URL: https://skia.googlesource.com/skia.git@key
Patch Set: 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') | tests/GLProgramsTest.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 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"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 combined.set(SkMatrix::kMTransY, 107 combined.set(SkMatrix::kMTransY,
108 combined[SkMatrix::kMPersp2] - combined[SkMatrix::kMTransY]); 108 combined[SkMatrix::kMPersp2] - combined[SkMatrix::kMTransY]);
109 } 109 }
110 return combined; 110 return combined;
111 } 111 }
112 112
113 } 113 }
114 114
115 //////////////////////////////////////////////////////////////////////////////// 115 ////////////////////////////////////////////////////////////////////////////////
116 116
117 bool GrGLProgramEffects::GenEffectMetaKey(const GrDrawEffect& drawEffect, const GrGLCaps& caps,
118 GrEffectKeyBuilder* b) {
119
120 EffectKey textureKey = GrGLProgramEffects::GenTextureKey(drawEffect, caps);
121 EffectKey transformKey = GrGLProgramEffects::GenTransformKey(drawEffect);
122 EffectKey attribKey = GrGLProgramEffects::GenAttribKey(drawEffect);
123 uint32_t classID = drawEffect.effect()->getFactory().effectClassID();
124
125 // Currently we allow 16 bits for each of the above portions of the meta-key . Fail if they
126 // don't fit.
127 static const uint32_t kMetaKeyInvalidMask = ~((uint32_t) SK_MaxU16);
128 if ((textureKey | transformKey | attribKey | classID) & kMetaKeyInvalidMask) {
129 return false;
130 }
131
132 uint32_t* key = b->add32n(2);
133 key[0] = (textureKey << 16 | transformKey);
134 key[1] = (classID << 16 | attribKey);
135 return true;
136 }
137
138 EffectKey GrGLProgramEffects::GenAttribKey(const GrDrawEffect& drawEffect) { 117 EffectKey GrGLProgramEffects::GenAttribKey(const GrDrawEffect& drawEffect) {
139 EffectKey key = 0; 118 EffectKey key = 0;
140 int numAttributes = drawEffect.getVertexAttribIndexCount(); 119 int numAttributes = drawEffect.getVertexAttribIndexCount();
141 SkASSERT(numAttributes <= 2); 120 SkASSERT(numAttributes <= 2);
142 const int* attributeIndices = drawEffect.getVertexAttribIndices(); 121 const int* attributeIndices = drawEffect.getVertexAttribIndices();
143 for (int a = 0; a < numAttributes; ++a) { 122 for (int a = 0; a < numAttributes; ++a) {
144 EffectKey value = attributeIndices[a] << 3 * a; 123 EffectKey value = attributeIndices[a] << 3 * a;
145 SkASSERT(0 == (value & key)); // keys for each attribute ought not to ov erlap 124 SkASSERT(0 == (value & key)); // keys for each attribute ought not to ov erlap
146 key |= value; 125 key |= value;
147 } 126 }
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 } 481 }
503 482
504 void GrGLPathTexGenProgramEffectsBuilder::emitEffect(const GrEffectStage& stage, 483 void GrGLPathTexGenProgramEffectsBuilder::emitEffect(const GrEffectStage& stage,
505 GrGLProgramEffects::EffectK ey key, 484 GrGLProgramEffects::EffectK ey key,
506 const char* outColor, 485 const char* outColor,
507 const char* inColor, 486 const char* inColor,
508 int stageIndex) { 487 int stageIndex) {
509 SkASSERT(NULL != fProgramEffects.get()); 488 SkASSERT(NULL != fProgramEffects.get());
510 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn dex); 489 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn dex);
511 } 490 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgramEffects.h ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698