OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2014 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #ifndef GrGLXferProcessor_DEFINED | |
9 #define GrGLXferProcessor_DEFINED | |
10 | |
11 #include "GrGLProcessor.h" | |
12 | |
13 class GrGLXPBuilder; | |
14 | |
15 class GrGLXferProcessor { | |
16 public: | |
17 GrGLXferProcessor() {} | |
18 virtual ~GrGLXferProcessor() {} | |
19 | |
20 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray; | |
21 struct EmitArgs { | |
22 EmitArgs(GrGLXPBuilder* pb, | |
23 const GrXferProcessor& xp, | |
24 const char* inputColor, | |
25 const char* inputCoverage, | |
26 const char* outputPrimary, | |
27 const char* outputSecondary, | |
28 const TextureSamplerArray& samplers) | |
29 : fPB(pb) | |
30 , fXP(xp) | |
31 , fInputColor(inputColor) | |
32 , fInputCoverage(inputCoverage) | |
33 , fOutputPrimary(outputPrimary) | |
34 , fOutputSecondary(outputSecondary) | |
35 , fSamplers(samplers) {} | |
36 | |
37 GrGLXPBuilder* fPB; | |
38 const GrXferProcessor& fXP; | |
39 const char* fInputColor; | |
40 const char* fInputCoverage; | |
41 const char* fOutputPrimary; | |
42 const char* fOutputSecondary; | |
43 const TextureSamplerArray& fSamplers; | |
44 }; | |
45 /** | |
46 * This is similar to emitCode() in the base class, except it takes a full s
hader builder. | |
47 * This allows the effect subclass to emit vertex code. | |
48 */ | |
49 virtual void emitCode(const EmitArgs&) = 0; | |
50 | |
51 /** A GrGLXferProcessor instance can be reused with any GrGLXferProcessor th
at produces | |
52 the same stage key; this function reads data from a GrGLXferProcessor an
d uploads any | |
53 uniform variables required by the shaders created in emitCode(). The Gr
XferProcessor | |
54 parameter is guaranteed to be of the same type that created this GrGLXfe
rProcessor and | |
55 to have an identical processor key as the one that created this GrGLXfer
Processor. */ | |
56 virtual void setData(const GrGLProgramDataManager&, | |
57 const GrXferProcessor&) = 0; | |
58 private: | |
59 typedef GrGLProcessor INHERITED; | |
60 }; | |
61 #endif | |
OLD | NEW |