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

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

Issue 551253004: Changes to remove program effects builder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: removing program effects builder Created 6 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 #ifndef GrGLEffect_DEFINED 8 #ifndef GrGLEffect_DEFINED
9 #define GrGLEffect_DEFINED 9 #define GrGLEffect_DEFINED
10 10
(...skipping 16 matching lines...) Expand all
27 The GrGLEffect subclass must also have a constructor of the form: 27 The GrGLEffect subclass must also have a constructor of the form:
28 EffectSubclass::EffectSubclass(const GrBackendEffectFactory&, const GrEf fect&) 28 EffectSubclass::EffectSubclass(const GrBackendEffectFactory&, const GrEf fect&)
29 29
30 These objects are created by the factory object returned by the GrEffect::ge tFactory(). 30 These objects are created by the factory object returned by the GrEffect::ge tFactory().
31 */ 31 */
32 32
33 class GrGLTexture; 33 class GrGLTexture;
34 class GrGLGeometryProcessor; 34 class GrGLGeometryProcessor;
35 35
36 class GrGLEffect { 36 class GrGLEffect {
37 public:
38 typedef GrGLProgramDataManager::UniformHandle UniformHandle;
37 39
38 public: 40 /**
39 typedef GrGLProgramEffects::TransformedCoordsArray TransformedCoordsArray; 41 * Passed to GrGLEffects so they can add transformed coordinates to their sh ader code.
40 typedef GrGLProgramEffects::TextureSampler TextureSampler; 42 */
41 typedef GrGLProgramEffects::TextureSamplerArray TextureSamplerArray; 43 class TransformedCoords {
bsalomon 2014/09/18 18:08:33 Curious whether this should be a GrGLShaderVar
44 public:
45 TransformedCoords(const SkString& name, GrSLType type)
46 : fName(name), fType(type) {
47 }
48
49 const char* c_str() const { return fName.c_str(); }
50 GrSLType type() const { return fType; }
51 const SkString& getName() const { return fName; }
52
53 private:
54 SkString fName;
55 GrSLType fType;
56 };
57
58 typedef SkTArray<TransformedCoords> TransformedCoordsArray;
59
60 /**
61 * Passed to GrGLEffects so they can add texture reads to their shader code.
62 */
63 class TextureSampler {
64 public:
65 TextureSampler(UniformHandle uniform, const GrTextureAccess& access)
66 : fSamplerUniform(uniform)
67 , fConfigComponentMask(GrPixelConfigComponentMask(access.getTexture( )->config())) {
68 SkASSERT(0 != fConfigComponentMask);
69 memcpy(fSwizzle, access.getSwizzle(), 5);
70 }
71
72 UniformHandle samplerUniform() const { return fSamplerUniform; }
bsalomon 2014/09/18 18:08:33 Do they need this?
73 // bitfield of GrColorComponentFlags present in the texture's config.
74 uint32_t configComponentMask() const { return fConfigComponentMask; }
75 const char* swizzle() const { return fSwizzle; }
bsalomon 2014/09/18 18:08:33 Maybe a comment that this is ".abcd"
76
77 private:
78 UniformHandle fSamplerUniform;
79 uint32_t fConfigComponentMask;
80 char fSwizzle[5];
81 };
82
83 typedef SkTArray<TextureSampler> TextureSamplerArray;
42 84
43 GrGLEffect(const GrBackendEffectFactory& factory) 85 GrGLEffect(const GrBackendEffectFactory& factory)
44 : fFactory(factory) 86 : fFactory(factory)
45 , fIsVertexEffect(false) { 87 , fIsVertexEffect(false) {
46 } 88 }
47 89
48 virtual ~GrGLEffect() {} 90 virtual ~GrGLEffect() {}
49 91
50 /** Called when the program stage should insert its code into the shaders. T he code in each 92 /** Called when the program stage should insert its code into the shaders. T he code in each
51 shader will be in its own block ({}) and so locally scoped names will no t collide across 93 shader will be in its own block ({}) and so locally scoped names will no t collide across
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 protected: 135 protected:
94 const GrBackendEffectFactory& fFactory; 136 const GrBackendEffectFactory& fFactory;
95 137
96 private: 138 private:
97 friend class GrGLGeometryProcessor; // to set fIsVertexEffect 139 friend class GrGLGeometryProcessor; // to set fIsVertexEffect
98 140
99 bool fIsVertexEffect; 141 bool fIsVertexEffect;
100 }; 142 };
101 143
102 #endif 144 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698