blob: b4ad4af8c0ee88d9bc46001502b6061c97a090b4 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
junov@google.comf93e7172011-03-31 21:26:24 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
junov@google.comf93e7172011-03-31 21:26:24 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
junov@google.comf93e7172011-03-31 21:26:24 +000010#ifndef GrGLProgram_DEFINED
11#define GrGLProgram_DEFINED
12
tomhudson@google.com93813632011-10-27 20:21:16 +000013#include "GrDrawState.h"
junov@google.comf93e7172011-03-31 21:26:24 +000014#include "GrGLInterface.h"
tomhudson@google.com086e5352011-12-08 14:44:10 +000015#include "GrGLSL.h"
bsalomon@google.com91961302011-05-09 18:39:58 +000016#include "GrStringBuilder.h"
bsalomon@google.com271cffc2011-05-20 14:13:56 +000017#include "GrGpu.h"
junov@google.comf93e7172011-03-31 21:26:24 +000018
Scroggo97c88c22011-05-11 14:05:25 +000019#include "SkXfermode.h"
20
junov@google.comf93e7172011-03-31 21:26:24 +000021class GrBinHashKeyBuilder;
junov@google.comd31cbc42011-05-17 17:01:17 +000022
bsalomon@google.com4fa66942011-09-20 19:06:12 +000023struct ShaderCodeSegments;
junov@google.comf93e7172011-03-31 21:26:24 +000024
bsalomon@google.comedfe1aa2011-09-29 14:40:26 +000025// optionally compile the experimental GS code. Set to GR_DEBUG
26// so that debug build bots will execute the code.
27#define GR_GL_EXPERIMENTAL_GS GR_DEBUG
28
junov@google.comf93e7172011-03-31 21:26:24 +000029/**
30 * This class manages a GPU program and records per-program information.
31 * We can specify the attribute locations so that they are constant
32 * across our shaders. But the driver determines the uniform locations
33 * at link time. We don't need to remember the sampler uniform location
34 * because we will bind a texture slot to it and never change it
35 * Uniforms are program-local so we can't rely on fHWState to hold the
36 * previous uniform state after a program change.
37 */
38class GrGLProgram {
39public:
bsalomon@google.com4fa66942011-09-20 19:06:12 +000040
junov@google.comf93e7172011-03-31 21:26:24 +000041 class CachedData;
42
43 GrGLProgram();
44 ~GrGLProgram();
45
46 /**
junov@google.comf93e7172011-03-31 21:26:24 +000047 * This is the heavy initilization routine for building a GLProgram.
48 * The result of heavy init is not stored in datamembers of GrGLProgam,
49 * but in a separate cacheable container.
50 */
bsalomon@google.com0b77d682011-08-19 13:28:54 +000051 bool genProgram(const GrGLInterface* gl,
tomhudson@google.com086e5352011-12-08 14:44:10 +000052 GrGLSLGeneration glslVersion,
bsalomon@google.com0b77d682011-08-19 13:28:54 +000053 CachedData* programData) const;
junov@google.comf93e7172011-03-31 21:26:24 +000054
bsalomon@google.com271cffc2011-05-20 14:13:56 +000055 /**
56 * The shader may modify the blend coeffecients. Params are in/out
57 */
58 void overrideBlend(GrBlendCoeff* srcCoeff, GrBlendCoeff* dstCoeff) const;
59
60 /**
bsalomon@google.comb5b5eaf2011-10-19 13:25:46 +000061 * Attribute indices. These should not overlap. Matrices consume 3 slots.
bsalomon@google.com271cffc2011-05-20 14:13:56 +000062 */
bsalomon@google.com91961302011-05-09 18:39:58 +000063 static int PositionAttributeIdx() { return 0; }
64 static int TexCoordAttributeIdx(int tcIdx) { return 1 + tcIdx; }
tomhudson@google.com93813632011-10-27 20:21:16 +000065 static int ColorAttributeIdx() { return 1 + GrDrawState::kMaxTexCoords; }
bsalomon@google.coma3108262011-10-10 14:08:47 +000066 static int CoverageAttributeIdx() {
tomhudson@google.com93813632011-10-27 20:21:16 +000067 return 2 + GrDrawState::kMaxTexCoords;
bsalomon@google.coma3108262011-10-10 14:08:47 +000068 }
tomhudson@google.com93813632011-10-27 20:21:16 +000069 static int EdgeAttributeIdx() { return 3 + GrDrawState::kMaxTexCoords; }
bsalomon@google.comaeb21602011-08-30 18:13:44 +000070
tomhudson@google.com0d831722011-06-02 15:37:14 +000071 static int ViewMatrixAttributeIdx() {
tomhudson@google.com93813632011-10-27 20:21:16 +000072 return 4 + GrDrawState::kMaxTexCoords;
bsalomon@google.com91961302011-05-09 18:39:58 +000073 }
tomhudson@google.com0d831722011-06-02 15:37:14 +000074 static int TextureMatrixAttributeIdx(int stage) {
tomhudson@google.com93813632011-10-27 20:21:16 +000075 return 7 + GrDrawState::kMaxTexCoords + 3 * stage;
bsalomon@google.com91961302011-05-09 18:39:58 +000076 }
77
tomhudson@google.com2a2e3ef2011-10-25 19:51:09 +000078public:
junov@google.comf93e7172011-03-31 21:26:24 +000079
tomhudson@google.com0d831722011-06-02 15:37:14 +000080 // Parameters that affect code generation
81 // These structs should be kept compact; they are the input to an
82 // expensive hash key generator.
junov@google.comf93e7172011-03-31 21:26:24 +000083 struct ProgramDesc {
bsalomon@google.com4be283f2011-04-19 21:15:09 +000084 ProgramDesc() {
85 // since we use this as part of a key we can't have any unitialized
86 // padding
87 memset(this, 0, sizeof(ProgramDesc));
88 }
89
bsalomon@google.comc4364992011-11-07 15:54:49 +000090 enum OutputPM {
91 // PM-color OR color with no alpha channel
92 kYes_OutputPM,
93 // nonPM-color with alpha channel
94 kNo_OutputPM,
95
96 kOutputPMCnt
97 };
98
tomhudson@google.com0d831722011-06-02 15:37:14 +000099 struct StageDesc {
100 enum OptFlagBits {
101 kNoPerspective_OptFlagBit = 1 << 0,
102 kIdentityMatrix_OptFlagBit = 1 << 1,
103 kCustomTextureDomain_OptFlagBit = 1 << 2,
104 kIsEnabled_OptFlagBit = 1 << 7
105 };
tomhudson@google.com0d831722011-06-02 15:37:14 +0000106 enum FetchMode {
107 kSingle_FetchMode,
bsalomon@google.com1e257a52011-07-06 19:52:16 +0000108 k2x2_FetchMode,
senorblanco@chromium.org027de5f2011-07-08 18:03:33 +0000109 kConvolution_FetchMode,
bsalomon@google.com1e257a52011-07-06 19:52:16 +0000110
111 kFetchModeCnt,
tomhudson@google.com0d831722011-06-02 15:37:14 +0000112 };
bsalomon@google.com0a97be22011-11-08 19:20:57 +0000113 /**
bsalomon@google.com74b98712011-11-11 19:46:16 +0000114 Flags set based on a src texture's pixel config. The operations
115 described are performed after reading a texel.
bsalomon@google.com0a97be22011-11-08 19:20:57 +0000116 */
bsalomon@google.com74b98712011-11-11 19:46:16 +0000117 enum InConfigFlags {
118 kNone_InConfigFlag = 0x0,
119
bsalomon@google.com85b505b2011-11-07 14:56:51 +0000120 /**
bsalomon@google.com74b98712011-11-11 19:46:16 +0000121 Swap the R and B channels. This is incompatible with
122 kSmearAlpha. It is prefereable to perform the swizzle outside
123 the shader using GL_ARB_texture_swizzle if possible rather
124 than setting this flag.
bsalomon@google.com85b505b2011-11-07 14:56:51 +0000125 */
bsalomon@google.com74b98712011-11-11 19:46:16 +0000126 kSwapRAndB_InConfigFlag = 0x1,
127
bsalomon@google.com85b505b2011-11-07 14:56:51 +0000128 /**
bsalomon@google.com74b98712011-11-11 19:46:16 +0000129 Smear alpha across all four channels. This is incompatible with
130 kSwapRAndB and kPremul. It is prefereable to perform the
131 smear outside the shader using GL_ARB_texture_swizzle if
132 possible rather than setting this flag.
bsalomon@google.com85b505b2011-11-07 14:56:51 +0000133 */
bsalomon@google.com74b98712011-11-11 19:46:16 +0000134 kSmearAlpha_InConfigFlag = 0x2,
135
136 /**
137 Multiply r,g,b by a after texture reads. This flag incompatible
138 with kSmearAlpha and may only be used with FetchMode kSingle.
139 */
140 kMulRGBByAlpha_InConfigFlag = 0x4,
141
142 kDummyInConfigFlag,
143 kInConfigBitMask = (kDummyInConfigFlag-1) |
144 (kDummyInConfigFlag-2)
bsalomon@google.com85b505b2011-11-07 14:56:51 +0000145 };
tomhudson@google.com0d831722011-06-02 15:37:14 +0000146 enum CoordMapping {
147 kIdentity_CoordMapping,
148 kRadialGradient_CoordMapping,
149 kSweepGradient_CoordMapping,
bsalomon@google.com1e257a52011-07-06 19:52:16 +0000150 kRadial2Gradient_CoordMapping,
bsalomon@google.com22c5dea2011-07-07 14:38:03 +0000151 // need different shader computation when quadratic
152 // eq describing the gradient degenerates to a linear eq.
153 kRadial2GradientDegenerate_CoordMapping,
bsalomon@google.com1e257a52011-07-06 19:52:16 +0000154 kCoordMappingCnt
tomhudson@google.com0d831722011-06-02 15:37:14 +0000155 };
junov@google.comf93e7172011-03-31 21:26:24 +0000156
tomhudson@google.com0d831722011-06-02 15:37:14 +0000157 uint8_t fOptFlags;
bsalomon@google.com74b98712011-11-11 19:46:16 +0000158 uint8_t fInConfigFlags; // bitfield of InConfigFlags values
bsalomon@google.com85b505b2011-11-07 14:56:51 +0000159 uint8_t fFetchMode; // casts to enum FetchMode
tomhudson@google.com0d831722011-06-02 15:37:14 +0000160 uint8_t fCoordMapping; // casts to enum CoordMapping
senorblanco@chromium.org027de5f2011-07-08 18:03:33 +0000161 uint8_t fKernelWidth;
tomhudson@google.com0d831722011-06-02 15:37:14 +0000162
bsalomon@google.com74b98712011-11-11 19:46:16 +0000163 GR_STATIC_ASSERT((InConfigFlags)(uint8_t)kInConfigBitMask ==
164 kInConfigBitMask);
165
tomhudson@google.com0d831722011-06-02 15:37:14 +0000166 inline bool isEnabled() const {
bsalomon@google.comc2c9b972011-10-03 13:17:22 +0000167 return SkToBool(fOptFlags & kIsEnabled_OptFlagBit);
tomhudson@google.com0d831722011-06-02 15:37:14 +0000168 }
169 inline void setEnabled(bool newValue) {
170 if (newValue) {
171 fOptFlags |= kIsEnabled_OptFlagBit;
172 } else {
173 fOptFlags &= ~kIsEnabled_OptFlagBit;
174 }
175 }
176 };
177
bsalomon@google.com86c1f712011-10-12 14:54:26 +0000178 // Specifies where the intitial color comes from before the stages are
179 // applied.
bsalomon@google.com85b505b2011-11-07 14:56:51 +0000180 enum ColorInput {
181 kSolidWhite_ColorInput,
182 kTransBlack_ColorInput,
183 kAttribute_ColorInput,
184 kUniform_ColorInput,
bsalomon@google.com86c1f712011-10-12 14:54:26 +0000185
bsalomon@google.com85b505b2011-11-07 14:56:51 +0000186 kColorInputCnt
tomhudson@google.com0d831722011-06-02 15:37:14 +0000187 };
188 // Dual-src blending makes use of a secondary output color that can be
bsalomon@google.com271cffc2011-05-20 14:13:56 +0000189 // used as a per-pixel blend coeffecient. This controls whether a
190 // secondary source is output and what value it holds.
191 enum DualSrcOutput {
192 kNone_DualSrcOutput,
193 kCoverage_DualSrcOutput,
194 kCoverageISA_DualSrcOutput,
195 kCoverageISC_DualSrcOutput,
bsalomon@google.com1e257a52011-07-06 19:52:16 +0000196
bsalomon@google.com271cffc2011-05-20 14:13:56 +0000197 kDualSrcOutputCnt
tomhudson@google.com0d831722011-06-02 15:37:14 +0000198 };
bsalomon@google.com271cffc2011-05-20 14:13:56 +0000199
tomhudson@google.com93813632011-10-27 20:21:16 +0000200 GrDrawState::VertexEdgeType fVertexEdgeType;
bsalomon@google.comaeb21602011-08-30 18:13:44 +0000201
tomhudson@google.com0d831722011-06-02 15:37:14 +0000202 // stripped of bits that don't affect prog generation
203 GrVertexLayout fVertexLayout;
junov@google.comf93e7172011-03-31 21:26:24 +0000204
tomhudson@google.com93813632011-10-27 20:21:16 +0000205 StageDesc fStages[GrDrawState::kNumStages];
Scroggo97c88c22011-05-11 14:05:25 +0000206
bsalomon@google.comedfe1aa2011-09-29 14:40:26 +0000207 // To enable experimental geometry shader code (not for use in
208 // production)
209#if GR_GL_EXPERIMENTAL_GS
210 bool fExperimentalGS;
211#endif
212
bsalomon@google.com85b505b2011-11-07 14:56:51 +0000213 uint8_t fColorInput; // casts to enum ColorInput
bsalomon@google.comc4364992011-11-07 15:54:49 +0000214 uint8_t fOutputPM; // cases to enum OutputPM
bsalomon@google.com85b505b2011-11-07 14:56:51 +0000215 uint8_t fDualSrcOutput; // casts to enum DualSrcOutput
tomhudson@google.com0d831722011-06-02 15:37:14 +0000216 int8_t fFirstCoverageStage;
217 SkBool8 fEmitsPointSize;
senorblanco@chromium.org129b8e32011-06-15 17:52:09 +0000218 SkBool8 fEdgeAAConcave;
senorblanco@chromium.org50bdad82012-01-03 20:51:57 +0000219 SkBool8 fColorMatrixEnabled;
junov@google.comf93e7172011-03-31 21:26:24 +0000220
tomhudson@google.com0d831722011-06-02 15:37:14 +0000221 int8_t fEdgeAANumEdges;
222 uint8_t fColorFilterXfermode; // casts to enum SkXfermode::Mode
senorblanco@chromium.org50bdad82012-01-03 20:51:57 +0000223 int8_t fPadding[3];
junov@google.comf93e7172011-03-31 21:26:24 +0000224
junov@google.comf93e7172011-03-31 21:26:24 +0000225 } fProgramDesc;
bsalomon@google.comedfe1aa2011-09-29 14:40:26 +0000226 GR_STATIC_ASSERT(!(sizeof(ProgramDesc) % 4));
junov@google.comf93e7172011-03-31 21:26:24 +0000227
bsalomon@google.com22c5dea2011-07-07 14:38:03 +0000228 // for code readability
229 typedef ProgramDesc::StageDesc StageDesc;
230
tomhudson@google.com2a2e3ef2011-10-25 19:51:09 +0000231private:
232
233 const ProgramDesc& getDesc() { return fProgramDesc; }
senorblanco@chromium.orgb3a39b52012-01-05 18:28:56 +0000234 const char* adjustInColor(const GrStringBuilder& inColor) const;
tomhudson@google.com2a2e3ef2011-10-25 19:51:09 +0000235
junov@google.comf93e7172011-03-31 21:26:24 +0000236public:
bsalomon@google.com91961302011-05-09 18:39:58 +0000237 enum {
238 kUnusedUniform = -1,
239 kSetAsAttribute = 1000,
240 };
241
junov@google.comf93e7172011-03-31 21:26:24 +0000242 struct StageUniLocations {
243 GrGLint fTextureMatrixUni;
bsalomon@google.com6aef1fb2011-05-05 12:33:22 +0000244 GrGLint fNormalizedTexelSizeUni;
junov@google.comf93e7172011-03-31 21:26:24 +0000245 GrGLint fSamplerUni;
246 GrGLint fRadial2Uni;
junov@google.com6acc9b32011-05-16 18:32:07 +0000247 GrGLint fTexDomUni;
senorblanco@chromium.org027de5f2011-07-08 18:03:33 +0000248 GrGLint fKernelUni;
249 GrGLint fImageIncrementUni;
bsalomon@google.com91961302011-05-09 18:39:58 +0000250 void reset() {
251 fTextureMatrixUni = kUnusedUniform;
252 fNormalizedTexelSizeUni = kUnusedUniform;
253 fSamplerUni = kUnusedUniform;
254 fRadial2Uni = kUnusedUniform;
junov@google.com6acc9b32011-05-16 18:32:07 +0000255 fTexDomUni = kUnusedUniform;
senorblanco@chromium.org027de5f2011-07-08 18:03:33 +0000256 fKernelUni = kUnusedUniform;
257 fImageIncrementUni = kUnusedUniform;
bsalomon@google.com91961302011-05-09 18:39:58 +0000258 }
junov@google.comf93e7172011-03-31 21:26:24 +0000259 };
260
261 struct UniLocations {
262 GrGLint fViewMatrixUni;
bsalomon@google.com4be283f2011-04-19 21:15:09 +0000263 GrGLint fColorUni;
senorblanco@chromium.org92e0f222011-05-12 15:49:15 +0000264 GrGLint fEdgesUni;
Scroggo97c88c22011-05-11 14:05:25 +0000265 GrGLint fColorFilterUni;
senorblanco@chromium.org50bdad82012-01-03 20:51:57 +0000266 GrGLint fColorMatrixUni;
267 GrGLint fColorMatrixVecUni;
tomhudson@google.com93813632011-10-27 20:21:16 +0000268 StageUniLocations fStages[GrDrawState::kNumStages];
bsalomon@google.com91961302011-05-09 18:39:58 +0000269 void reset() {
270 fViewMatrixUni = kUnusedUniform;
271 fColorUni = kUnusedUniform;
senorblanco@chromium.org92e0f222011-05-12 15:49:15 +0000272 fEdgesUni = kUnusedUniform;
Scroggo97c88c22011-05-11 14:05:25 +0000273 fColorFilterUni = kUnusedUniform;
senorblanco@chromium.org50bdad82012-01-03 20:51:57 +0000274 fColorMatrixUni = kUnusedUniform;
275 fColorMatrixVecUni = kUnusedUniform;
tomhudson@google.com93813632011-10-27 20:21:16 +0000276 for (int s = 0; s < GrDrawState::kNumStages; ++s) {
bsalomon@google.com91961302011-05-09 18:39:58 +0000277 fStages[s].reset();
278 }
279 }
junov@google.comf93e7172011-03-31 21:26:24 +0000280 };
281
282 class CachedData : public ::GrNoncopyable {
283 public:
284 CachedData() {
junov@google.comf93e7172011-03-31 21:26:24 +0000285 }
286
287 ~CachedData() {
junov@google.comf93e7172011-03-31 21:26:24 +0000288 }
289
290 void copyAndTakeOwnership(CachedData& other) {
bsalomon@google.com2d9ddf92011-05-11 16:52:59 +0000291 memcpy(this, &other, sizeof(*this));
junov@google.comf93e7172011-03-31 21:26:24 +0000292 }
293
junov@google.comf93e7172011-03-31 21:26:24 +0000294 public:
295
296 // IDs
297 GrGLuint fVShaderID;
bsalomon@google.comedfe1aa2011-09-29 14:40:26 +0000298 GrGLuint fGShaderID;
junov@google.comf93e7172011-03-31 21:26:24 +0000299 GrGLuint fFShaderID;
300 GrGLuint fProgramID;
301 // shader uniform locations (-1 if shader doesn't use them)
302 UniLocations fUniLocations;
303
304 GrMatrix fViewMatrix;
305
306 // these reflect the current values of uniforms
307 // (GL uniform values travel with program)
bsalomon@google.com4be283f2011-04-19 21:15:09 +0000308 GrColor fColor;
Scroggo97c88c22011-05-11 14:05:25 +0000309 GrColor fColorFilterColor;
tomhudson@google.com93813632011-10-27 20:21:16 +0000310 GrMatrix fTextureMatrices[GrDrawState::kNumStages];
bsalomon@google.com6aef1fb2011-05-05 12:33:22 +0000311 // width and height used for normalized texel size
tomhudson@google.com93813632011-10-27 20:21:16 +0000312 int fTextureWidth[GrDrawState::kNumStages];
313 int fTextureHeight[GrDrawState::kNumStages];
314 GrScalar fRadial2CenterX1[GrDrawState::kNumStages];
315 GrScalar fRadial2Radius0[GrDrawState::kNumStages];
316 bool fRadial2PosRoot[GrDrawState::kNumStages];
317 GrRect fTextureDomain[GrDrawState::kNumStages];
junov@google.comf93e7172011-03-31 21:26:24 +0000318
319 private:
320 enum Constants {
321 kUniLocationPreAllocSize = 8
322 };
323
junov@google.comf93e7172011-03-31 21:26:24 +0000324 }; // CachedData
325
junov@google.comf7c00f62011-08-18 18:15:16 +0000326 enum Constants {
327 kProgramKeySize = sizeof(ProgramDesc)
328 };
329
330 // Provide an opaque ProgramDesc
331 const uint32_t* keyData() const{
332 return reinterpret_cast<const uint32_t*>(&fProgramDesc);
333 }
334
junov@google.comf93e7172011-03-31 21:26:24 +0000335private:
bsalomon@google.com91961302011-05-09 18:39:58 +0000336
tomhudson@google.com2a2e3ef2011-10-25 19:51:09 +0000337 // Determines which uniforms will need to be bound.
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000338 void genStageCode(const GrGLInterface* gl,
339 int stageNum,
junov@google.comf93e7172011-03-31 21:26:24 +0000340 const ProgramDesc::StageDesc& desc,
341 const char* fsInColor, // NULL means no incoming color
342 const char* fsOutColor,
343 const char* vsInCoord,
344 ShaderCodeSegments* segments,
345 StageUniLocations* locations) const;
bsalomon@google.com4fa66942011-09-20 19:06:12 +0000346
bsalomon@google.comedfe1aa2011-09-29 14:40:26 +0000347 void genGeometryShader(const GrGLInterface* gl,
tomhudson@google.com086e5352011-12-08 14:44:10 +0000348 GrGLSLGeneration glslVersion,
bsalomon@google.comedfe1aa2011-09-29 14:40:26 +0000349 ShaderCodeSegments* segments) const;
350
bsalomon@google.com66105672011-09-15 15:12:00 +0000351 // generates code to compute coverage based on edge AA.
352 void genEdgeCoverage(const GrGLInterface* gl,
353 GrVertexLayout layout,
354 CachedData* programData,
355 GrStringBuilder* coverageVar,
356 ShaderCodeSegments* segments) const;
junov@google.comf93e7172011-03-31 21:26:24 +0000357
bsalomon@google.comedfe1aa2011-09-29 14:40:26 +0000358 static bool CompileShaders(const GrGLInterface* gl,
tomhudson@google.com086e5352011-12-08 14:44:10 +0000359 GrGLSLGeneration glslVersion,
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000360 const ShaderCodeSegments& segments,
bsalomon@google.com91961302011-05-09 18:39:58 +0000361 CachedData* programData);
362
junov@google.comf93e7172011-03-31 21:26:24 +0000363 // Compiles a GL shader, returns shader ID or 0 if failed
364 // params have same meaning as glShaderSource
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000365 static GrGLuint CompileShader(const GrGLInterface* gl,
366 GrGLenum type, int stringCnt,
junov@google.comf93e7172011-03-31 21:26:24 +0000367 const char** strings,
368 int* stringLengths);
369
bsalomon@google.com91961302011-05-09 18:39:58 +0000370 // Creates a GL program ID, binds shader attributes to GL vertex attrs, and
371 // links the program
bsalomon@google.com271cffc2011-05-20 14:13:56 +0000372 bool bindOutputsAttribsAndLinkProgram(
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000373 const GrGLInterface* gl,
tomhudson@google.com93813632011-10-27 20:21:16 +0000374 GrStringBuilder texCoordAttrNames[GrDrawState::kMaxTexCoords],
bsalomon@google.com271cffc2011-05-20 14:13:56 +0000375 bool bindColorOut,
376 bool bindDualSrcOut,
377 CachedData* programData) const;
bsalomon@google.com91961302011-05-09 18:39:58 +0000378
tomhudson@google.com2a2e3ef2011-10-25 19:51:09 +0000379 // Binds uniforms; initializes cache to invalid values.
bsalomon@google.com0b77d682011-08-19 13:28:54 +0000380 void getUniformLocationsAndInitCache(const GrGLInterface* gl,
381 CachedData* programData) const;
bsalomon@google.com91961302011-05-09 18:39:58 +0000382
junov@google.comf93e7172011-03-31 21:26:24 +0000383 friend class GrGpuGLShaders;
384};
385
386#endif