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

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

Issue 1215643006: more threading of GrShaderDataManager (Closed) Base URL: https://skia.googlesource.com/skia.git@GrShaderDataManager3
Patch Set: tweaks Created 5 years, 5 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 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 default: 424 default:
425 SkFAIL("Unknown Custom Xfer mode."); 425 SkFAIL("Unknown Custom Xfer mode.");
426 break; 426 break;
427 } 427 }
428 } 428 }
429 429
430 /////////////////////////////////////////////////////////////////////////////// 430 ///////////////////////////////////////////////////////////////////////////////
431 // Fragment Processor 431 // Fragment Processor
432 /////////////////////////////////////////////////////////////////////////////// 432 ///////////////////////////////////////////////////////////////////////////////
433 433
434 GrFragmentProcessor* GrCustomXfermode::CreateFP(SkXfermode::Mode mode, GrTexture * background) { 434 GrFragmentProcessor* GrCustomXfermode::CreateFP(GrShaderDataManager* shaderDataM anager,
435 SkXfermode::Mode mode, GrTexture * background) {
435 if (!GrCustomXfermode::IsSupportedMode(mode)) { 436 if (!GrCustomXfermode::IsSupportedMode(mode)) {
436 return NULL; 437 return NULL;
437 } else { 438 } else {
438 return SkNEW_ARGS(GrCustomXferFP, (mode, background)); 439 return SkNEW_ARGS(GrCustomXferFP, (shaderDataManager, mode, background)) ;
439 } 440 }
440 } 441 }
441 442
442 /////////////////////////////////////////////////////////////////////////////// 443 ///////////////////////////////////////////////////////////////////////////////
443 444
444 class GLCustomXferFP : public GrGLFragmentProcessor { 445 class GLCustomXferFP : public GrGLFragmentProcessor {
445 public: 446 public:
446 GLCustomXferFP(const GrFragmentProcessor&) {} 447 GLCustomXferFP(const GrFragmentProcessor&) {}
447 ~GLCustomXferFP() override {}; 448 ~GLCustomXferFP() override {};
448 449
(...skipping 22 matching lines...) Expand all
471 key |= proc.cast<GrCustomXferFP>().mode() << 1; 472 key |= proc.cast<GrCustomXferFP>().mode() << 1;
472 b->add32(key); 473 b->add32(key);
473 } 474 }
474 475
475 private: 476 private:
476 typedef GrGLFragmentProcessor INHERITED; 477 typedef GrGLFragmentProcessor INHERITED;
477 }; 478 };
478 479
479 /////////////////////////////////////////////////////////////////////////////// 480 ///////////////////////////////////////////////////////////////////////////////
480 481
481 GrCustomXferFP::GrCustomXferFP(SkXfermode::Mode mode, GrTexture* background) 482 GrCustomXferFP::GrCustomXferFP(GrShaderDataManager*, SkXfermode::Mode mode, GrTe xture* background)
482 : fMode(mode) { 483 : fMode(mode) {
483 this->initClassID<GrCustomXferFP>(); 484 this->initClassID<GrCustomXferFP>();
484 485
485 SkASSERT(background); 486 SkASSERT(background);
486 fBackgroundTransform.reset(kLocal_GrCoordSet, background, 487 fBackgroundTransform.reset(kLocal_GrCoordSet, background,
487 GrTextureParams::kNone_FilterMode); 488 GrTextureParams::kNone_FilterMode);
488 this->addCoordTransform(&fBackgroundTransform); 489 this->addCoordTransform(&fBackgroundTransform);
489 fBackgroundAccess.reset(background); 490 fBackgroundAccess.reset(background);
490 this->addTextureAccess(&fBackgroundAccess); 491 this->addTextureAccess(&fBackgroundAccess);
491 } 492 }
(...skipping 15 matching lines...) Expand all
507 inout->setToUnknown(GrInvariantOutput::kWill_ReadInput); 508 inout->setToUnknown(GrInvariantOutput::kWill_ReadInput);
508 } 509 }
509 510
510 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCustomXferFP); 511 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCustomXferFP);
511 GrFragmentProcessor* GrCustomXferFP::TestCreate(SkRandom* rand, 512 GrFragmentProcessor* GrCustomXferFP::TestCreate(SkRandom* rand,
512 GrContext*, 513 GrContext*,
513 const GrCaps&, 514 const GrCaps&,
514 GrTexture* textures[]) { 515 GrTexture* textures[]) {
515 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas tSeparableMode); 516 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas tSeparableMode);
516 517
517 return SkNEW_ARGS(GrCustomXferFP, (static_cast<SkXfermode::Mode>(mode), text ures[0])); 518 GrShaderDataManager shaderDataManager;
519 return SkNEW_ARGS(GrCustomXferFP, (&shaderDataManager, static_cast<SkXfermod e::Mode>(mode),
520 textures[0]));
518 } 521 }
519 522
520 /////////////////////////////////////////////////////////////////////////////// 523 ///////////////////////////////////////////////////////////////////////////////
521 // Xfer Processor 524 // Xfer Processor
522 /////////////////////////////////////////////////////////////////////////////// 525 ///////////////////////////////////////////////////////////////////////////////
523 526
524 class CustomXP : public GrXferProcessor { 527 class CustomXP : public GrXferProcessor {
525 public: 528 public:
526 CustomXP(SkXfermode::Mode mode, GrBlendEquation hwBlendEquation) 529 CustomXP(SkXfermode::Mode mode, GrBlendEquation hwBlendEquation)
527 : fMode(mode), 530 : fMode(mode),
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory); 819 GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory);
817 GrXPFactory* GrCustomXPFactory::TestCreate(SkRandom* rand, 820 GrXPFactory* GrCustomXPFactory::TestCreate(SkRandom* rand,
818 GrContext*, 821 GrContext*,
819 const GrCaps&, 822 const GrCaps&,
820 GrTexture*[]) { 823 GrTexture*[]) {
821 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas tSeparableMode); 824 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas tSeparableMode);
822 825
823 return SkNEW_ARGS(GrCustomXPFactory, (static_cast<SkXfermode::Mode>(mode))); 826 return SkNEW_ARGS(GrCustomXPFactory, (static_cast<SkXfermode::Mode>(mode)));
824 } 827 }
825 828
OLDNEW
« no previous file with comments | « src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp ('k') | src/gpu/effects/GrCustomXfermodePriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698