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

Side by Side Diff: include/gpu/GrFragmentProcessor.h

Issue 778453002: Remove backend factories (Closed) Base URL: https://skia.googlesource.com/skia.git@unichoice
Patch Set: more clang warnings Created 6 years 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 | « include/gpu/GrBackendProcessorFactory.h ('k') | include/gpu/GrProcessor.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 #ifndef GrFragmentProcessor_DEFINED 8 #ifndef GrFragmentProcessor_DEFINED
9 #define GrFragmentProcessor_DEFINED 9 #define GrFragmentProcessor_DEFINED
10 10
11 #include "GrProcessor.h" 11 #include "GrProcessor.h"
12 12
13 class GrCoordTransform; 13 class GrCoordTransform;
14 class GrGLCaps;
15 class GrGLFragmentProcessor;
16 class GrProcessorKeyBuilder;
14 17
15 /** Provides custom fragment shader code. Fragment processors receive an input c olor (vec4f) and 18 /** Provides custom fragment shader code. Fragment processors receive an input c olor (vec4f) and
16 produce an output color. They may reference textures and uniforms. They may use 19 produce an output color. They may reference textures and uniforms. They may use
17 GrCoordTransforms to receive a transformation of the local coordinates that map from local space 20 GrCoordTransforms to receive a transformation of the local coordinates that map from local space
18 to the fragment being processed. 21 to the fragment being processed.
19 */ 22 */
20 class GrFragmentProcessor : public GrProcessor { 23 class GrFragmentProcessor : public GrProcessor {
21 public: 24 public:
22 GrFragmentProcessor() 25 GrFragmentProcessor()
23 : INHERITED() 26 : INHERITED()
24 , fWillReadDstColor(false) 27 , fWillReadDstColor(false)
25 , fWillUseInputColor(true) {} 28 , fWillUseInputColor(true) {}
26 29
27 virtual const GrBackendFragmentProcessorFactory& getFactory() const = 0; 30 /** Implemented using GLFragmentProcessor::GenKey as described in this class 's comment. */
31 virtual void getGLProcessorKey(const GrGLCaps& caps,
32 GrProcessorKeyBuilder* b) const = 0;
33
34 /** Returns a new instance of the appropriate *GL* implementation class
35 for the given GrFragmentProcessor; caller is responsible for deleting
36 the object. */
37 virtual GrGLFragmentProcessor* createGLInstance() const = 0;
38
39 /** Human-meaningful string to identify this GrFragmentProcessor; may be emb edded
40 in generated shader code. */
41 virtual const char* name() const = 0;
28 42
29 int numTransforms() const { return fCoordTransforms.count(); } 43 int numTransforms() const { return fCoordTransforms.count(); }
30 44
31 /** Returns the coordinate transformation at index. index must be valid acco rding to 45 /** Returns the coordinate transformation at index. index must be valid acco rding to
32 numTransforms(). */ 46 numTransforms(). */
33 const GrCoordTransform& coordTransform(int index) const { return *fCoordTran sforms[index]; } 47 const GrCoordTransform& coordTransform(int index) const { return *fCoordTran sforms[index]; }
34 48
35 /** Will this prceossor read the destination pixel value? */ 49 /** Will this prceossor read the destination pixel value? */
36 bool willReadDstColor() const { return fWillReadDstColor; } 50 bool willReadDstColor() const { return fWillReadDstColor; }
37 51
38 /** Will this prceossor read the source color value? */ 52 /** Will this prceossor read the source color value? */
39 bool willUseInputColor() const { return fWillUseInputColor; } 53 bool willUseInputColor() const { return fWillUseInputColor; }
40 54
41 /** Returns true if this and other prceossor conservatively draw identically . It can only return 55 /** Returns true if this and other processor conservatively draw identically . It can only return
42 true when the two prceossor are of the same subclass (i.e. they return t he same object from 56 true when the two processor are of the same subclass (i.e. they return t he same object from
43 from getFactory()). 57 from getFactory()).
44 58
45 A return value of true from isEqual() should not be used to test whether the prceossor would 59 A return value of true from isEqual() should not be used to test whether the processor would
46 generate the same shader code. To test for identical code generation use the prceossor' keys 60 generate the same shader code. To test for identical code generation use getGLProcessorKey*/
47 computed by the GrBackendProcessorFactory. */
48 bool isEqual(const GrFragmentProcessor& that) const { 61 bool isEqual(const GrFragmentProcessor& that) const {
49 if (&this->getFactory() != &that.getFactory() || 62 if (this->classID() != that.classID() ||
50 !this->hasSameTransforms(that) || 63 !this->hasSameTransforms(that) ||
51 !this->hasSameTextureAccesses(that)) { 64 !this->hasSameTextureAccesses(that)) {
52 return false; 65 return false;
53 } 66 }
54 return this->onIsEqual(that); 67 return this->onIsEqual(that);
55 } 68 }
56 69
57 protected: 70 protected:
58 /** 71 /**
59 * Fragment Processor subclasses call this from their constructor to registe r coordinate 72 * Fragment Processor subclasses call this from their constructor to registe r coordinate
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 bool hasSameTransforms(const GrFragmentProcessor&) const; 113 bool hasSameTransforms(const GrFragmentProcessor&) const;
101 114
102 SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms; 115 SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms;
103 bool fWillReadDstColor; 116 bool fWillReadDstColor;
104 bool fWillUseInputColor; 117 bool fWillUseInputColor;
105 118
106 typedef GrProcessor INHERITED; 119 typedef GrProcessor INHERITED;
107 }; 120 };
108 121
109 #endif 122 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrBackendProcessorFactory.h ('k') | include/gpu/GrProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698