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

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

Issue 25605008: Repurpose GrGLCoordTransform as GrGLEffectArray (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/gl/GrGLEffect.h ('k') | src/gpu/gl/GrGLProgram.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "GrGLSL.h"
9 #include "GrGLEffect.h"
10 #include "GrCoordTransform.h"
11 #include "GrDrawEffect.h"
12
13 GrGLEffect::GrGLEffect(const GrBackendEffectFactory& factory)
14 : fFactory(factory) {
15 }
16
17 GrGLEffect::~GrGLEffect() {
18 }
19
20 ///////////////////////////////////////////////////////////////////////////////
21
22 void GrGLEffect::setData(const GrGLUniformManager&, const GrDrawEffect&) {
23 }
24
25 GrGLEffect::EffectKey GrGLEffect::GenTextureKey(const GrDrawEffect& drawEffect,
26 const GrGLCaps& caps) {
27 EffectKey key = 0;
28 int numTextures = (*drawEffect.effect())->numTextures();
29 for (int index = 0; index < numTextures; ++index) {
30 const GrTextureAccess& access = (*drawEffect.effect())->textureAccess(in dex);
31 EffectKey value = GrGLShaderBuilder::KeyForTextureAccess(access, caps) < < index;
32 SkASSERT(0 == (value & key)); // keys for each access ought not to overl ap
33 key |= value;
34 }
35 return key;
36 }
37
38 GrGLEffect::EffectKey GrGLEffect::GenTransformKey(const GrDrawEffect& drawEffect ) {
39 EffectKey key = 0;
40 int numTransforms = (*drawEffect.effect())->numTransforms();
41 for (int index = 0; index < numTransforms; ++index) {
42 EffectKey value = GrGLCoordTransform::GenKey(drawEffect, index);
43 value <<= index * GrGLCoordTransform::kKeyBits;
44 SkASSERT(0 == (value & key)); // keys for each transform ought not to ov erlap
45 key |= value;
46 }
47 return key;
48 }
49
50 GrGLEffect::EffectKey GrGLEffect::GenAttribKey(const GrDrawEffect& drawEffect) {
51 EffectKey key = 0;
52
53 int numAttributes = drawEffect.getVertexAttribIndexCount();
54 SkASSERT(numAttributes <= 2);
55 const int* attributeIndices = drawEffect.getVertexAttribIndices();
56 for (int index = 0; index < numAttributes; ++index) {
57 EffectKey value = attributeIndices[index] << 3*index;
58 SkASSERT(0 == (value & key)); // keys for each attribute ought not to ov erlap
59 key |= value;
60 }
61
62 return key;
63 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLEffect.h ('k') | src/gpu/gl/GrGLProgram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698