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

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

Issue 1607253002: Add gpu implementation of OverdrawXfermode (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update FP & XP Factory counts Created 4 years, 10 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/effects/GrCustomXfermode.cpp ('k') | src/gpu/glsl/GrGLSLXferProcessor.h » ('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"
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 const char* srcCoverage, 552 const char* srcCoverage,
553 const char* dstColor, 553 const char* dstColor,
554 const char* outColor, 554 const char* outColor,
555 const char* outColorSecondary, 555 const char* outColorSecondary,
556 const GrXferProcessor& proc) override { 556 const GrXferProcessor& proc) override {
557 const ShaderPDXferProcessor& xp = proc.cast<ShaderPDXferProcessor>(); 557 const ShaderPDXferProcessor& xp = proc.cast<ShaderPDXferProcessor>();
558 558
559 GrGLSLBlend::AppendMode(fragBuilder, srcColor, dstColor, outColor, xp.ge tXfermode()); 559 GrGLSLBlend::AppendMode(fragBuilder, srcColor, dstColor, outColor, xp.ge tXfermode());
560 560
561 // Apply coverage. 561 // Apply coverage.
562 if (xp.dstReadUsesMixedSamples()) { 562 INHERITED::DefaultCoverageModulation(fragBuilder, srcCoverage, dstColor, outColor,
563 if (srcCoverage) { 563 outColorSecondary, xp);
564 fragBuilder->codeAppendf("%s *= %s;", outColor, srcCoverage);
565 fragBuilder->codeAppendf("%s = %s;", outColorSecondary, srcCover age);
566 } else {
567 fragBuilder->codeAppendf("%s = vec4(1.0);", outColorSecondary);
568 }
569 } else if (srcCoverage) {
570 fragBuilder->codeAppendf("%s = %s * %s + (vec4(1.0) - %s) * %s;",
571 outColor, srcCoverage, outColor, srcCoverag e, dstColor);
572 }
573 } 564 }
574 565
575 void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) over ride {} 566 void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) over ride {}
576 567
577 typedef GrGLSLXferProcessor INHERITED; 568 typedef GrGLSLXferProcessor INHERITED;
578 }; 569 };
579 570
580 /////////////////////////////////////////////////////////////////////////////// 571 ///////////////////////////////////////////////////////////////////////////////
581 572
582 void ShaderPDXferProcessor::onGetGLSLProcessorKey(const GrGLSLCaps&, 573 void ShaderPDXferProcessor::onGetGLSLProcessorKey(const GrGLSLCaps&,
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 } 908 }
918 return get_lcd_blend_formula(optimizations.fCoveragePOI, 909 return get_lcd_blend_formula(optimizations.fCoveragePOI,
919 SkXfermode::kSrcOver_Mode).hasSecondaryOutp ut(); 910 SkXfermode::kSrcOver_Mode).hasSecondaryOutp ut();
920 } 911 }
921 // We fallback on the shader XP when the blend formula would use dual source blending but we 912 // We fallback on the shader XP when the blend formula would use dual source blending but we
922 // don't have support for it. 913 // don't have support for it.
923 return get_blend_formula(optimizations.fColorPOI, optimizations.fCoveragePOI , 914 return get_blend_formula(optimizations.fColorPOI, optimizations.fCoveragePOI ,
924 hasMixedSamples, SkXfermode::kSrcOver_Mode).hasSeco ndaryOutput(); 915 hasMixedSamples, SkXfermode::kSrcOver_Mode).hasSeco ndaryOutput();
925 } 916 }
926 917
OLDNEW
« no previous file with comments | « src/gpu/effects/GrCustomXfermode.cpp ('k') | src/gpu/glsl/GrGLSLXferProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698