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/gl/GrGLProgram.h

Issue 491673002: Initial refactor of shaderbuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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/gl/GrGLEffect.h ('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 "GrDrawState.h" 13 #include "GrDrawState.h"
13 #include "GrGLContext.h" 14 #include "GrGLContext.h"
14 #include "GrGLProgramDesc.h" 15 #include "GrGLProgramDesc.h"
15 #include "GrGLShaderBuilder.h"
16 #include "GrGLSL.h" 16 #include "GrGLSL.h"
17 #include "GrGLTexture.h" 17 #include "GrGLTexture.h"
18 #include "GrGLProgramDataManager.h" 18 #include "GrGLProgramDataManager.h"
19 19
20 #include "SkString.h" 20 #include "SkString.h"
21 #include "SkXfermode.h" 21 #include "SkXfermode.h"
22 22
23 class GrGLEffect; 23 class GrGLEffect;
24 class GrGLProgramEffects; 24 class GrGLProgramEffects;
25 class GrGLShaderBuilder; 25 class GrGLProgramBuilder;
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 */
36 class GrGLProgram : public SkRefCnt { 36 class GrGLProgram : public SkRefCnt {
37 public: 37 public:
38 SK_DECLARE_INST_COUNT(GrGLProgram) 38 SK_DECLARE_INST_COUNT(GrGLProgram)
39 39
40 typedef GrGLShaderBuilder::BuiltinUniformHandles BuiltinUniformHandles; 40 typedef GrGLProgramBuilder::BuiltinUniformHandles BuiltinUniformHandles;
41 41
42 static GrGLProgram* Create(GrGpuGL* gpu, 42 static GrGLProgram* Create(GrGpuGL* gpu,
43 const GrGLProgramDesc& desc, 43 const GrGLProgramDesc& desc,
44 const GrEffectStage* colorStages[], 44 const GrEffectStage* colorStages[],
45 const GrEffectStage* coverageStages[]); 45 const GrEffectStage* coverageStages[]);
46 46
47 virtual ~GrGLProgram(); 47 virtual ~GrGLProgram();
48 48
49 /** 49 /**
50 * Call to abandon GL objects owned by this program. 50 * Call to abandon GL objects owned by this program.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 const GrEffectStage* colorStages[], 160 const GrEffectStage* colorStages[],
161 const GrEffectStage* coverageStages[], 161 const GrEffectStage* coverageStages[],
162 const GrDeviceCoordTexture* dstCopy, // can be NULL 162 const GrDeviceCoordTexture* dstCopy, // can be NULL
163 SharedGLState*); 163 SharedGLState*);
164 164
165 private: 165 private:
166 typedef GrGLProgramDataManager::UniformHandle UniformHandle; 166 typedef GrGLProgramDataManager::UniformHandle UniformHandle;
167 167
168 GrGLProgram(GrGpuGL*, 168 GrGLProgram(GrGpuGL*,
169 const GrGLProgramDesc&, 169 const GrGLProgramDesc&,
170 const GrGLShaderBuilder&); 170 const GrGLProgramBuilder&);
171 171
172 // Sets the texture units for samplers. 172 // Sets the texture units for samplers.
173 void initSamplerUniforms(); 173 void initSamplerUniforms();
174 174
175 // Helper for setData(). Makes GL calls to specify the initial color when th ere is not 175 // Helper for setData(). Makes GL calls to specify the initial color when th ere is not
176 // per-vertex colors. 176 // per-vertex colors.
177 void setColor(const GrDrawState&, GrColor color, SharedGLState*); 177 void setColor(const GrDrawState&, GrColor color, SharedGLState*);
178 178
179 // Helper for setData(). Makes GL calls to specify the initial coverage when there is not 179 // Helper for setData(). Makes GL calls to specify the initial coverage when there is not
180 // per-vertex coverages. 180 // per-vertex coverages.
(...skipping 17 matching lines...) Expand all
198 198
199 GrGLProgramDesc fDesc; 199 GrGLProgramDesc fDesc;
200 GrGpuGL* fGpu; 200 GrGpuGL* fGpu;
201 201
202 GrGLProgramDataManager fProgramDataManager; 202 GrGLProgramDataManager fProgramDataManager;
203 203
204 typedef SkRefCnt INHERITED; 204 typedef SkRefCnt INHERITED;
205 }; 205 };
206 206
207 #endif 207 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLEffect.h ('k') | src/gpu/gl/GrGLProgram.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698