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

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

Issue 858343002: Rename GrOptDrawState to GrPipeline and GrDrawState to GrPipelineBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more nits Created 5 years, 11 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/GrGLGpuProgramCache.cpp ('k') | src/gpu/gl/GrGLProgram.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 2011 Google Inc. 2 * Copyright 2011 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 8
9 #ifndef GrGLProgram_DEFINED 9 #ifndef GrGLProgram_DEFINED
10 #define GrGLProgram_DEFINED 10 #define GrGLProgram_DEFINED
11 11
12 #include "builders/GrGLProgramBuilder.h" 12 #include "builders/GrGLProgramBuilder.h"
13 #include "GrDrawState.h"
14 #include "GrGLContext.h" 13 #include "GrGLContext.h"
15 #include "GrGLProgramDesc.h" 14 #include "GrGLProgramDesc.h"
16 #include "GrGLSL.h" 15 #include "GrGLSL.h"
17 #include "GrGLTexture.h" 16 #include "GrGLTexture.h"
18 #include "GrGLProgramDataManager.h" 17 #include "GrGLProgramDataManager.h"
19 18
20 #include "SkString.h" 19 #include "SkString.h"
21 #include "SkXfermode.h" 20 #include "SkXfermode.h"
22 21
23 class GrGLProcessor; 22 class GrGLProcessor;
24 class GrGLInstalledProcessors; 23 class GrGLInstalledProcessors;
25 class GrGLProgramBuilder; 24 class GrGLProgramBuilder;
25 class GrPipeline;
26 26
27 /** 27 /**
28 * This class manages a GPU program and records per-program information. 28 * This class manages a GPU program and records per-program information.
29 * We can specify the attribute locations so that they are constant 29 * We can specify the attribute locations so that they are constant
30 * across our shaders. But the driver determines the uniform locations 30 * across our shaders. But the driver determines the uniform locations
31 * at link time. We don't need to remember the sampler uniform location 31 * at link time. We don't need to remember the sampler uniform location
32 * because we will bind a texture slot to it and never change it 32 * because we will bind a texture slot to it and never change it
33 * Uniforms are program-local so we can't rely on fHWState to hold the 33 * Uniforms are program-local so we can't rely on fHWState to hold the
34 * previous uniform state after a program change. 34 * previous uniform state after a program change.
35 */ 35 */
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 } 89 }
90 }; 90 };
91 91
92 /** 92 /**
93 * This function uploads uniforms and calls each GrGLProcessor's setData. It is called before a 93 * This function uploads uniforms and calls each GrGLProcessor's setData. It is called before a
94 * draw occurs using the program after the program has already been bound. I t also uses the 94 * draw occurs using the program after the program has already been bound. I t also uses the
95 * GrGLGpu object to bind the textures required by the GrGLProcessors. The c olor and coverage 95 * GrGLGpu object to bind the textures required by the GrGLProcessors. The c olor and coverage
96 * stages come from GrGLProgramDesc::Build(). 96 * stages come from GrGLProgramDesc::Build().
97 */ 97 */
98 void setData(const GrPrimitiveProcessor&, const GrOptDrawState&, const GrBat chTracker&); 98 void setData(const GrPrimitiveProcessor&, const GrPipeline&, const GrBatchTr acker&);
99 99
100 protected: 100 protected:
101 typedef GrGLProgramDataManager::UniformHandle UniformHandle; 101 typedef GrGLProgramDataManager::UniformHandle UniformHandle;
102 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; 102 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray;
103 103
104 GrGLProgram(GrGLGpu*, 104 GrGLProgram(GrGLGpu*,
105 const GrProgramDesc&, 105 const GrProgramDesc&,
106 const BuiltinUniformHandles&, 106 const BuiltinUniformHandles&,
107 GrGLuint programID, 107 GrGLuint programID,
108 const UniformInfoArray&, 108 const UniformInfoArray&,
109 GrGLInstalledGeoProc* geometryProcessor, 109 GrGLInstalledGeoProc* geometryProcessor,
110 GrGLInstalledXferProc* xferProcessor, 110 GrGLInstalledXferProc* xferProcessor,
111 GrGLInstalledFragProcs* fragmentProcessors); 111 GrGLInstalledFragProcs* fragmentProcessors);
112 112
113 // Sets the texture units for samplers. 113 // Sets the texture units for samplers.
114 void initSamplerUniforms(); 114 void initSamplerUniforms();
115 template <class Proc> 115 template <class Proc>
116 void initSamplers(Proc*, int* texUnitIdx); 116 void initSamplers(Proc*, int* texUnitIdx);
117 117
118 // A templated helper to loop over effects, set the transforms(via subclass) and bind textures 118 // A templated helper to loop over effects, set the transforms(via subclass) and bind textures
119 void setFragmentData(const GrPrimitiveProcessor&, const GrOptDrawState&); 119 void setFragmentData(const GrPrimitiveProcessor&, const GrPipeline&);
120 virtual void setTransformData(const GrPrimitiveProcessor&, 120 virtual void setTransformData(const GrPrimitiveProcessor&,
121 const GrPendingFragmentStage&, 121 const GrPendingFragmentStage&,
122 int index, 122 int index,
123 GrGLInstalledFragProc*); 123 GrGLInstalledFragProc*);
124 template <class Proc> 124 template <class Proc>
125 void bindTextures(const Proc*, const GrProcessor&); 125 void bindTextures(const Proc*, const GrProcessor&);
126 126
127 /* 127 /*
128 * Legacy NVPR needs a hook here to flush path tex gen settings. 128 * Legacy NVPR needs a hook here to flush path tex gen settings.
129 * TODO when legacy nvpr is removed, remove this call. 129 * TODO when legacy nvpr is removed, remove this call.
130 */ 130 */
131 virtual void didSetData() {} 131 virtual void didSetData() {}
132 132
133 // Helper for setData() that sets the view matrix and loads the render targe t height uniform 133 // Helper for setData() that sets the view matrix and loads the render targe t height uniform
134 void setRenderTargetState(const GrPrimitiveProcessor&, const GrOptDrawState& ); 134 void setRenderTargetState(const GrPrimitiveProcessor&, const GrPipeline&);
135 virtual void onSetRenderTargetState(const GrPrimitiveProcessor&, const GrOpt DrawState&); 135 virtual void onSetRenderTargetState(const GrPrimitiveProcessor&, const GrPip eline&);
136 136
137 // these reflect the current values of uniforms (GL uniform values travel wi th program) 137 // these reflect the current values of uniforms (GL uniform values travel wi th program)
138 RenderTargetState fRenderTargetState; 138 RenderTargetState fRenderTargetState;
139 GrColor fColor; 139 GrColor fColor;
140 uint8_t fCoverage; 140 uint8_t fCoverage;
141 int fDstCopyTexUnit; 141 int fDstCopyTexUnit;
142 BuiltinUniformHandles fBuiltinUniformHandles; 142 BuiltinUniformHandles fBuiltinUniformHandles;
143 GrGLuint fProgramID; 143 GrGLuint fProgramID;
144 144
145 // the installed effects 145 // the installed effects
(...skipping 27 matching lines...) Expand all
173 GrGLInstalledGeoProc*, 173 GrGLInstalledGeoProc*,
174 GrGLInstalledXferProc* xferProcessor, 174 GrGLInstalledXferProc* xferProcessor,
175 GrGLInstalledFragProcs* fragmentProcessors); 175 GrGLInstalledFragProcs* fragmentProcessors);
176 176
177 private: 177 private:
178 void didSetData() SK_OVERRIDE; 178 void didSetData() SK_OVERRIDE;
179 virtual void setTransformData(const GrPrimitiveProcessor&, 179 virtual void setTransformData(const GrPrimitiveProcessor&,
180 const GrPendingFragmentStage&, 180 const GrPendingFragmentStage&,
181 int index, 181 int index,
182 GrGLInstalledFragProc*) SK_OVERRIDE; 182 GrGLInstalledFragProc*) SK_OVERRIDE;
183 virtual void onSetRenderTargetState(const GrPrimitiveProcessor&, const GrOpt DrawState&); 183 virtual void onSetRenderTargetState(const GrPrimitiveProcessor&, const GrPip eline&);
184 184
185 friend class GrGLNvprProgramBuilder; 185 friend class GrGLNvprProgramBuilder;
186 186
187 typedef GrGLProgram INHERITED; 187 typedef GrGLProgram INHERITED;
188 }; 188 };
189 189
190 #endif 190 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpuProgramCache.cpp ('k') | src/gpu/gl/GrGLProgram.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698