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

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

Issue 1490283004: Create GLSLUniformHandler class for gpu backend (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up public api of uniformhandler Created 5 years 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/GrOvalEffect.cpp ('k') | src/gpu/effects/GrRRectEffect.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 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 "effects/GrPorterDuffXferProcessor.h" 8 #include "effects/GrPorterDuffXferProcessor.h"
9 9
10 #include "GrBlend.h" 10 #include "GrBlend.h"
11 #include "GrCaps.h" 11 #include "GrCaps.h"
12 #include "GrPipeline.h" 12 #include "GrPipeline.h"
13 #include "GrProcessor.h" 13 #include "GrProcessor.h"
14 #include "GrProcOptInfo.h" 14 #include "GrProcOptInfo.h"
15 #include "GrTypes.h" 15 #include "GrTypes.h"
16 #include "GrXferProcessor.h" 16 #include "GrXferProcessor.h"
17 #include "glsl/GrGLSLBlend.h" 17 #include "glsl/GrGLSLBlend.h"
18 #include "glsl/GrGLSLFragmentShaderBuilder.h" 18 #include "glsl/GrGLSLFragmentShaderBuilder.h"
19 #include "glsl/GrGLSLProgramBuilder.h"
20 #include "glsl/GrGLSLProgramDataManager.h" 19 #include "glsl/GrGLSLProgramDataManager.h"
20 #include "glsl/GrGLSLUniformHandler.h"
21 #include "glsl/GrGLSLXferProcessor.h" 21 #include "glsl/GrGLSLXferProcessor.h"
22 22
23 /** 23 /**
24 * Wraps the shader outputs and HW blend state that comprise a Porter Duff blend mode with coverage. 24 * Wraps the shader outputs and HW blend state that comprise a Porter Duff blend mode with coverage.
25 */ 25 */
26 struct BlendFormula { 26 struct BlendFormula {
27 public: 27 public:
28 /** 28 /**
29 * Values the shader can write to primary and secondary outputs. These must all be modulated by 29 * Values the shader can write to primary and secondary outputs. These must all be modulated by
30 * coverage to support mixed samples. The XP will ignore the multiplies when not using coverage. 30 * coverage to support mixed samples. The XP will ignore the multiplies when not using coverage.
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 /////////////////////////////////////////////////////////////////////////////// 538 ///////////////////////////////////////////////////////////////////////////////
539 539
540 class GLShaderPDXferProcessor : public GrGLSLXferProcessor { 540 class GLShaderPDXferProcessor : public GrGLSLXferProcessor {
541 public: 541 public:
542 static void GenKey(const GrProcessor& processor, GrProcessorKeyBuilder* b) { 542 static void GenKey(const GrProcessor& processor, GrProcessorKeyBuilder* b) {
543 const ShaderPDXferProcessor& xp = processor.cast<ShaderPDXferProcessor>( ); 543 const ShaderPDXferProcessor& xp = processor.cast<ShaderPDXferProcessor>( );
544 b->add32(xp.getXfermode()); 544 b->add32(xp.getXfermode());
545 } 545 }
546 546
547 private: 547 private:
548 void emitBlendCodeForDstRead(GrGLSLXPBuilder* pb, 548 void emitBlendCodeForDstRead(GrGLSLXPFragmentBuilder* fragBuilder,
549 GrGLSLXPFragmentBuilder* fragBuilder, 549 GrGLSLUniformHandler* uniformHandler,
550 const char* srcColor, 550 const char* srcColor,
551 const char* srcCoverage, 551 const char* srcCoverage,
552 const char* dstColor, 552 const char* dstColor,
553 const char* outColor, 553 const char* outColor,
554 const char* outColorSecondary, 554 const char* outColorSecondary,
555 const GrXferProcessor& proc) override { 555 const GrXferProcessor& proc) override {
556 const ShaderPDXferProcessor& xp = proc.cast<ShaderPDXferProcessor>(); 556 const ShaderPDXferProcessor& xp = proc.cast<ShaderPDXferProcessor>();
557 557
558 GrGLSLBlend::AppendMode(fragBuilder, srcColor, dstColor, outColor, xp.ge tXfermode()); 558 GrGLSLBlend::AppendMode(fragBuilder, srcColor, dstColor, outColor, xp.ge tXfermode());
559 559
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 } 911 }
912 return get_lcd_blend_formula(optimizations.fCoveragePOI, 912 return get_lcd_blend_formula(optimizations.fCoveragePOI,
913 SkXfermode::kSrcOver_Mode).hasSecondaryOutp ut(); 913 SkXfermode::kSrcOver_Mode).hasSecondaryOutp ut();
914 } 914 }
915 // We fallback on the shader XP when the blend formula would use dual source blending but we 915 // We fallback on the shader XP when the blend formula would use dual source blending but we
916 // don't have support for it. 916 // don't have support for it.
917 return get_blend_formula(optimizations.fColorPOI, optimizations.fCoveragePOI , 917 return get_blend_formula(optimizations.fColorPOI, optimizations.fCoveragePOI ,
918 hasMixedSamples, SkXfermode::kSrcOver_Mode).hasSeco ndaryOutput(); 918 hasMixedSamples, SkXfermode::kSrcOver_Mode).hasSeco ndaryOutput();
919 } 919 }
920 920
OLDNEW
« no previous file with comments | « src/gpu/effects/GrOvalEffect.cpp ('k') | src/gpu/effects/GrRRectEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698