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

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

Issue 23464082: Revert "Add a requiresVertexShader method to GrGLEffect" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/gl/GrGLProgram.cpp ('k') | src/gpu/gl/GrGLShaderBuilder.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 GrGLShaderBuilder_DEFINED 8 #ifndef GrGLShaderBuilder_DEFINED
9 #define GrGLShaderBuilder_DEFINED 9 #define GrGLShaderBuilder_DEFINED
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 enum ShaderVisibility { 102 enum ShaderVisibility {
103 kVertex_Visibility = 0x1, 103 kVertex_Visibility = 0x1,
104 kGeometry_Visibility = 0x2, 104 kGeometry_Visibility = 0x2,
105 kFragment_Visibility = 0x4, 105 kFragment_Visibility = 0x4,
106 }; 106 };
107 107
108 GrGLShaderBuilder(const GrGLContextInfo&, 108 GrGLShaderBuilder(const GrGLContextInfo&,
109 GrGLUniformManager&, 109 GrGLUniformManager&,
110 const GrGLProgramDesc&, 110 const GrGLProgramDesc&,
111 bool hasVertexShaderEffects); 111 bool needsVertexShader);
112 112
113 /** 113 /**
114 * Use of these features may require a GLSL extension to be enabled. Shaders may not compile 114 * Use of these features may require a GLSL extension to be enabled. Shaders may not compile
115 * if code is added that uses one of these features without calling enableFe ature() 115 * if code is added that uses one of these features without calling enableFe ature()
116 */ 116 */
117 enum GLSLFeature { 117 enum GLSLFeature {
118 kStandardDerivatives_GLSLFeature = 0, 118 kStandardDerivatives_GLSLFeature = 0,
119 119
120 kLastGLSLFeature = kStandardDerivatives_GLSLFeature 120 kLastGLSLFeature = kStandardDerivatives_GLSLFeature
121 }; 121 };
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 * Adds code for effects. effectStages contains the effects to add. effectKe ys[i] is the key 250 * Adds code for effects. effectStages contains the effects to add. effectKe ys[i] is the key
251 * generated from effectStages[i]. An entry in effectStages can be NULL, in which case it is 251 * generated from effectStages[i]. An entry in effectStages can be NULL, in which case it is
252 * skipped. Moreover, if the corresponding key is GrGLEffect::NoEffectKey th en it is skipped. 252 * skipped. Moreover, if the corresponding key is GrGLEffect::NoEffectKey th en it is skipped.
253 * inOutFSColor specifies the input color to the first stage and is updated to be the 253 * inOutFSColor specifies the input color to the first stage and is updated to be the
254 * output color of the last stage. fsInOutColorKnownValue specifies whether the input color 254 * output color of the last stage. fsInOutColorKnownValue specifies whether the input color
255 * has a known constant value and is updated to refer to the status of the o utput color. 255 * has a known constant value and is updated to refer to the status of the o utput color.
256 * The handles to texture samplers for effectStage[i] are added to effectSam plerHandles[i]. The 256 * The handles to texture samplers for effectStage[i] are added to effectSam plerHandles[i]. The
257 * glEffects array is updated to contain the GrGLEffect generated for each e ntry in 257 * glEffects array is updated to contain the GrGLEffect generated for each e ntry in
258 * effectStages. 258 * effectStages.
259 */ 259 */
260 void emitEffects(GrGLEffect* const glEffects[], 260 void emitEffects(const GrEffectStage* effectStages[],
261 const GrDrawEffect drawEffects[],
262 const GrBackendEffectFactory::EffectKey effectKeys[], 261 const GrBackendEffectFactory::EffectKey effectKeys[],
263 int effectCnt, 262 int effectCnt,
264 SkString* inOutFSColor, 263 SkString* inOutFSColor,
265 GrSLConstantVec* fsInOutColorKnownValue, 264 GrSLConstantVec* fsInOutColorKnownValue,
266 SkTArray<GrGLUniformManager::UniformHandle, true>* effectSa mplerHandles[]); 265 SkTArray<GrGLUniformManager::UniformHandle, true>* effectSa mplerHandles[],
266 GrGLEffect* glEffects[]);
267 267
268 GrGLUniformManager::UniformHandle getRTHeightUniform() const { return fRTHei ghtUniform; } 268 GrGLUniformManager::UniformHandle getRTHeightUniform() const { return fRTHei ghtUniform; }
269 GrGLUniformManager::UniformHandle getDstCopyTopLeftUniform() const { 269 GrGLUniformManager::UniformHandle getDstCopyTopLeftUniform() const {
270 return fDstCopyTopLeftUniform; 270 return fDstCopyTopLeftUniform;
271 } 271 }
272 GrGLUniformManager::UniformHandle getDstCopyScaleUniform() const { 272 GrGLUniformManager::UniformHandle getDstCopyScaleUniform() const {
273 return fDstCopyScaleUniform; 273 return fDstCopyScaleUniform;
274 } 274 }
275 GrGLUniformManager::UniformHandle getDstCopySamplerUniform() const { 275 GrGLUniformManager::UniformHandle getDstCopySamplerUniform() const {
276 return fDstCopySampler.fSamplerUniform; 276 return fDstCopySampler.fSamplerUniform;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 private: 382 private:
383 void appendDecls(const VarArray&, SkString*) const; 383 void appendDecls(const VarArray&, SkString*) const;
384 void appendUniformDecls(ShaderVisibility, SkString*) const; 384 void appendUniformDecls(ShaderVisibility, SkString*) const;
385 385
386 typedef GrGLUniformManager::BuilderUniform BuilderUniform; 386 typedef GrGLUniformManager::BuilderUniform BuilderUniform;
387 GrGLUniformManager::BuilderUniformArray fUniforms; 387 GrGLUniformManager::BuilderUniformArray fUniforms;
388 388
389 private: 389 private:
390 class CodeStage : public SkNoncopyable { 390 class CodeStage : public SkNoncopyable {
391 public: 391 public:
392 CodeStage() : fNextIndex(0), fCurrentIndex(-1), fEffect(NULL) {} 392 CodeStage() : fNextIndex(0), fCurrentIndex(-1), fEffectStage(NULL) {}
393 393
394 bool inStageCode() const { 394 bool inStageCode() const {
395 this->validate(); 395 this->validate();
396 return NULL != fEffect; 396 return NULL != fEffectStage;
397 } 397 }
398 398
399 const GrEffectRef* effect() const { 399 const GrEffectStage* effectStage() const {
400 this->validate(); 400 this->validate();
401 return fEffect; 401 return fEffectStage;
402 } 402 }
403 403
404 int stageIndex() const { 404 int stageIndex() const {
405 this->validate(); 405 this->validate();
406 return fCurrentIndex; 406 return fCurrentIndex;
407 } 407 }
408 408
409 class AutoStageRestore : public SkNoncopyable { 409 class AutoStageRestore : public SkNoncopyable {
410 public: 410 public:
411 AutoStageRestore(CodeStage* codeStage, const GrEffectRef* effect) { 411 AutoStageRestore(CodeStage* codeStage, const GrEffectStage* newStage ) {
412 SkASSERT(NULL != codeStage); 412 SkASSERT(NULL != codeStage);
413 fSavedIndex = codeStage->fCurrentIndex; 413 fSavedIndex = codeStage->fCurrentIndex;
414 fSavedEffect = codeStage->fEffect; 414 fSavedEffectStage = codeStage->fEffectStage;
415 415
416 if (NULL == effect) { 416 if (NULL == newStage) {
417 codeStage->fCurrentIndex = -1; 417 codeStage->fCurrentIndex = -1;
418 } else { 418 } else {
419 codeStage->fCurrentIndex = codeStage->fNextIndex++; 419 codeStage->fCurrentIndex = codeStage->fNextIndex++;
420 } 420 }
421 codeStage->fEffect = effect; 421 codeStage->fEffectStage = newStage;
422 422
423 fCodeStage = codeStage; 423 fCodeStage = codeStage;
424 } 424 }
425 ~AutoStageRestore() { 425 ~AutoStageRestore() {
426 fCodeStage->fCurrentIndex = fSavedIndex; 426 fCodeStage->fCurrentIndex = fSavedIndex;
427 fCodeStage->fEffect = fSavedEffect; 427 fCodeStage->fEffectStage = fSavedEffectStage;
428 } 428 }
429 private: 429 private:
430 CodeStage* fCodeStage; 430 CodeStage* fCodeStage;
431 int fSavedIndex; 431 int fSavedIndex;
432 const GrEffectRef* fSavedEffect; 432 const GrEffectStage* fSavedEffectStage;
433 }; 433 };
434 private: 434 private:
435 void validate() const { SkASSERT((NULL == fEffect) == (-1 == fCurrentInd ex)); } 435 void validate() const { SkASSERT((NULL == fEffectStage) == (-1 == fCurre ntIndex)); }
436 int fNextIndex; 436 int fNextIndex;
437 int fCurrentIndex; 437 int fCurrentIndex;
438 const GrEffectRef* fEffect; 438 const GrEffectStage* fEffectStage;
439 } fCodeStage; 439 } fCodeStage;
440 440
441 /** 441 /**
442 * Features that should only be enabled by GrGLShaderBuilder itself. 442 * Features that should only be enabled by GrGLShaderBuilder itself.
443 */ 443 */
444 enum GLSLPrivateFeature { 444 enum GLSLPrivateFeature {
445 kFragCoordConventions_GLSLPrivateFeature = kLastGLSLFeature + 1, 445 kFragCoordConventions_GLSLPrivateFeature = kLastGLSLFeature + 1,
446 kEXTShaderFramebufferFetch_GLSLPrivateFeature, 446 kEXTShaderFramebufferFetch_GLSLPrivateFeature,
447 kNVShaderFramebufferFetch_GLSLPrivateFeature, 447 kNVShaderFramebufferFetch_GLSLPrivateFeature,
448 }; 448 };
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 GrGLUniformManager::UniformHandle fRTHeightUniform; 487 GrGLUniformManager::UniformHandle fRTHeightUniform;
488 GrGLUniformManager::UniformHandle fDstCopyTopLeftUniform; 488 GrGLUniformManager::UniformHandle fDstCopyTopLeftUniform;
489 GrGLUniformManager::UniformHandle fDstCopyScaleUniform; 489 GrGLUniformManager::UniformHandle fDstCopyScaleUniform;
490 490
491 bool fTopLeftFragPosRead; 491 bool fTopLeftFragPosRead;
492 492
493 SkAutoTDelete<VertexBuilder> fVertexBuilder; 493 SkAutoTDelete<VertexBuilder> fVertexBuilder;
494 }; 494 };
495 495
496 #endif 496 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgram.cpp ('k') | src/gpu/gl/GrGLShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698