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

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

Issue 14233006: Perform coverage blend with the dst in the shader when using a dst-reading xfermode. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 2013 Google Inc. 2 * Copyright 2013 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 GrGLProgramDesc_DEFINED 8 #ifndef GrGLProgramDesc_DEFINED
9 #define GrGLProgramDesc_DEFINED 9 #define GrGLProgramDesc_DEFINED
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 private: 58 private:
59 // Specifies where the initial color comes from before the stages are applie d. 59 // Specifies where the initial color comes from before the stages are applie d.
60 enum ColorInput { 60 enum ColorInput {
61 kSolidWhite_ColorInput, 61 kSolidWhite_ColorInput,
62 kTransBlack_ColorInput, 62 kTransBlack_ColorInput,
63 kAttribute_ColorInput, 63 kAttribute_ColorInput,
64 kUniform_ColorInput, 64 kUniform_ColorInput,
65 65
66 kColorInputCnt 66 kColorInputCnt
67 }; 67 };
68 // Dual-src blending makes use of a secondary output color that can be
69 // used as a per-pixel blend coefficient. This controls whether a
70 // secondary source is output and what value it holds.
71 enum DualSrcOutput {
72 kNone_DualSrcOutput,
73 kCoverage_DualSrcOutput,
74 kCoverageISA_DualSrcOutput,
75 kCoverageISC_DualSrcOutput,
76 68
77 kDualSrcOutputCnt 69 enum CoverageOutput {
70 // modulate color and coverage, write result as the color output.
71 kModulate_CoverageOutput,
72 // Writes color*coverage as the primary color output and also writes cov erage as the
73 // secondary output. Only set if dual source blending is supported.
74 kSecondaryCoverage_CoverageOutput,
75 // Writes color*coverage as the primary color output and also writes cov erage * (1 - colorA)
76 // as the secondary output. Only set if dual source blending is supporte d.
77 kSecondaryCoverageISA_CoverageOutput,
78 // Writes color*coverage as the primary color output and also writes cov erage *
79 // (1 - colorRGB) as the secondary output. Only set if dual source blend ing is supported.
80 kSecondaryCoverageISC_CoverageOutput,
81 // Combines the coverage, dst, and color as coverage * color + (1 - cove rage) * dst. This
82 // can only be set if fDstRead is set.
83 kCombineWithDst_CoverageOutput,
84
85 kCoverageOutputCnt
78 }; 86 };
79 87
88 static bool CoverageOutputUsesSecondaryOutput(CoverageOutput co) {
89 switch (co) {
90 case kSecondaryCoverage_CoverageOutput: // fallthru
91 case kSecondaryCoverageISA_CoverageOutput:
92 case kSecondaryCoverageISC_CoverageOutput:
93 return true;
94 default:
95 return false;
96 }
97 }
98
80 /** Non-zero if this stage has an effect */ 99 /** Non-zero if this stage has an effect */
81 GrGLEffect::EffectKey fEffectKeys[GrDrawState::kNumStages]; 100 GrGLEffect::EffectKey fEffectKeys[GrDrawState::kNumStages];
82 101
83 // To enable experimental geometry shader code (not for use in 102 // To enable experimental geometry shader code (not for use in
84 // production) 103 // production)
85 #if GR_GL_EXPERIMENTAL_GS 104 #if GR_GL_EXPERIMENTAL_GS
86 bool fExperimentalGS; 105 bool fExperimentalGS;
87 #endif 106 #endif
88 107
89 GrGLShaderBuilder::DstReadKey fDstRead; // set by GrGLShaderBuil der if there 108 GrGLShaderBuilder::DstReadKey fDstRead; // set by GrGLShaderBuil der if there
90 // are effects that must read the dst. 109 // are effects that must read the dst.
91 // Otherwise, 0. 110 // Otherwise, 0.
92 111
93 // should the FS discard if the coverage is zero (to avoid stencil manipulat ion) 112 // should the FS discard if the coverage is zero (to avoid stencil manipulat ion)
94 SkBool8 fDiscardIfZeroCoverage; 113 SkBool8 fDiscardIfZeroCoverage;
95 114
96 uint8_t fColorInput; // casts to enum ColorIn put 115 uint8_t fColorInput; // casts to enum ColorIn put
97 uint8_t fCoverageInput; // casts to enum ColorIn put 116 uint8_t fCoverageInput; // casts to enum ColorIn put
98 uint8_t fDualSrcOutput; // casts to enum DualSrc Output 117 uint8_t fCoverageOutput; // casts to enum Coverag eOutput
99 118
100 int8_t fFirstCoverageStage; 119 int8_t fFirstCoverageStage;
101 SkBool8 fEmitsPointSize; 120 SkBool8 fEmitsPointSize;
102 uint8_t fColorFilterXfermode; // casts to enum SkXferm ode::Mode 121 uint8_t fColorFilterXfermode; // casts to enum SkXferm ode::Mode
103 122
104 int8_t fPositionAttributeIndex; 123 int8_t fPositionAttributeIndex;
105 int8_t fLocalCoordAttributeIndex; 124 int8_t fLocalCoordAttributeIndex;
106 int8_t fColorAttributeIndex; 125 int8_t fColorAttributeIndex;
107 int8_t fCoverageAttributeIndex; 126 int8_t fCoverageAttributeIndex;
108 127
109 // GrGLProgram and GrGLShaderBuilder read the private fields to generate cod e. TODO: Move all 128 // GrGLProgram and GrGLShaderBuilder read the private fields to generate cod e. TODO: Move all
110 // code generation to GrGLShaderBuilder (and maybe add getters rather than f riending). 129 // code generation to GrGLShaderBuilder (and maybe add getters rather than f riending).
111 friend class GrGLProgram; 130 friend class GrGLProgram;
112 friend class GrGLShaderBuilder; 131 friend class GrGLShaderBuilder;
113 }; 132 };
114 133
115 #endif 134 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698