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

Side by Side Diff: src/gpu/glsl/GrGLSLFragmentProcessor.h

Issue 1885863004: Refactor how we store and use samplers in Ganesh (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove unneeded assert Created 4 years, 8 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/gl/builders/GrGLProgramBuilder.cpp ('k') | src/gpu/glsl/GrGLSLFragmentProcessor.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 2013 Google Inc. 2 * Copyright 2013 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 GrGLSLFragmentProcessor_DEFINED 8 #ifndef GrGLSLFragmentProcessor_DEFINED
9 #define GrGLSLFragmentProcessor_DEFINED 9 #define GrGLSLFragmentProcessor_DEFINED
10 10
(...skipping 13 matching lines...) Expand all
24 public: 24 public:
25 GrGLSLFragmentProcessor() {} 25 GrGLSLFragmentProcessor() {}
26 26
27 virtual ~GrGLSLFragmentProcessor() { 27 virtual ~GrGLSLFragmentProcessor() {
28 for (int i = 0; i < fChildProcessors.count(); ++i) { 28 for (int i = 0; i < fChildProcessors.count(); ++i) {
29 delete fChildProcessors[i]; 29 delete fChildProcessors[i];
30 } 30 }
31 } 31 }
32 32
33 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; 33 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle;
34 typedef GrGLSLSampler::SamplerArray SamplerArray; 34 typedef GrGLSLProgramDataManager::UniformHandle SamplerHandle;
35 35
36 /** Called when the program stage should insert its code into the shaders. T he code in each 36 /** Called when the program stage should insert its code into the shaders. T he code in each
37 shader will be in its own block ({}) and so locally scoped names will no t collide across 37 shader will be in its own block ({}) and so locally scoped names will no t collide across
38 stages. 38 stages.
39 39
40 @param builder Interface used to emit code in the shaders. 40 @param builder Interface used to emit code in the shaders.
41 @param processor The processor that generated this program stage. 41 @param processor The processor that generated this program stage.
42 @param key The key that was computed by GenKey() from the gener ating GrProcessor. 42 @param key The key that was computed by GenKey() from the gener ating GrProcessor.
43 @param outputColor A predefined vec4 in the FS in which the stage shoul d place its output 43 @param outputColor A predefined vec4 in the FS in which the stage shoul d place its output
44 color (or coverage). 44 color (or coverage).
45 @param inputColor A vec4 that holds the input color to the stage in th e FS. This may be 45 @param inputColor A vec4 that holds the input color to the stage in th e FS. This may be
46 nullptr in which case the implied input is solid whi te (all ones). 46 nullptr in which case the implied input is solid whi te (all ones).
47 TODO: Better system for communicating optimization i nfo (e.g. input 47 TODO: Better system for communicating optimization i nfo (e.g. input
48 color is solid white, trans black, known to be opaqu e, etc.) that allows 48 color is solid white, trans black, known to be opaqu e, etc.) that allows
49 the processor to communicate back similar known info about its output. 49 the processor to communicate back similar known info about its output.
50 @param samplers Contains one entry for each GrTextureAccess of the G rProcessor. These 50 @param samplers Contains one entry for each GrTextureAccess of the G rProcessor. These
51 can be passed to the builder to emit texture reads i n the generated 51 can be passed to the builder to emit texture reads i n the generated
52 code. 52 code.
53 */ 53 */
54 54
55 struct EmitArgs { 55 struct EmitArgs {
56 EmitArgs(GrGLSLFPFragmentBuilder* fragBuilder, 56 EmitArgs(GrGLSLFPFragmentBuilder* fragBuilder,
57 GrGLSLUniformHandler* uniformHandler, 57 GrGLSLUniformHandler* uniformHandler,
58 const GrGLSLCaps* caps, 58 const GrGLSLCaps* caps,
59 const GrFragmentProcessor& fp, 59 const GrFragmentProcessor& fp,
60 const char* outputColor, 60 const char* outputColor,
61 const char* inputColor, 61 const char* inputColor,
62 const GrGLSLTransformedCoordsArray& coords, 62 const GrGLSLTransformedCoordsArray& coords,
63 const SamplerArray& texSamplers, 63 const SamplerHandle* texSamplers,
64 const SamplerArray& bufferSamplers) 64 const SamplerHandle* bufferSamplers)
65 : fFragBuilder(fragBuilder) 65 : fFragBuilder(fragBuilder)
66 , fUniformHandler(uniformHandler) 66 , fUniformHandler(uniformHandler)
67 , fGLSLCaps(caps) 67 , fGLSLCaps(caps)
68 , fFp(fp) 68 , fFp(fp)
69 , fOutputColor(outputColor) 69 , fOutputColor(outputColor)
70 , fInputColor(inputColor) 70 , fInputColor(inputColor)
71 , fCoords(coords) 71 , fCoords(coords)
72 , fTexSamplers(texSamplers) 72 , fTexSamplers(texSamplers)
73 , fBufferSamplers(bufferSamplers) {} 73 , fBufferSamplers(bufferSamplers) {}
74 GrGLSLFPFragmentBuilder* fFragBuilder; 74 GrGLSLFPFragmentBuilder* fFragBuilder;
75 GrGLSLUniformHandler* fUniformHandler; 75 GrGLSLUniformHandler* fUniformHandler;
76 const GrGLSLCaps* fGLSLCaps; 76 const GrGLSLCaps* fGLSLCaps;
77 const GrFragmentProcessor& fFp; 77 const GrFragmentProcessor& fFp;
78 const char* fOutputColor; 78 const char* fOutputColor;
79 const char* fInputColor; 79 const char* fInputColor;
80 const GrGLSLTransformedCoordsArray& fCoords; 80 const GrGLSLTransformedCoordsArray& fCoords;
81 const SamplerArray& fTexSamplers; 81 const SamplerHandle* fTexSamplers;
82 const SamplerArray& fBufferSamplers; 82 const SamplerHandle* fBufferSamplers;
83 }; 83 };
84 84
85 virtual void emitCode(EmitArgs&) = 0; 85 virtual void emitCode(EmitArgs&) = 0;
86 86
87 void setData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcesso r& processor); 87 void setData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcesso r& processor);
88 88
89 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuil der*) {} 89 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuil der*) {}
90 90
91 int numChildProcessors() const { return fChildProcessors.count(); } 91 int numChildProcessors() const { return fChildProcessors.count(); }
92 92
(...skipping 26 matching lines...) Expand all
119 119
120 private: 120 private:
121 void internalEmitChild(int, const char*, const char*, EmitArgs&); 121 void internalEmitChild(int, const char*, const char*, EmitArgs&);
122 122
123 SkTArray<GrGLSLFragmentProcessor*, true> fChildProcessors; 123 SkTArray<GrGLSLFragmentProcessor*, true> fChildProcessors;
124 124
125 friend class GrFragmentProcessor; 125 friend class GrFragmentProcessor;
126 }; 126 };
127 127
128 #endif 128 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLProgramBuilder.cpp ('k') | src/gpu/glsl/GrGLSLFragmentProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698