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

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

Issue 1132373003: Add function for logging blend info on XP. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warning? 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
« no previous file with comments | « src/gpu/GrXferProcessor.cpp ('k') | src/gpu/gl/GrGLGpu.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 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 #include "effects/GrCustomXfermodePriv.h" 9 #include "effects/GrCustomXfermodePriv.h"
10 10
(...skipping 30 matching lines...) Expand all
41 GR_STATIC_ASSERT(kColorBurn_GrBlendEquation == SkXfermode::kColorBurn_Mode + kOffset); 41 GR_STATIC_ASSERT(kColorBurn_GrBlendEquation == SkXfermode::kColorBurn_Mode + kOffset);
42 GR_STATIC_ASSERT(kHardLight_GrBlendEquation == SkXfermode::kHardLight_Mode + kOffset); 42 GR_STATIC_ASSERT(kHardLight_GrBlendEquation == SkXfermode::kHardLight_Mode + kOffset);
43 GR_STATIC_ASSERT(kSoftLight_GrBlendEquation == SkXfermode::kSoftLight_Mode + kOffset); 43 GR_STATIC_ASSERT(kSoftLight_GrBlendEquation == SkXfermode::kSoftLight_Mode + kOffset);
44 GR_STATIC_ASSERT(kDifference_GrBlendEquation == SkXfermode::kDifference_Mode + kOffset); 44 GR_STATIC_ASSERT(kDifference_GrBlendEquation == SkXfermode::kDifference_Mode + kOffset);
45 GR_STATIC_ASSERT(kExclusion_GrBlendEquation == SkXfermode::kExclusion_Mode + kOffset); 45 GR_STATIC_ASSERT(kExclusion_GrBlendEquation == SkXfermode::kExclusion_Mode + kOffset);
46 GR_STATIC_ASSERT(kMultiply_GrBlendEquation == SkXfermode::kMultiply_Mode + k Offset); 46 GR_STATIC_ASSERT(kMultiply_GrBlendEquation == SkXfermode::kMultiply_Mode + k Offset);
47 GR_STATIC_ASSERT(kHSLHue_GrBlendEquation == SkXfermode::kHue_Mode + kOffset) ; 47 GR_STATIC_ASSERT(kHSLHue_GrBlendEquation == SkXfermode::kHue_Mode + kOffset) ;
48 GR_STATIC_ASSERT(kHSLSaturation_GrBlendEquation == SkXfermode::kSaturation_M ode + kOffset); 48 GR_STATIC_ASSERT(kHSLSaturation_GrBlendEquation == SkXfermode::kSaturation_M ode + kOffset);
49 GR_STATIC_ASSERT(kHSLColor_GrBlendEquation == SkXfermode::kColor_Mode + kOff set); 49 GR_STATIC_ASSERT(kHSLColor_GrBlendEquation == SkXfermode::kColor_Mode + kOff set);
50 GR_STATIC_ASSERT(kHSLLuminosity_GrBlendEquation == SkXfermode::kLuminosity_M ode + kOffset); 50 GR_STATIC_ASSERT(kHSLLuminosity_GrBlendEquation == SkXfermode::kLuminosity_M ode + kOffset);
51 GR_STATIC_ASSERT(kTotalGrBlendEquationCount == SkXfermode::kLastMode + 1 + k Offset); 51 GR_STATIC_ASSERT(kGrBlendEquationCnt == SkXfermode::kLastMode + 1 + kOffset) ;
52 } 52 }
53 53
54 static void hard_light(GrGLFragmentBuilder* fsBuilder, 54 static void hard_light(GrGLFragmentBuilder* fsBuilder,
55 const char* final, 55 const char* final,
56 const char* src, 56 const char* src,
57 const char* dst) { 57 const char* dst) {
58 static const char kComponents[] = {'r', 'g', 'b'}; 58 static const char kComponents[] = {'r', 'g', 'b'};
59 for (size_t i = 0; i < SK_ARRAY_COUNT(kComponents); ++i) { 59 for (size_t i = 0; i < SK_ARRAY_COUNT(kComponents); ++i) {
60 char component = kComponents[i]; 60 char component = kComponents[i];
61 fsBuilder->codeAppendf("if (2.0 * %s.%c <= %s.a) {", src, component, src ); 61 fsBuilder->codeAppendf("if (2.0 * %s.%c <= %s.a) {", src, component, src );
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 519
520 ~CustomXP() override {}; 520 ~CustomXP() override {};
521 521
522 const char* name() const override { return "Custom Xfermode"; } 522 const char* name() const override { return "Custom Xfermode"; }
523 523
524 GrGLXferProcessor* createGLInstance() const override; 524 GrGLXferProcessor* createGLInstance() const override;
525 525
526 bool hasSecondaryOutput() const override { return false; } 526 bool hasSecondaryOutput() const override { return false; }
527 527
528 SkXfermode::Mode mode() const { return fMode; } 528 SkXfermode::Mode mode() const { return fMode; }
529 bool hasHWBlendEquation() const { return kInvalid_GrBlendEquation != fHWBlen dEquation; } 529 bool hasHWBlendEquation() const { return -1 != static_cast<int>(fHWBlendEqua tion); }
530 530
531 GrBlendEquation hwBlendEquation() const { 531 GrBlendEquation hwBlendEquation() const {
532 SkASSERT(this->hasHWBlendEquation()); 532 SkASSERT(this->hasHWBlendEquation());
533 return fHWBlendEquation; 533 return fHWBlendEquation;
534 } 534 }
535 535
536 private: 536 private:
537 CustomXP(SkXfermode::Mode mode, const GrDeviceCoordTexture* dstCopy, bool wi llReadDstColor); 537 CustomXP(SkXfermode::Mode mode, const GrDeviceCoordTexture* dstCopy, bool wi llReadDstColor);
538 538
539 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI, 539 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 623
624 typedef GrGLFragmentProcessor INHERITED; 624 typedef GrGLFragmentProcessor INHERITED;
625 }; 625 };
626 626
627 /////////////////////////////////////////////////////////////////////////////// 627 ///////////////////////////////////////////////////////////////////////////////
628 628
629 CustomXP::CustomXP(SkXfermode::Mode mode, const GrDeviceCoordTexture* dstCopy, 629 CustomXP::CustomXP(SkXfermode::Mode mode, const GrDeviceCoordTexture* dstCopy,
630 bool willReadDstColor) 630 bool willReadDstColor)
631 : INHERITED(dstCopy, willReadDstColor), 631 : INHERITED(dstCopy, willReadDstColor),
632 fMode(mode), 632 fMode(mode),
633 fHWBlendEquation(kInvalid_GrBlendEquation) { 633 fHWBlendEquation(static_cast<GrBlendEquation>(-1)) {
634 this->initClassID<CustomXP>(); 634 this->initClassID<CustomXP>();
635 } 635 }
636 636
637 void CustomXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder * b) const { 637 void CustomXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder * b) const {
638 GLCustomXP::GenKey(*this, caps, b); 638 GLCustomXP::GenKey(*this, caps, b);
639 } 639 }
640 640
641 GrGLXferProcessor* CustomXP::createGLInstance() const { 641 GrGLXferProcessor* CustomXP::createGLInstance() const {
642 SkASSERT(this->willReadDstColor() != this->hasHWBlendEquation()); 642 SkASSERT(this->willReadDstColor() != this->hasHWBlendEquation());
643 return SkNEW_ARGS(GLCustomXP, (*this)); 643 return SkNEW_ARGS(GLCustomXP, (*this));
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory); 818 GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory);
819 GrXPFactory* GrCustomXPFactory::TestCreate(SkRandom* rand, 819 GrXPFactory* GrCustomXPFactory::TestCreate(SkRandom* rand,
820 GrContext*, 820 GrContext*,
821 const GrDrawTargetCaps&, 821 const GrDrawTargetCaps&,
822 GrTexture*[]) { 822 GrTexture*[]) {
823 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas tSeparableMode); 823 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas tSeparableMode);
824 824
825 return SkNEW_ARGS(GrCustomXPFactory, (static_cast<SkXfermode::Mode>(mode))); 825 return SkNEW_ARGS(GrCustomXPFactory, (static_cast<SkXfermode::Mode>(mode)));
826 } 826 }
827 827
OLDNEW
« no previous file with comments | « src/gpu/GrXferProcessor.cpp ('k') | src/gpu/gl/GrGLGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698