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

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

Issue 885923002: Move DstCopy on gpu into the GrXferProcessor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Back to bool Created 5 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/GrDisableColorXP.h ('k') | src/gpu/effects/GrPorterDuffXferProcessor.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/GrDisableColorXP.h" 8 #include "effects/GrDisableColorXP.h"
9 #include "GrProcessor.h" 9 #include "GrProcessor.h"
10 #include "gl/GrGLXferProcessor.h" 10 #include "gl/GrGLXferProcessor.h"
11 #include "gl/builders/GrGLFragmentShaderBuilder.h" 11 #include "gl/builders/GrGLFragmentShaderBuilder.h"
12 #include "gl/builders/GrGLProgramBuilder.h" 12 #include "gl/builders/GrGLProgramBuilder.h"
13 13
14 class GrGLDisableColorXP : public GrGLXferProcessor { 14 class GrGLDisableColorXP : public GrGLXferProcessor {
15 public: 15 public:
16 GrGLDisableColorXP(const GrProcessor&) {} 16 GrGLDisableColorXP(const GrProcessor&) {}
17 17
18 ~GrGLDisableColorXP() SK_OVERRIDE {} 18 ~GrGLDisableColorXP() SK_OVERRIDE {}
19 19
20 void emitCode(const EmitArgs& args) SK_OVERRIDE { 20 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilde r*) {}
21
22 private:
23 void onEmitCode(const EmitArgs& args) SK_OVERRIDE {
21 // This emit code should be empty. However, on the nexus 6 there is a dr iver bug where if 24 // This emit code should be empty. However, on the nexus 6 there is a dr iver bug where if
22 // you do not give gl_FragColor a value, the gl context is lost and we e nd up drawing 25 // you do not give gl_FragColor a value, the gl context is lost and we e nd up drawing
23 // nothing. So this fix just sets the gl_FragColor arbitrarily to 0. 26 // nothing. So this fix just sets the gl_FragColor arbitrarily to 0.
24 GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); 27 GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
25 fsBuilder->codeAppendf("%s = vec4(0);", args.fOutputPrimary); 28 fsBuilder->codeAppendf("%s = vec4(0);", args.fOutputPrimary);
26 } 29 }
27 30
28 void setData(const GrGLProgramDataManager&, const GrXferProcessor&) SK_OVERR IDE {} 31 void onSetData(const GrGLProgramDataManager&, const GrXferProcessor&) SK_OVE RRIDE {}
29 32
30 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilde r*) {}
31
32 private:
33 typedef GrGLXferProcessor INHERITED; 33 typedef GrGLXferProcessor INHERITED;
34 }; 34 };
35 35
36 /////////////////////////////////////////////////////////////////////////////// 36 ///////////////////////////////////////////////////////////////////////////////
37 37
38 GrDisableColorXP::GrDisableColorXP() { 38 GrDisableColorXP::GrDisableColorXP() {
39 this->initClassID<GrDisableColorXP>(); 39 this->initClassID<GrDisableColorXP>();
40 } 40 }
41 41
42 void GrDisableColorXP::getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBui lder* b) const { 42 void GrDisableColorXP::onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyB uilder* b) const {
43 GrGLDisableColorXP::GenKey(*this, caps, b); 43 GrGLDisableColorXP::GenKey(*this, caps, b);
44 } 44 }
45 45
46 GrGLXferProcessor* GrDisableColorXP::createGLInstance() const { 46 GrGLXferProcessor* GrDisableColorXP::createGLInstance() const {
47 return SkNEW_ARGS(GrGLDisableColorXP, (*this)); 47 return SkNEW_ARGS(GrGLDisableColorXP, (*this));
48 } 48 }
49 49
50 void GrDisableColorXP::getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const { 50 void GrDisableColorXP::getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const {
51 blendInfo->fWriteColor = false; 51 blendInfo->fWriteColor = false;
52 } 52 }
53 53
54 /////////////////////////////////////////////////////////////////////////////// 54 ///////////////////////////////////////////////////////////////////////////////
55 55
56 GrDisableColorXPFactory::GrDisableColorXPFactory() { 56 GrDisableColorXPFactory::GrDisableColorXPFactory() {
57 this->initClassID<GrDisableColorXPFactory>(); 57 this->initClassID<GrDisableColorXPFactory>();
58 } 58 }
59 59
60 GrXferProcessor* GrDisableColorXPFactory::createXferProcessor(const GrProcOptInf o& colorPOI, 60 GrXferProcessor*
61 const GrProcOptInf o& covPOI) const { 61 GrDisableColorXPFactory::onCreateXferProcessor(const GrProcOptInfo& colorPOI,
62 const GrProcOptInfo& covPOI,
63 const GrDeviceCoordTexture* dstCo py) const {
62 return GrDisableColorXP::Create(); 64 return GrDisableColorXP::Create();
63 } 65 }
64 66
65 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory); 67 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory);
66 68
67 GrXPFactory* GrDisableColorXPFactory::TestCreate(SkRandom* random, 69 GrXPFactory* GrDisableColorXPFactory::TestCreate(SkRandom* random,
68 GrContext*, 70 GrContext*,
69 const GrDrawTargetCaps&, 71 const GrDrawTargetCaps&,
70 GrTexture*[]) { 72 GrTexture*[]) {
71 return GrDisableColorXPFactory::Create(); 73 return GrDisableColorXPFactory::Create();
72 } 74 }
73 75
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDisableColorXP.h ('k') | src/gpu/effects/GrPorterDuffXferProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698