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

Side by Side Diff: src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp

Issue 1037123003: Implement support for KHR_blend_equation_advanced (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_zzz2_barriers
Patch Set: Rename blendEquationAdvancedIsKHR to mustEnableAdvancedBlendEquations Created 5 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 #include "GrGLFragmentShaderBuilder.h" 8 #include "GrGLFragmentShaderBuilder.h"
9 #include "GrGLProgramBuilder.h" 9 #include "GrGLProgramBuilder.h"
10 #include "../GrGLGpu.h" 10 #include "../GrGLGpu.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 this->enableCustomOutput(); 176 this->enableCustomOutput();
177 fOutputs[fCustomColorOutputIndex].setTypeModifier(GrShaderVar::kInOu t_TypeModifier); 177 fOutputs[fCustomColorOutputIndex].setTypeModifier(GrShaderVar::kInOu t_TypeModifier);
178 fbFetchColorName = declared_color_output_name(); 178 fbFetchColorName = declared_color_output_name();
179 } 179 }
180 return fbFetchColorName; 180 return fbFetchColorName;
181 } else { 181 } else {
182 return kDstCopyColorName; 182 return kDstCopyColorName;
183 } 183 }
184 } 184 }
185 185
186 void GrGLFragmentShaderBuilder::enableAdvancedBlendEquation(GrBlendEquation adva ncedEquation) {
187 SkASSERT(fProgramBuilder->gpu()->glCaps().glslCaps()->mustEnableAdvancedBlen dEquations());
188 SkASSERT(GrBlendEquationIsAdvanced(advancedEquation));
189
190 static const char* layoutQualifierNames[] = {
191 "blend_support_screen",
192 "blend_support_overlay",
193 "blend_support_darken",
194 "blend_support_lighten",
195 "blend_support_colordodge",
196 "blend_support_colorburn",
197 "blend_support_hardlight",
198 "blend_support_softlight",
199 "blend_support_difference",
200 "blend_support_exclusion",
201 "blend_support_multiply",
202 "blend_support_hsl_hue",
203 "blend_support_hsl_saturation",
204 "blend_support_hsl_color",
205 "blend_support_hsl_luminosity"
206 };
207 this->addFeature(1 << kBlendEquationAdvanced_GLSLPrivateFeature,
208 "GL_KHR_blend_equation_advanced");
209 this->addLayoutQualifier(layoutQualifierNames[advancedEquation - kFirstAdvan cedGrBlendEquation],
egdaniel 2015/05/04 19:51:21 so this doesn't ever set to blend_support_all. I w
Chris Dalton 2015/05/04 20:33:12 Yeah I don't have much insight either, outside the
egdaniel 2015/05/04 21:04:51 Okay let's keep it as is and we'll just have a TOD
Chris Dalton 2015/05/05 18:57:58 I actually went ahead and handled blend_support_al
210 kOut_InterfaceQualifier);
211
212 GR_STATIC_ASSERT(0 == kScreen_GrBlendEquation - kFirstAdvancedGrBlendEquatio n);
213 GR_STATIC_ASSERT(1 == kOverlay_GrBlendEquation - kFirstAdvancedGrBlendEquati on);
214 GR_STATIC_ASSERT(2 == kDarken_GrBlendEquation - kFirstAdvancedGrBlendEquatio n);
215 GR_STATIC_ASSERT(3 == kLighten_GrBlendEquation - kFirstAdvancedGrBlendEquati on);
216 GR_STATIC_ASSERT(4 == kColorDodge_GrBlendEquation - kFirstAdvancedGrBlendEqu ation);
217 GR_STATIC_ASSERT(5 == kColorBurn_GrBlendEquation - kFirstAdvancedGrBlendEqua tion);
218 GR_STATIC_ASSERT(6 == kHardLight_GrBlendEquation - kFirstAdvancedGrBlendEqua tion);
219 GR_STATIC_ASSERT(7 == kSoftLight_GrBlendEquation - kFirstAdvancedGrBlendEqua tion);
220 GR_STATIC_ASSERT(8 == kDifference_GrBlendEquation - kFirstAdvancedGrBlendEqu ation);
221 GR_STATIC_ASSERT(9 == kExclusion_GrBlendEquation - kFirstAdvancedGrBlendEqua tion);
222 GR_STATIC_ASSERT(10 == kMultiply_GrBlendEquation - kFirstAdvancedGrBlendEqua tion);
223 GR_STATIC_ASSERT(11 == kHSLHue_GrBlendEquation - kFirstAdvancedGrBlendEquati on);
224 GR_STATIC_ASSERT(12 == kHSLSaturation_GrBlendEquation - kFirstAdvancedGrBlen dEquation);
225 GR_STATIC_ASSERT(13 == kHSLColor_GrBlendEquation - kFirstAdvancedGrBlendEqua tion);
226 GR_STATIC_ASSERT(14 == kHSLLuminosity_GrBlendEquation - kFirstAdvancedGrBlen dEquation);
227 GR_STATIC_ASSERT(SK_ARRAY_COUNT(layoutQualifierNames) ==
228 kTotalGrBlendEquationCount - kFirstAdvancedGrBlendEquation) ;
229 }
230
186 void GrGLFragmentShaderBuilder::enableCustomOutput() { 231 void GrGLFragmentShaderBuilder::enableCustomOutput() {
187 if (!fHasCustomColorOutput) { 232 if (!fHasCustomColorOutput) {
188 fHasCustomColorOutput = true; 233 fHasCustomColorOutput = true;
189 fCustomColorOutputIndex = fOutputs.count(); 234 fCustomColorOutputIndex = fOutputs.count();
190 fOutputs.push_back().set(kVec4f_GrSLType, 235 fOutputs.push_back().set(kVec4f_GrSLType,
191 GrGLShaderVar::kOut_TypeModifier, 236 GrGLShaderVar::kOut_TypeModifier,
192 declared_color_output_name()); 237 declared_color_output_name());
193 } 238 }
194 } 239 }
195 240
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 281 }
237 } 282 }
238 283
239 void GrGLFragmentShaderBuilder::addVarying(GrGLVarying* v, GrSLPrecision fsPrec) { 284 void GrGLFragmentShaderBuilder::addVarying(GrGLVarying* v, GrSLPrecision fsPrec) {
240 v->fFsIn = v->fVsOut; 285 v->fFsIn = v->fVsOut;
241 if (v->fGsOut) { 286 if (v->fGsOut) {
242 v->fFsIn = v->fGsOut; 287 v->fFsIn = v->fGsOut;
243 } 288 }
244 fInputs.push_back().set(v->fType, GrGLShaderVar::kVaryingIn_TypeModifier, v- >fFsIn, fsPrec); 289 fInputs.push_back().set(v->fType, GrGLShaderVar::kVaryingIn_TypeModifier, v- >fFsIn, fsPrec);
245 } 290 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698