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

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

Issue 901663007: Revert of Move DstCopy on gpu into the GrXferProcessor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilde r*) {} 20 void emitCode(const EmitArgs& args) SK_OVERRIDE {
21
22 private:
23 void onEmitCode(const EmitArgs& args) SK_OVERRIDE {
24 // This emit code should be empty. However, on the nexus 6 there is a dr iver bug where if 21 // This emit code should be empty. However, on the nexus 6 there is a dr iver bug where if
25 // you do not give gl_FragColor a value, the gl context is lost and we e nd up drawing 22 // you do not give gl_FragColor a value, the gl context is lost and we e nd up drawing
26 // nothing. So this fix just sets the gl_FragColor arbitrarily to 0. 23 // nothing. So this fix just sets the gl_FragColor arbitrarily to 0.
27 GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); 24 GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
28 fsBuilder->codeAppendf("%s = vec4(0);", args.fOutputPrimary); 25 fsBuilder->codeAppendf("%s = vec4(0);", args.fOutputPrimary);
29 } 26 }
30 27
31 void onSetData(const GrGLProgramDataManager&, const GrXferProcessor&) SK_OVE RRIDE {} 28 void setData(const GrGLProgramDataManager&, const GrXferProcessor&) SK_OVERR IDE {}
32 29
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::onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyB uilder* b) const { 42 void GrDisableColorXP::getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBui lder* 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* 60 GrXferProcessor* GrDisableColorXPFactory::createXferProcessor(const GrProcOptInf o& colorPOI,
61 GrDisableColorXPFactory::onCreateXferProcessor(const GrProcOptInfo& colorPOI, 61 const GrProcOptInf o& covPOI) const {
62 const GrProcOptInfo& covPOI,
63 const GrDeviceCoordTexture* dstCo py) const {
64 return GrDisableColorXP::Create(); 62 return GrDisableColorXP::Create();
65 } 63 }
66 64
67 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory); 65 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory);
68 66
69 GrXPFactory* GrDisableColorXPFactory::TestCreate(SkRandom* random, 67 GrXPFactory* GrDisableColorXPFactory::TestCreate(SkRandom* random,
70 GrContext*, 68 GrContext*,
71 const GrDrawTargetCaps&, 69 const GrDrawTargetCaps&,
72 GrTexture*[]) { 70 GrTexture*[]) {
73 return GrDisableColorXPFactory::Create(); 71 return GrDisableColorXPFactory::Create();
74 } 72 }
75 73
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