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

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

Issue 25474006: Move VertexBuilder to a GrGLFullShaderBuilder subclass (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
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 GrGLShaderBuilder_DEFINED 8 #ifndef GrGLShaderBuilder_DEFINED
9 #define GrGLShaderBuilder_DEFINED 9 #define GrGLShaderBuilder_DEFINED
10 10
(...skipping 15 matching lines...) Expand all
26 /** 26 /**
27 Contains all the incremental state of a shader as it is being built,as well as helpers to 27 Contains all the incremental state of a shader as it is being built,as well as helpers to
28 manipulate that state. 28 manipulate that state.
29 */ 29 */
30 class GrGLShaderBuilder { 30 class GrGLShaderBuilder {
31 public: 31 public:
32 typedef GrTAllocator<GrGLShaderVar> VarArray; 32 typedef GrTAllocator<GrGLShaderVar> VarArray;
33 typedef GrBackendEffectFactory::EffectKey EffectKey; 33 typedef GrBackendEffectFactory::EffectKey EffectKey;
34 typedef GrGLEffectArray::TextureSampler TextureSampler; 34 typedef GrGLEffectArray::TextureSampler TextureSampler;
35 typedef GrGLEffectArray::TransformedCoordsArray TransformedCoordsArray; 35 typedef GrGLEffectArray::TransformedCoordsArray TransformedCoordsArray;
36 typedef GrGLUniformManager::BuilderUniform BuilderUniform;
36 37
37 enum ShaderVisibility { 38 enum ShaderVisibility {
38 kVertex_Visibility = 0x1, 39 kVertex_Visibility = 0x1,
39 kGeometry_Visibility = 0x2, 40 kGeometry_Visibility = 0x2,
40 kFragment_Visibility = 0x4, 41 kFragment_Visibility = 0x4,
41 }; 42 };
42 43
43 GrGLShaderBuilder(GrGpuGL*, 44 GrGLShaderBuilder(GrGpuGL*, GrGLUniformManager&, const GrGLProgramDesc&);
44 GrGLUniformManager&, 45 virtual ~GrGLShaderBuilder() {}
45 const GrGLProgramDesc&,
46 bool needsVertexShader);
47 46
48 /** 47 /**
49 * Use of these features may require a GLSL extension to be enabled. Shaders may not compile 48 * Use of these features may require a GLSL extension to be enabled. Shaders may not compile
50 * if code is added that uses one of these features without calling enableFe ature() 49 * if code is added that uses one of these features without calling enableFe ature()
51 */ 50 */
52 enum GLSLFeature { 51 enum GLSLFeature {
53 kStandardDerivatives_GLSLFeature = 0, 52 kStandardDerivatives_GLSLFeature = 0,
54 53
55 kLastGLSLFeature = kStandardDerivatives_GLSLFeature 54 kLastGLSLFeature = kStandardDerivatives_GLSLFeature
56 }; 55 };
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 GrSLType coordType = kVec2f_GrSLType); 96 GrSLType coordType = kVec2f_GrSLType);
98 97
99 /** Emits a helper function outside of main() in the fragment shader. */ 98 /** Emits a helper function outside of main() in the fragment shader. */
100 void fsEmitFunction(GrSLType returnType, 99 void fsEmitFunction(GrSLType returnType,
101 const char* name, 100 const char* name,
102 int argCnt, 101 int argCnt,
103 const GrGLShaderVar* args, 102 const GrGLShaderVar* args,
104 const char* body, 103 const char* body,
105 SkString* outName); 104 SkString* outName);
106 105
107 /** Add input/output variable declarations (i.e. 'varying') to the fragment shader. */
108 GrGLShaderVar& fsInputAppend() { return fFSInputs.push_back(); }
109
110 typedef uint8_t DstReadKey; 106 typedef uint8_t DstReadKey;
111 typedef uint8_t FragPosKey; 107 typedef uint8_t FragPosKey;
112 108
113 /** Returns a key for adding code to read the copy-of-dst color in service of effects that 109 /** Returns a key for adding code to read the copy-of-dst color in service of effects that
114 require reading the dst. It must not return 0 because 0 indicates that there is no dst 110 require reading the dst. It must not return 0 because 0 indicates that there is no dst
115 copy read at all (in which case this function should not be called). */ 111 copy read at all (in which case this function should not be called). */
116 static DstReadKey KeyForDstRead(const GrTexture* dstCopy, const GrGLCaps&); 112 static DstReadKey KeyForDstRead(const GrTexture* dstCopy, const GrGLCaps&);
117 113
118 /** Returns a key for reading the fragment location. This should only be cal led if there is an 114 /** Returns a key for reading the fragment location. This should only be cal led if there is an
119 effect that will requires the fragment position. If the fragment positio n is not required, 115 effect that will requires the fragment position. If the fragment positio n is not required,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 163
168 /** Returns the color of the destination pixel. This may be NULL if no effec t advertised 164 /** Returns the color of the destination pixel. This may be NULL if no effec t advertised
169 that it will read the destination. */ 165 that it will read the destination. */
170 const char* dstColor(); 166 const char* dstColor();
171 167
172 /** 168 /**
173 * Interfaces used by GrGLProgram. 169 * Interfaces used by GrGLProgram.
174 * TODO: These are used by GrGLProgram to insert a mode color filter. Remove these when the 170 * TODO: These are used by GrGLProgram to insert a mode color filter. Remove these when the
175 * color filter is expressed as a GrEffect. 171 * color filter is expressed as a GrEffect.
176 */ 172 */
177 const SkString& getInputColor() const { return fInputColor; } 173 const SkString& getInputColor() const {
178 GrSLConstantVec getKnownColorValue() const { return fKnownColorValue; } 174 SkASSERT(fInputColor.isEmpty() != (kNone_GrSLConstantVec == fKnownColorV alue));
179 const SkString& getInputCoverage() const { return fInputCoverage; } 175 return fInputColor;
180 GrSLConstantVec getKnownCoverageValue() const { return fKnownCoverageValue; } 176 }
177 GrSLConstantVec getKnownColorValue() const {
178 SkASSERT(fInputColor.isEmpty() != (kNone_GrSLConstantVec == fKnownColorV alue));
179 return fKnownColorValue;
180 }
181 const SkString& getInputCoverage() const {
182 SkASSERT(fInputCoverage.isEmpty() != (kNone_GrSLConstantVec == fKnownCov erageValue));
183 return fInputCoverage;
184 }
185 GrSLConstantVec getKnownCoverageValue() const {
186 SkASSERT(fInputCoverage.isEmpty() != (kNone_GrSLConstantVec == fKnownCov erageValue));
187 return fKnownCoverageValue;
188 }
181 189
182 /** 190 /**
183 * Adds code for effects. effectStages contains the effects to add. effectKe ys[i] is the key 191 * Adds code for effects. effectStages contains the effects to add. effectKe ys[i] is the key
184 * generated from effectStages[i]. An entry in effectStages can be NULL, in which case it is 192 * generated from effectStages[i]. An entry in effectStages can be NULL, in which case it is
185 * skipped. Moreover, if the corresponding key is GrGLEffect::NoEffectKey th en it is skipped. 193 * skipped. Moreover, if the corresponding key is GrGLEffect::NoEffectKey th en it is skipped.
186 * inOutFSColor specifies the input color to the first stage and is updated to be the 194 * inOutFSColor specifies the input color to the first stage and is updated to be the
187 * output color of the last stage. fsInOutColorKnownValue specifies whether the input color 195 * output color of the last stage. fsInOutColorKnownValue specifies whether the input color
188 * has a known constant value and is updated to refer to the status of the o utput color. 196 * has a known constant value and is updated to refer to the status of the o utput color.
189 * The handles to texture samplers for effectStage[i] are added to effectSam plerHandles[i]. The 197 * The handles to texture samplers for effectStage[i] are added to effectSam plerHandles[i]. The
190 * glEffects array is updated to contain the GrGLEffect generated for each e ntry in 198 * glEffects array is updated to contain the GrGLEffect generated for each e ntry in
191 * effectStages. 199 * effectStages.
192 */ 200 */
193 GrGLEffectArray* emitEffects(const GrEffectStage* effectStages[], 201 virtual GrGLEffectArray* emitEffects(const GrEffectStage* effectStages[],
194 const EffectKey effectKeys[], 202 const EffectKey effectKeys[],
195 int effectCnt, 203 int effectCnt,
196 SkString* inOutFSColor, 204 SkString* inOutFSColor,
197 GrSLConstantVec* fsInOutColorKnownValue); 205 GrSLConstantVec* fsInOutColorKnownValue ) = 0;
198 206
199 const char* getColorOutputName() const; 207 const char* getColorOutputName() const;
200 const char* enableSecondaryOutput(); 208 const char* enableSecondaryOutput();
201 209
202 GrGLUniformManager::UniformHandle getRTHeightUniform() const { return fRTHei ghtUniform; } 210 GrGLUniformManager::UniformHandle getRTHeightUniform() const { return fRTHei ghtUniform; }
203 GrGLUniformManager::UniformHandle getDstCopyTopLeftUniform() const { 211 GrGLUniformManager::UniformHandle getDstCopyTopLeftUniform() const {
204 return fDstCopyTopLeftUniform; 212 return fDstCopyTopLeftUniform;
205 } 213 }
206 GrGLUniformManager::UniformHandle getDstCopyScaleUniform() const { 214 GrGLUniformManager::UniformHandle getDstCopyScaleUniform() const {
207 return fDstCopyScaleUniform; 215 return fDstCopyScaleUniform;
208 } 216 }
209 GrGLUniformManager::UniformHandle getColorUniform() const { return fColorUni form; } 217 GrGLUniformManager::UniformHandle getColorUniform() const { return fColorUni form; }
210 GrGLUniformManager::UniformHandle getCoverageUniform() const { return fCover ageUniform; } 218 GrGLUniformManager::UniformHandle getCoverageUniform() const { return fCover ageUniform; }
211 GrGLUniformManager::UniformHandle getDstCopySamplerUniform() const { 219 GrGLUniformManager::UniformHandle getDstCopySamplerUniform() const {
212 return fDstCopySamplerUniform; 220 return fDstCopySamplerUniform;
213 } 221 }
214 222
215 /** Helper class used to build the vertex and geometry shaders. This functio nality
216 is kept separate from the rest of GrGLShaderBuilder to allow for shaders programs
217 that only use the fragment shader. */
218 class VertexBuilder {
219 public:
220 VertexBuilder(GrGLShaderBuilder* parent, GrGpuGL* gpu, const GrGLProgram Desc&);
221
222 /**
223 * Called by GrGLEffects to add code to one of the shaders.
224 */
225 void vsCodeAppendf(const char format[], ...) SK_PRINTF_LIKE(2, 3) {
226 va_list args;
227 va_start(args, format);
228 fVSCode.appendf(format, args);
229 va_end(args);
230 }
231
232 void vsCodeAppend(const char* str) { fVSCode.append(str); }
233
234 /** Add a vertex attribute to the current program that is passed in from the vertex data.
235 Returns false if the attribute was already there, true otherwise. */
236 bool addAttribute(GrSLType type, const char* name);
237
238 /** Add a varying variable to the current program to pass values between vertex and fragment
239 shaders. If the last two parameters are non-NULL, they are filled in with the name
240 generated. */
241 void addVarying(GrSLType type,
242 const char* name,
243 const char** vsOutName = NULL,
244 const char** fsInName = NULL);
245
246 /** Returns a vertex attribute that represents the vertex position in th e VS. This is the
247 pre-matrix position and is commonly used by effects to compute textu re coords via a matrix.
248 */
249 const GrGLShaderVar& positionAttribute() const { return *fPositionVar; }
250
251 /** Returns a vertex attribute that represents the local coords in the V S. This may be the same
252 as positionAttribute() or it may not be. It depends upon whether the rendering code
253 specified explicit local coords or not in the GrDrawState. */
254 const GrGLShaderVar& localCoordsAttribute() const { return *fLocalCoords Var; }
255
256 /**
257 * Are explicit local coordinates provided as input to the vertex shader .
258 */
259 bool hasExplicitLocalCoords() const { return (fLocalCoordsVar != fPositi onVar); }
260
261 bool addEffectAttribute(int attributeIndex, GrSLType type, const SkStrin g& name);
262 const SkString* getEffectAttributeName(int attributeIndex) const;
263
264 GrGLUniformManager::UniformHandle getViewMatrixUniform() const {
265 return fViewMatrixUniform;
266 }
267
268 bool compileAndAttachShaders(GrGLuint programId) const;
269 void bindProgramLocations(GrGLuint programId) const;
270
271 private:
272 GrGLShaderBuilder* fParent;
273 GrGpuGL* fGpu;
274 const GrGLProgramDesc& fDesc;
275 VarArray fVSAttrs;
276 VarArray fVSOutputs;
277 VarArray fGSInputs;
278 VarArray fGSOutputs;
279
280 SkString fVSCode;
281
282 struct AttributePair {
283 void set(int index, const SkString& name) {
284 fIndex = index; fName = name;
285 }
286 int fIndex;
287 SkString fName;
288 };
289 SkSTArray<10, AttributePair, true> fEffectAttributes;
290
291 GrGLUniformManager::UniformHandle fViewMatrixUniform;
292
293 GrGLShaderVar* fPositionVar;
294 GrGLShaderVar* fLocalCoordsVar;
295 };
296
297 /** Gets the vertex builder that is used to construct the vertex and geometr y shaders.
298 It may be NULL if this shader program is only meant to have a fragment s hader. */
299 VertexBuilder* getVertexBuilder() const { return fVertexBuilder.get(); }
300
301 bool finish(GrGLuint* outProgramId); 223 bool finish(GrGLuint* outProgramId);
302 224
303 const GrGLContextInfo& ctxInfo() const; 225 const GrGLContextInfo& ctxInfo() const;
304 226
305 private: 227 protected:
228 GrGpuGL* gpu() const { return fGpu; }
229
230 void setInputColor(const char* inputColor) { fInputColor = inputColor; }
231 void setInputCoverage(const char* inputCoverage) { fInputCoverage = inputCov erage; }
232
233 /** Add input/output variable declarations (i.e. 'varying') to the fragment shader. */
234 GrGLShaderVar& fsInputAppend() { return fFSInputs.push_back(); }
235
236 // Generates a name for a variable. The generated string will be name prefix ed by the prefix
237 // char (unless the prefix is '\0'). It also mangles the name to be stage-sp ecific if we're
238 // generating stage code.
239 void nameVariable(SkString* out, char prefix, const char* name);
240
241 // Helper for emitEffects().
242 void emitEffects(GrGLEffectArrayBuilder*,
243 const GrEffectStage* effectStages[],
244 const EffectKey effectKeys[],
245 int effectCnt,
246 SkString* inOutFSColor,
247 GrSLConstantVec* fsInOutColorKnownValue);
248
249 virtual bool compileAndAttachShaders(GrGLuint programId) const;
250 virtual void bindProgramLocations(GrGLuint programId) const;
251
306 void appendDecls(const VarArray&, SkString*) const; 252 void appendDecls(const VarArray&, SkString*) const;
307 void appendUniformDecls(ShaderVisibility, SkString*) const; 253 void appendUniformDecls(ShaderVisibility, SkString*) const;
308 254
309 bool compileAndAttachShaders(GrGLuint programId) const;
310 void bindProgramLocations(GrGLuint programId) const;
311
312 typedef GrGLUniformManager::BuilderUniform BuilderUniform;
313 GrGLUniformManager::BuilderUniformArray fUniforms;
314
315 private: 255 private:
316 class CodeStage : public SkNoncopyable { 256 class CodeStage : public SkNoncopyable {
317 public: 257 public:
318 CodeStage() : fNextIndex(0), fCurrentIndex(-1), fEffectStage(NULL) {} 258 CodeStage() : fNextIndex(0), fCurrentIndex(-1), fEffectStage(NULL) {}
319 259
320 bool inStageCode() const { 260 bool inStageCode() const {
321 this->validate(); 261 this->validate();
322 return NULL != fEffectStage; 262 return NULL != fEffectStage;
323 } 263 }
324 264
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 kFragCoordConventions_GLSLPrivateFeature = kLastGLSLFeature + 1, 311 kFragCoordConventions_GLSLPrivateFeature = kLastGLSLFeature + 1,
372 kEXTShaderFramebufferFetch_GLSLPrivateFeature, 312 kEXTShaderFramebufferFetch_GLSLPrivateFeature,
373 kNVShaderFramebufferFetch_GLSLPrivateFeature, 313 kNVShaderFramebufferFetch_GLSLPrivateFeature,
374 }; 314 };
375 bool enablePrivateFeature(GLSLPrivateFeature); 315 bool enablePrivateFeature(GLSLPrivateFeature);
376 316
377 // If we ever have VS/GS features we can expand this to take a bitmask of Sh aderVisibility and 317 // If we ever have VS/GS features we can expand this to take a bitmask of Sh aderVisibility and
378 // track the enables separately for each shader. 318 // track the enables separately for each shader.
379 void addFSFeature(uint32_t featureBit, const char* extensionName); 319 void addFSFeature(uint32_t featureBit, const char* extensionName);
380 320
381 // Generates a name for a variable. The generated string will be name prefix ed by the prefix
382 // char (unless the prefix is '\0'). It also mangles the name to be stage-sp ecific if we're
383 // generating stage code.
384 void nameVariable(SkString* out, char prefix, const char* name);
385
386 // Interpretation of DstReadKey when generating code 321 // Interpretation of DstReadKey when generating code
387 enum { 322 enum {
388 kNoDstRead_DstReadKey = 0, 323 kNoDstRead_DstReadKey = 0,
389 kYesDstRead_DstReadKeyBit = 0x1, // Set if we do a dst-copy-read. 324 kYesDstRead_DstReadKeyBit = 0x1, // Set if we do a dst-copy-read.
390 kUseAlphaConfig_DstReadKeyBit = 0x2, // Set if dst-copy config is alpha only. 325 kUseAlphaConfig_DstReadKeyBit = 0x2, // Set if dst-copy config is alpha only.
391 kTopLeftOrigin_DstReadKeyBit = 0x4, // Set if dst-copy origin is top-le ft. 326 kTopLeftOrigin_DstReadKeyBit = 0x4, // Set if dst-copy origin is top-le ft.
392 }; 327 };
393 328
394 enum { 329 enum {
395 kNoFragPosRead_FragPosKey = 0, // The fragment positition wil l not be needed. 330 kNoFragPosRead_FragPosKey = 0, // The fragment positition wil l not be needed.
396 kTopLeftFragPosRead_FragPosKey = 0x1,// Read frag pos relative to t op-left. 331 kTopLeftFragPosRead_FragPosKey = 0x1,// Read frag pos relative to t op-left.
397 kBottomLeftFragPosRead_FragPosKey = 0x2,// Read frag pos relative to b ottom-left. 332 kBottomLeftFragPosRead_FragPosKey = 0x2,// Read frag pos relative to b ottom-left.
398 }; 333 };
399 334
400 GrGpuGL* fGpu; 335 GrGpuGL* fGpu;
401 GrGLUniformManager& fUniformManager; 336 GrGLUniformManager& fUniformManager;
402 uint32_t fFSFeaturesAddedMask; 337 uint32_t fFSFeaturesAddedMask;
403 SkString fFSFunctions; 338 SkString fFSFunctions;
404 SkString fFSExtensions; 339 SkString fFSExtensions;
405 VarArray fFSInputs; 340 VarArray fFSInputs;
406 VarArray fFSOutputs; 341 VarArray fFSOutputs;
342 GrGLUniformManager::BuilderUniformArray fUniforms;
407 343
408 SkString fFSCode; 344 SkString fFSCode;
409 345
410 bool fSetupFragPosition; 346 bool fSetupFragPosition;
411 GrGLUniformManager::UniformHandle fDstCopySamplerUniform; 347 GrGLUniformManager::UniformHandle fDstCopySamplerUniform;
412 348
413 SkString fInputColor; 349 SkString fInputColor;
414 GrSLConstantVec fKnownColorValue; 350 GrSLConstantVec fKnownColorValue;
415 SkString fInputCoverage; 351 SkString fInputCoverage;
416 GrSLConstantVec fKnownCoverageValue; 352 GrSLConstantVec fKnownCoverageValue;
417 353
418 bool fHasCustomColorOutput; 354 bool fHasCustomColorOutput;
419 bool fHasSecondaryOutput; 355 bool fHasSecondaryOutput;
420 356
421 GrGLUniformManager::UniformHandle fRTHeightUniform; 357 GrGLUniformManager::UniformHandle fRTHeightUniform;
422 GrGLUniformManager::UniformHandle fDstCopyTopLeftUniform; 358 GrGLUniformManager::UniformHandle fDstCopyTopLeftUniform;
423 GrGLUniformManager::UniformHandle fDstCopyScaleUniform; 359 GrGLUniformManager::UniformHandle fDstCopyScaleUniform;
424 GrGLUniformManager::UniformHandle fColorUniform; 360 GrGLUniformManager::UniformHandle fColorUniform;
425 GrGLUniformManager::UniformHandle fCoverageUniform; 361 GrGLUniformManager::UniformHandle fCoverageUniform;
426 362
427 bool fTopLeftFragPosRead; 363 bool fTopLeftFragPosRead;
364 };
428 365
429 SkAutoTDelete<VertexBuilder> fVertexBuilder; 366 ////////////////////////////////////////////////////////////////////////////////
367
368 class GrGLFullShaderBuilder : public GrGLShaderBuilder {
369 public:
370 GrGLFullShaderBuilder(GrGpuGL*, GrGLUniformManager&, const GrGLProgramDesc&) ;
371
372 /**
373 * Called by GrGLEffects to add code to one of the shaders.
374 */
375 void vsCodeAppendf(const char format[], ...) SK_PRINTF_LIKE(2, 3) {
376 va_list args;
377 va_start(args, format);
378 fVSCode.appendf(format, args);
379 va_end(args);
380 }
381
382 void vsCodeAppend(const char* str) { fVSCode.append(str); }
383
384 /** Add a vertex attribute to the current program that is passed in from the vertex data.
385 Returns false if the attribute was already there, true otherwise. */
386 bool addAttribute(GrSLType type, const char* name);
387
388 /** Add a varying variable to the current program to pass values between vert ex and fragment
389 shaders. If the last two parameters are non-NULL, they are filled in wit h the name
390 generated. */
391 void addVarying(GrSLType type,
392 const char* name,
393 const char** vsOutName = NULL,
394 const char** fsInName = NULL);
395
396 /** Returns a vertex attribute that represents the vertex position in the VS . This is the
397 pre-matrix position and is commonly used by effects to compute texture c oords via a matrix.
398 */
399 const GrGLShaderVar& positionAttribute() const { return *fPositionVar; }
400
401 /** Returns a vertex attribute that represents the local coords in the VS. T his may be the same
402 as positionAttribute() or it may not be. It depends upon whether the ren dering code
403 specified explicit local coords or not in the GrDrawState. */
404 const GrGLShaderVar& localCoordsAttribute() const { return *fLocalCoordsVar; }
405
406 /**
407 * Are explicit local coordinates provided as input to the vertex shader.
408 */
409 bool hasExplicitLocalCoords() const { return (fLocalCoordsVar != fPositionVa r); }
410
411 bool addEffectAttribute(int attributeIndex, GrSLType type, const SkString& n ame);
412 const SkString* getEffectAttributeName(int attributeIndex) const;
413
414 virtual GrGLEffectArray* emitEffects(const GrEffectStage* effectStages[],
415 const EffectKey effectKeys[],
416 int effectCnt,
417 SkString* inOutFSColor,
418 GrSLConstantVec* fsInOutColorKnownValue ) SK_OVERRIDE;
419
420 GrGLUniformManager::UniformHandle getViewMatrixUniform() const {
421 return fViewMatrixUniform;
422 }
423
424 protected:
425 virtual bool compileAndAttachShaders(GrGLuint programId) const SK_OVERRIDE;
426 virtual void bindProgramLocations(GrGLuint programId) const SK_OVERRIDE;
427
428 private:
429 const GrGLProgramDesc& fDesc;
430 VarArray fVSAttrs;
431 VarArray fVSOutputs;
432 VarArray fGSInputs;
433 VarArray fGSOutputs;
434
435 SkString fVSCode;
436
437 struct AttributePair {
438 void set(int index, const SkString& name) {
439 fIndex = index; fName = name;
440 }
441 int fIndex;
442 SkString fName;
443 };
444 SkSTArray<10, AttributePair, true> fEffectAttributes;
445
446 GrGLUniformManager::UniformHandle fViewMatrixUniform;
447
448 GrGLShaderVar* fPositionVar;
449 GrGLShaderVar* fLocalCoordsVar;
450
451 typedef GrGLShaderBuilder INHERITED;
430 }; 452 };
431 453
432 #endif 454 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698