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

Side by Side Diff: src/gpu/effects/GrCustomXfermode.cpp

Issue 1428543003: Create GLSL base class for ProgramDataManager (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add space Created 5 years, 1 month 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/effects/GrCoverageSetOpXP.cpp ('k') | src/gpu/effects/GrDashingEffect.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 2015 Google Inc. 2 * Copyright 2015 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 "effects/GrCustomXfermode.h" 8 #include "effects/GrCustomXfermode.h"
9 9
10 #include "GrCoordTransform.h" 10 #include "GrCoordTransform.h"
11 #include "GrContext.h" 11 #include "GrContext.h"
12 #include "GrFragmentProcessor.h" 12 #include "GrFragmentProcessor.h"
13 #include "GrInvariantOutput.h" 13 #include "GrInvariantOutput.h"
14 #include "GrProcessor.h" 14 #include "GrProcessor.h"
15 #include "GrTexture.h" 15 #include "GrTexture.h"
16 #include "GrTextureAccess.h" 16 #include "GrTextureAccess.h"
17 #include "SkXfermode.h" 17 #include "SkXfermode.h"
18 #include "gl/GrGLCaps.h" 18 #include "gl/GrGLCaps.h"
19 #include "gl/GrGLGpu.h" 19 #include "gl/GrGLGpu.h"
20 #include "gl/GrGLSLBlend.h" 20 #include "gl/GrGLSLBlend.h"
21 #include "gl/GrGLFragmentProcessor.h" 21 #include "gl/GrGLFragmentProcessor.h"
22 #include "gl/GrGLProgramDataManager.h" 22 #include "gl/GrGLProgramDataManager.h"
23 #include "gl/builders/GrGLProgramBuilder.h" 23 #include "gl/builders/GrGLProgramBuilder.h"
24 #include "glsl/GrGLSLCaps.h" 24 #include "glsl/GrGLSLCaps.h"
25 #include "glsl/GrGLSLProgramDataManager.h"
25 26
26 bool GrCustomXfermode::IsSupportedMode(SkXfermode::Mode mode) { 27 bool GrCustomXfermode::IsSupportedMode(SkXfermode::Mode mode) {
27 return mode > SkXfermode::kLastCoeffMode && mode <= SkXfermode::kLastMode; 28 return mode > SkXfermode::kLastCoeffMode && mode <= SkXfermode::kLastMode;
28 } 29 }
29 30
30 /////////////////////////////////////////////////////////////////////////////// 31 ///////////////////////////////////////////////////////////////////////////////
31 // Static helpers 32 // Static helpers
32 /////////////////////////////////////////////////////////////////////////////// 33 ///////////////////////////////////////////////////////////////////////////////
33 34
34 static GrBlendEquation hw_blend_equation(SkXfermode::Mode mode) { 35 static GrBlendEquation hw_blend_equation(SkXfermode::Mode mode) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 162
162 void emitBlendCodeForDstRead(GrGLXPBuilder* pb, const char* srcColor, const char* dstColor, 163 void emitBlendCodeForDstRead(GrGLXPBuilder* pb, const char* srcColor, const char* dstColor,
163 const char* outColor, const GrXferProcessor& pr oc) override { 164 const char* outColor, const GrXferProcessor& pr oc) override {
164 const CustomXP& xp = proc.cast<CustomXP>(); 165 const CustomXP& xp = proc.cast<CustomXP>();
165 SkASSERT(!xp.hasHWBlendEquation()); 166 SkASSERT(!xp.hasHWBlendEquation());
166 167
167 GrGLXPFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder(); 168 GrGLXPFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder();
168 GrGLSLBlend::AppendMode(fsBuilder, srcColor, dstColor, outColor, xp.mode ()); 169 GrGLSLBlend::AppendMode(fsBuilder, srcColor, dstColor, outColor, xp.mode ());
169 } 170 }
170 171
171 void onSetData(const GrGLProgramDataManager&, const GrXferProcessor&) overri de {} 172 void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) over ride {}
172 173
173 typedef GrGLXferProcessor INHERITED; 174 typedef GrGLXferProcessor INHERITED;
174 }; 175 };
175 176
176 /////////////////////////////////////////////////////////////////////////////// 177 ///////////////////////////////////////////////////////////////////////////////
177 178
178 void CustomXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder * b) const { 179 void CustomXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder * b) const {
179 GLCustomXP::GenKey(*this, caps, b); 180 GLCustomXP::GenKey(*this, caps, b);
180 } 181 }
181 182
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 393
393 /////////////////////////////////////////////////////////////////////////////// 394 ///////////////////////////////////////////////////////////////////////////////
394 395
395 GrXPFactory* GrCustomXfermode::CreateXPFactory(SkXfermode::Mode mode) { 396 GrXPFactory* GrCustomXfermode::CreateXPFactory(SkXfermode::Mode mode) {
396 if (!GrCustomXfermode::IsSupportedMode(mode)) { 397 if (!GrCustomXfermode::IsSupportedMode(mode)) {
397 return nullptr; 398 return nullptr;
398 } else { 399 } else {
399 return new CustomXPFactory(mode); 400 return new CustomXPFactory(mode);
400 } 401 }
401 } 402 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrCoverageSetOpXP.cpp ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698