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

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

Issue 15252004: Make GrGLProgramDesc's key variable length by compacting the effect key array (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address comments, fix unit test Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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
(...skipping 30 matching lines...) Expand all
41 const GrEffectStage* stages[]); 41 const GrEffectStage* stages[]);
42 42
43 virtual ~GrGLProgram(); 43 virtual ~GrGLProgram();
44 44
45 /** 45 /**
46 * Call to abandon GL objects owned by this program. 46 * Call to abandon GL objects owned by this program.
47 */ 47 */
48 void abandon(); 48 void abandon();
49 49
50 /** 50 /**
51 * The shader may modify the blend coefficients. Params are in/out 51 * The shader may modify the blend coefficients. Params are in/out.
52 */ 52 */
53 void overrideBlend(GrBlendCoeff* srcCoeff, GrBlendCoeff* dstCoeff) const; 53 void overrideBlend(GrBlendCoeff* srcCoeff, GrBlendCoeff* dstCoeff) const;
54 54
55 const GrGLProgramDesc& getDesc() { return fDesc; } 55 const GrGLProgramDesc& getDesc() { return fDesc; }
56 56
57 /** 57 /**
58 * Gets the GL program ID for this program. 58 * Gets the GL program ID for this program.
59 */ 59 */
60 GrGLuint programID() const { return fProgramID; } 60 GrGLuint programID() const { return fProgramID; }
61 61
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 fRenderTargetSize.fWidth = -1; 97 fRenderTargetSize.fWidth = -1;
98 fRenderTargetSize.fHeight = -1; 98 fRenderTargetSize.fHeight = -1;
99 fRenderTargetOrigin = (GrSurfaceOrigin) -1; 99 fRenderTargetOrigin = (GrSurfaceOrigin) -1;
100 } 100 }
101 }; 101 };
102 102
103 /** 103 /**
104 * This function uploads uniforms and calls each GrGLEffect's setData. It is called before a 104 * This function uploads uniforms and calls each GrGLEffect's setData. It is called before a
105 * draw occurs using the program after the program has already been bound. I t also uses the 105 * draw occurs using the program after the program has already been bound. I t also uses the
106 * GrGpuGL object to bind the textures required by the GrGLEffects. 106 * GrGpuGL object to bind the textures required by the GrGLEffects.
107 *
108 * The color and coverage params override the GrDrawState's getColor() and g etCoverage() values.
109 */ 107 */
110 void setData(GrGpuGL*, 108 void setData(GrGpuGL*,
111 GrColor color, 109 GrDrawState::BlendOptFlags,
112 GrColor coverage, 110 const GrEffectStage* stages[], // output of GrGLProgramDe sc:Build()
113 const GrDeviceCoordTexture* dstCopy, // can be NULL 111 const GrDeviceCoordTexture* dstCopy, // can be NULL
114 SharedGLState*); 112 SharedGLState*);
115 113
116 private: 114 private:
117 GrGLProgram(const GrGLContext& gl, 115 GrGLProgram(const GrGLContext& gl,
118 const GrGLProgramDesc& desc, 116 const GrGLProgramDesc& desc,
119 const GrEffectStage* stages[]); 117 const GrEffectStage* stages[]);
120 118
121 bool succeeded() const { return 0 != fProgramID; } 119 bool succeeded() const { return 0 != fProgramID; }
122 120
123 /** 121 /**
124 * This is the heavy initialization routine for building a GLProgram. 122 * This is the heavy initialization routine for building a GLProgram. stages is all the enabled
123 * color stages followed by all the enabled coverage stages as output by
124 * GrGLProgramDesc::Build()
125 */ 125 */
126 bool genProgram(const GrEffectStage* stages[]); 126 bool genProgram(const GrEffectStage* stages[]);
127 127
128 GrSLConstantVec genInputColor(GrGLShaderBuilder* builder, SkString* inColor) ; 128 GrSLConstantVec genInputColor(GrGLShaderBuilder* builder, SkString* inColor) ;
129 129
130 GrSLConstantVec genInputCoverage(GrGLShaderBuilder* builder, SkString* inCov erage); 130 GrSLConstantVec genInputCoverage(GrGLShaderBuilder* builder, SkString* inCov erage);
131 131
132 void genGeometryShader(GrGLShaderBuilder* segments) const; 132 void genGeometryShader(GrGLShaderBuilder* segments) const;
133 133
134 typedef GrGLUniformManager::UniformHandle UniformHandle; 134 typedef GrGLUniformManager::UniformHandle UniformHandle;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 GrGLProgramDesc fDesc; 205 GrGLProgramDesc fDesc;
206 const GrGLContext& fContext; 206 const GrGLContext& fContext;
207 207
208 GrGLUniformManager fUniformManager; 208 GrGLUniformManager fUniformManager;
209 UniformHandles fUniformHandles; 209 UniformHandles fUniformHandles;
210 210
211 typedef GrRefCnt INHERITED; 211 typedef GrRefCnt INHERITED;
212 }; 212 };
213 213
214 #endif 214 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/gl/GrGLProgram.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698