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

Side by Side Diff: src/gpu/effects/GrTextureDomain.h

Issue 1428543003: Create GLSL base class for ProgramDataManager (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add space Created 5 years, 1 month 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/effects/GrRRectEffect.cpp ('k') | src/gpu/effects/GrTextureDomain.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 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 GrTextureDomainEffect_DEFINED 8 #ifndef GrTextureDomainEffect_DEFINED
9 #define GrTextureDomainEffect_DEFINED 9 #define GrTextureDomainEffect_DEFINED
10 10
11 #include "GrSingleTextureEffect.h" 11 #include "GrSingleTextureEffect.h"
12 #include "gl/GrGLFragmentProcessor.h" 12 #include "gl/GrGLFragmentProcessor.h"
13 #include "glsl/GrGLSLProgramDataManager.h"
13 14
14 class GrGLProgramBuilder; 15 class GrGLProgramBuilder;
15 class GrGLShaderBuilder; 16 class GrGLShaderBuilder;
16 class GrInvariantOutput; 17 class GrInvariantOutput;
17 struct SkRect; 18 struct SkRect;
18 19
19 /** 20 /**
20 * Limits a texture's lookup coordinates to a domain. Samples outside the domain are either clamped 21 * Limits a texture's lookup coordinates to a domain. Samples outside the domain are either clamped
21 * the edge of the domain or result in a vec4 of zeros (decal mode). The domain is clipped to 22 * the edge of the domain or result in a vec4 of zeros (decal mode). The domain is clipped to
22 * normalized texture coords ([0,1]x[0,1] square). Bilinear filtering can cause texels outside the 23 * normalized texture coords ([0,1]x[0,1] square). Bilinear filtering can cause texels outside the
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 const GrTextureDomain& textureDomain, 116 const GrTextureDomain& textureDomain,
116 const char* outColor, 117 const char* outColor,
117 const SkString& inCoords, 118 const SkString& inCoords,
118 const GrGLProcessor::TextureSampler sampler, 119 const GrGLProcessor::TextureSampler sampler,
119 const char* inModulateColor = nullptr); 120 const char* inModulateColor = nullptr);
120 121
121 /** 122 /**
122 * Call this from GrGLProcessor::setData() to upload uniforms necessary for the texture 123 * Call this from GrGLProcessor::setData() to upload uniforms necessary for the texture
123 * domain. The rectangle is automatically adjusted to account for the te xture's origin. 124 * domain. The rectangle is automatically adjusted to account for the te xture's origin.
124 */ 125 */
125 void setData(const GrGLProgramDataManager& pdman, const GrTextureDomain& textureDomain, 126 void setData(const GrGLSLProgramDataManager& pdman, const GrTextureDomai n& textureDomain,
126 GrSurfaceOrigin textureOrigin); 127 GrSurfaceOrigin textureOrigin);
127 128
128 enum { 129 enum {
129 kDomainKeyBits = 2, // See DomainKey(). 130 kDomainKeyBits = 2, // See DomainKey().
130 }; 131 };
131 132
132 /** 133 /**
133 * GrGLProcessor::GenKey() must call this and include the returned value in it's computed 134 * GrGLProcessor::GenKey() must call this and include the returned value in it's computed
134 * key. The returned will be limited to the lower kDomainKeyBits bits. 135 * key. The returned will be limited to the lower kDomainKeyBits bits.
135 */ 136 */
136 static uint32_t DomainKey(const GrTextureDomain& domain) { 137 static uint32_t DomainKey(const GrTextureDomain& domain) {
137 GR_STATIC_ASSERT(kModeCount <= 4); 138 GR_STATIC_ASSERT(kModeCount <= 4);
138 return domain.mode(); 139 return domain.mode();
139 } 140 }
140 141
141 private: 142 private:
142 static const int kPrevDomainCount = 4; 143 static const int kPrevDomainCount = 4;
143 SkDEBUGCODE(Mode fMode;) 144 SkDEBUGCODE(Mode fMode;)
144 GrGLProgramDataManager::UniformHandle fDomainUni; 145 GrGLSLProgramDataManager::UniformHandle fDomainUni;
145 SkString fDomainName; 146 SkString fDomainName;
146 GrGLfloat fPrevDomain[kPrevDomainCount]; 147 float fPrevDomain[kPrevDomainCount];
147 }; 148 };
148 149
149 protected: 150 protected:
150 Mode fMode; 151 Mode fMode;
151 SkRect fDomain; 152 SkRect fDomain;
152 int fIndex; 153 int fIndex;
153 154
154 typedef GrSingleTextureEffect INHERITED; 155 typedef GrSingleTextureEffect INHERITED;
155 }; 156 };
156 157
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 bool onIsEqual(const GrFragmentProcessor&) const override; 192 bool onIsEqual(const GrFragmentProcessor&) const override;
192 193
193 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; 194 void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
194 195
195 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 196 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
196 197
197 typedef GrSingleTextureEffect INHERITED; 198 typedef GrSingleTextureEffect INHERITED;
198 }; 199 };
199 200
200 #endif 201 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrRRectEffect.cpp ('k') | src/gpu/effects/GrTextureDomain.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698