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

Side by Side Diff: src/gpu/gl/GrGLFragmentProcessor.h

Issue 1287023009: Added tree structure to GrGLFragmentProcessor, i.e. GL instances (Closed) Base URL: https://skia.googlesource.com/skia@cs3_isequal_nonrecursive
Patch Set: moved onSetData from public to protected, onCreateGLInstance from public to private in subclasses Created 5 years, 4 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/GrYUVtoRGBEffect.cpp ('k') | src/gpu/gl/GrGLFragmentProcessor.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 GrGLFragmentProcessor_DEFINED 8 #ifndef GrGLFragmentProcessor_DEFINED
9 #define GrGLFragmentProcessor_DEFINED 9 #define GrGLFragmentProcessor_DEFINED
10 10
11 #include "GrGLProgramDataManager.h" 11 #include "GrGLProgramDataManager.h"
12 #include "GrGLProcessor.h" 12 #include "GrGLProcessor.h"
13 #include "GrTextureAccess.h" 13 #include "GrTextureAccess.h"
14 14
15 class GrGLFPBuilder; 15 class GrGLFPBuilder;
16 16
17 class GrGLFragmentProcessor { 17 class GrGLFragmentProcessor {
18 public: 18 public:
19 GrGLFragmentProcessor() {} 19 GrGLFragmentProcessor() {}
20 20
21 virtual ~GrGLFragmentProcessor() {} 21 virtual ~GrGLFragmentProcessor() {
22 for (int i = 0; i < fChildProcessors.count(); ++i) {
23 SkDELETE(fChildProcessors[i]);
24 }
25 }
22 26
23 typedef GrGLProgramDataManager::UniformHandle UniformHandle; 27 typedef GrGLProgramDataManager::UniformHandle UniformHandle;
24 typedef GrGLProcessor::TransformedCoordsArray TransformedCoordsArray; 28 typedef GrGLProcessor::TransformedCoordsArray TransformedCoordsArray;
25 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray; 29 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray;
26 30
27 /** Called when the program stage should insert its code into the shaders. T he code in each 31 /** Called when the program stage should insert its code into the shaders. T he code in each
28 shader will be in its own block ({}) and so locally scoped names will no t collide across 32 shader will be in its own block ({}) and so locally scoped names will no t collide across
29 stages. 33 stages.
30 34
31 @param builder Interface used to emit code in the shaders. 35 @param builder Interface used to emit code in the shaders.
(...skipping 27 matching lines...) Expand all
59 GrGLFPBuilder* fBuilder; 63 GrGLFPBuilder* fBuilder;
60 const GrFragmentProcessor& fFp; 64 const GrFragmentProcessor& fFp;
61 const char* fOutputColor; 65 const char* fOutputColor;
62 const char* fInputColor; 66 const char* fInputColor;
63 const TransformedCoordsArray& fCoords; 67 const TransformedCoordsArray& fCoords;
64 const TextureSamplerArray& fSamplers; 68 const TextureSamplerArray& fSamplers;
65 }; 69 };
66 70
67 virtual void emitCode(EmitArgs&) = 0; 71 virtual void emitCode(EmitArgs&) = 0;
68 72
69 /** A GrGLFragmentProcessor instance can be reused with any GrFragmentProces sor that produces 73 void setData(const GrGLProgramDataManager& pdman, const GrFragmentProcessor& processor);
70 the same stage key; this function reads data from a GrFragmentProcessor and uploads any
71 uniform variables required by the shaders created in emitCode(). The GrF ragmentProcessor
72 parameter is guaranteed to be of the same type that created this GrGLFra gmentProcessor and
73 to have an identical processor key as the one that created this GrGLFrag mentProcessor. */
74 // TODO update this to pass in GrFragmentProcessor
75 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) {}
76 74
77 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuil der*) {} 75 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuil der*) {}
78 76
77 int numChildProcessors() const { return fChildProcessors.count(); }
78
79 GrGLFragmentProcessor* childProcessor(int index) const {
80 return fChildProcessors[index];
81 }
82
83 protected:
84 /** A GrGLFragmentProcessor instance can be reused with any GrFragmentProces sor that produces
85 the same stage key; this function reads data from a GrFragmentProcessor and uploads any
86 uniform variables required by the shaders created in emitCode(). The GrFragm entProcessor
87 parameter is guaranteed to be of the same type that created this GrGLFragmen tProcessor and
88 to have an identical processor key as the one that created this GrGLFragment Processor. */
89 // TODO update this to pass in GrFragmentProcessor
90 virtual void onSetData(const GrGLProgramDataManager&, const GrProcessor&) {}
91
79 private: 92 private:
93 SkTArray<GrGLFragmentProcessor*, true> fChildProcessors;
94
95 friend class GrFragmentProcessor;
80 typedef GrGLProcessor INHERITED; 96 typedef GrGLProcessor INHERITED;
81 }; 97 };
82 98
83 #endif 99 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrYUVtoRGBEffect.cpp ('k') | src/gpu/gl/GrGLFragmentProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698