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/GrGLProgramDesc.h

Issue 554833002: Calculate Primary and Secondary output types in the GrOptDrawState (Closed) Base URL: https://skia.googlesource.com/skia.git@optReadDst
Patch Set: Rebase Created 6 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
« no previous file with comments | « src/gpu/gl/GrGLProgram.cpp ('k') | src/gpu/gl/GrGLProgramDesc.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 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
11 #include "GrGLEffect.h" 11 #include "GrGLEffect.h"
12 #include "GrDrawState.h" 12 #include "GrDrawState.h"
13 #include "GrGpu.h" 13 #include "GrGpu.h"
14 #include "GrOptDrawState.h"
14 15
15 class GrGpuGL; 16 class GrGpuGL;
16 17
17 #ifdef SK_DEBUG 18 #ifdef SK_DEBUG
18 // Optionally compile the experimental GS code. Set to SK_DEBUG so that debug build bots will 19 // Optionally compile the experimental GS code. Set to SK_DEBUG so that debug build bots will
19 // execute the code. 20 // execute the code.
20 #define GR_GL_EXPERIMENTAL_GS 1 21 #define GR_GL_EXPERIMENTAL_GS 1
21 #else 22 #else
22 #define GR_GL_EXPERIMENTAL_GS 0 23 #define GR_GL_EXPERIMENTAL_GS 0
23 #endif 24 #endif
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 private: 105 private:
105 // Specifies where the initial color comes from before the stages are applie d. 106 // Specifies where the initial color comes from before the stages are applie d.
106 enum ColorInput { 107 enum ColorInput {
107 kAllOnes_ColorInput, 108 kAllOnes_ColorInput,
108 kAttribute_ColorInput, 109 kAttribute_ColorInput,
109 kUniform_ColorInput, 110 kUniform_ColorInput,
110 111
111 kColorInputCnt 112 kColorInputCnt
112 }; 113 };
113 114
114 enum CoverageOutput {
115 // modulate color and coverage, write result as the color output.
116 kModulate_CoverageOutput,
117 // Writes color*coverage as the primary color output and also writes cov erage as the
118 // secondary output. Only set if dual source blending is supported.
119 kSecondaryCoverage_CoverageOutput,
120 // Writes color*coverage as the primary color output and also writes cov erage * (1 - colorA)
121 // as the secondary output. Only set if dual source blending is supporte d.
122 kSecondaryCoverageISA_CoverageOutput,
123 // Writes color*coverage as the primary color output and also writes cov erage *
124 // (1 - colorRGB) as the secondary output. Only set if dual source blend ing is supported.
125 kSecondaryCoverageISC_CoverageOutput,
126 // Combines the coverage, dst, and color as coverage * color + (1 - cove rage) * dst. This
127 // can only be set if fDstReadKey is non-zero.
128 kCombineWithDst_CoverageOutput,
129
130 kCoverageOutputCnt
131 };
132
133 static bool CoverageOutputUsesSecondaryOutput(CoverageOutput co) {
134 switch (co) {
135 case kSecondaryCoverage_CoverageOutput: // fallthru
136 case kSecondaryCoverageISA_CoverageOutput:
137 case kSecondaryCoverageISC_CoverageOutput:
138 return true;
139 default:
140 return false;
141 }
142 }
143
144 struct KeyHeader { 115 struct KeyHeader {
145 uint8_t fDstReadKey; // set by GrGLShaderBuil der if there 116 uint8_t fDstReadKey; // set by GrGLShaderBuil der if there
146 // are effects that must read the dst. 117 // are effects that must read the dst.
147 // Otherwise, 0. 118 // Otherwise, 0.
148 uint8_t fFragPosKey; // set by GrGLShaderBuil der if there are 119 uint8_t fFragPosKey; // set by GrGLShaderBuil der if there are
149 // effects that read the fragment position. 120 // effects that read the fragment position.
150 // Otherwise, 0. 121 // Otherwise, 0.
151 ColorInput fColorInput : 8;
152 ColorInput fCoverageInput : 8;
153 CoverageOutput fCoverageOutput : 8;
154 122
155 SkBool8 fUseFragShaderOnly; 123 SkBool8 fUseFragShaderOnly;
156 SkBool8 fEmitsPointSize; 124 SkBool8 fEmitsPointSize;
157 125
126 ColorInput fColorInput : 8;
127 ColorInput fCoverageInput : 8;
128
129 GrOptDrawState::PrimaryOutputType fPrimaryOutputType : 8;
130 GrOptDrawState::SecondaryOutputType fSecondaryOutputType : 8;
131
132
158 // To enable experimental geometry shader code (not for use in 133 // To enable experimental geometry shader code (not for use in
159 // production) 134 // production)
160 #if GR_GL_EXPERIMENTAL_GS 135 #if GR_GL_EXPERIMENTAL_GS
161 SkBool8 fExperimentalGS; 136 SkBool8 fExperimentalGS;
162 #endif 137 #endif
163 138
164 int8_t fPositionAttributeIndex; 139 int8_t fPositionAttributeIndex;
165 int8_t fLocalCoordAttributeIndex; 140 int8_t fLocalCoordAttributeIndex;
166 int8_t fColorAttributeIndex; 141 int8_t fColorAttributeIndex;
167 int8_t fCoverageAttributeIndex; 142 int8_t fCoverageAttributeIndex;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 friend class GrGLProgram; 241 friend class GrGLProgram;
267 friend class GrGLProgramBuilder; 242 friend class GrGLProgramBuilder;
268 friend class GrGLFullProgramBuilder; 243 friend class GrGLFullProgramBuilder;
269 friend class GrGLFragmentOnlyProgramBuilder; 244 friend class GrGLFragmentOnlyProgramBuilder;
270 friend class GrGLVertexShaderBuilder; 245 friend class GrGLVertexShaderBuilder;
271 friend class GrGLFragmentShaderBuilder; 246 friend class GrGLFragmentShaderBuilder;
272 friend class GrGLGeometryShaderBuilder; 247 friend class GrGLGeometryShaderBuilder;
273 }; 248 };
274 249
275 #endif 250 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgram.cpp ('k') | src/gpu/gl/GrGLProgramDesc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698