junov@google.com | f93e717 | 2011-03-31 21:26:24 +0000 | [diff] [blame] | 1 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
junov@google.com | f93e717 | 2011-03-31 21:26:24 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 8 | |
junov@google.com | f93e717 | 2011-03-31 21:26:24 +0000 | [diff] [blame] | 9 | #ifndef GrGLProgram_DEFINED |
| 10 | #define GrGLProgram_DEFINED |
| 11 | |
joshualitt | 30ba436 | 2014-08-21 20:18:45 -0700 | [diff] [blame] | 12 | #include "builders/GrGLProgramBuilder.h" |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 13 | #include "builders/GrGLNvprProgramBuilder.h" |
tomhudson@google.com | d8f856c | 2012-05-10 12:13:36 +0000 | [diff] [blame] | 14 | #include "GrDrawState.h" |
robertphillips@google.com | 6177e69 | 2013-02-28 20:16:25 +0000 | [diff] [blame] | 15 | #include "GrGLContext.h" |
bsalomon@google.com | 31ec798 | 2013-03-27 18:14:57 +0000 | [diff] [blame] | 16 | #include "GrGLProgramDesc.h" |
tomhudson@google.com | 086e535 | 2011-12-08 14:44:10 +0000 | [diff] [blame] | 17 | #include "GrGLSL.h" |
bsalomon@google.com | 890e3b5 | 2012-06-01 19:01:37 +0000 | [diff] [blame] | 18 | #include "GrGLTexture.h" |
kkinnunen | 7510b22 | 2014-07-30 00:04:16 -0700 | [diff] [blame] | 19 | #include "GrGLProgramDataManager.h" |
junov@google.com | f93e717 | 2011-03-31 21:26:24 +0000 | [diff] [blame] | 20 | |
bsalomon@google.com | f0a104e | 2012-07-10 17:51:07 +0000 | [diff] [blame] | 21 | #include "SkString.h" |
Scroggo | 97c88c2 | 2011-05-11 14:05:25 +0000 | [diff] [blame] | 22 | #include "SkXfermode.h" |
| 23 | |
joshualitt | b0a8a37 | 2014-09-23 09:50:21 -0700 | [diff] [blame] | 24 | class GrGLProcessor; |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 25 | class GrGLInstalledProcessors; |
joshualitt | 30ba436 | 2014-08-21 20:18:45 -0700 | [diff] [blame] | 26 | class GrGLProgramBuilder; |
junov@google.com | f93e717 | 2011-03-31 21:26:24 +0000 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * This class manages a GPU program and records per-program information. |
| 30 | * We can specify the attribute locations so that they are constant |
| 31 | * across our shaders. But the driver determines the uniform locations |
| 32 | * at link time. We don't need to remember the sampler uniform location |
| 33 | * because we will bind a texture slot to it and never change it |
| 34 | * Uniforms are program-local so we can't rely on fHWState to hold the |
| 35 | * previous uniform state after a program change. |
| 36 | */ |
commit-bot@chromium.org | a4de8c2 | 2013-09-09 13:38:37 +0000 | [diff] [blame] | 37 | class GrGLProgram : public SkRefCnt { |
junov@google.com | f93e717 | 2011-03-31 21:26:24 +0000 | [diff] [blame] | 38 | public: |
bsalomon@google.com | 9ba4fa6 | 2012-07-16 17:36:28 +0000 | [diff] [blame] | 39 | SK_DECLARE_INST_COUNT(GrGLProgram) |
bsalomon@google.com | 4fa6694 | 2011-09-20 19:06:12 +0000 | [diff] [blame] | 40 | |
joshualitt | 30ba436 | 2014-08-21 20:18:45 -0700 | [diff] [blame] | 41 | typedef GrGLProgramBuilder::BuiltinUniformHandles BuiltinUniformHandles; |
kkinnunen | dddc18a | 2014-08-03 23:19:46 -0700 | [diff] [blame] | 42 | |
bsalomon@google.com | 9ba4fa6 | 2012-07-16 17:36:28 +0000 | [diff] [blame] | 43 | virtual ~GrGLProgram(); |
junov@google.com | f93e717 | 2011-03-31 21:26:24 +0000 | [diff] [blame] | 44 | |
bsalomon@google.com | 34cccde | 2013-01-04 18:34:30 +0000 | [diff] [blame] | 45 | /** |
| 46 | * Call to abandon GL objects owned by this program. |
| 47 | */ |
bsalomon@google.com | ecb60aa | 2012-07-18 13:20:29 +0000 | [diff] [blame] | 48 | void abandon(); |
| 49 | |
bsalomon@google.com | 31ec798 | 2013-03-27 18:14:57 +0000 | [diff] [blame] | 50 | const GrGLProgramDesc& getDesc() { return fDesc; } |
bsalomon@google.com | 9ba4fa6 | 2012-07-16 17:36:28 +0000 | [diff] [blame] | 51 | |
bsalomon@google.com | 271cffc | 2011-05-20 14:13:56 +0000 | [diff] [blame] | 52 | /** |
bsalomon@google.com | 6a51dcb | 2013-02-13 16:03:51 +0000 | [diff] [blame] | 53 | * Gets the GL program ID for this program. |
| 54 | */ |
kkinnunen | dddc18a | 2014-08-03 23:19:46 -0700 | [diff] [blame] | 55 | GrGLuint programID() const { return fProgramID; } |
bsalomon@google.com | 6a51dcb | 2013-02-13 16:03:51 +0000 | [diff] [blame] | 56 | |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 57 | /* |
| 58 | * The base class always has a vertex shader, only the NVPR variants may omit a vertex shader |
| 59 | */ |
| 60 | virtual bool hasVertexShader() const { return true; } |
commit-bot@chromium.org | 6b30e45 | 2013-10-04 20:02:53 +0000 | [diff] [blame] | 61 | |
bsalomon@google.com | 6a51dcb | 2013-02-13 16:03:51 +0000 | [diff] [blame] | 62 | /** |
jvanverth@google.com | 054ae99 | 2013-04-01 20:06:51 +0000 | [diff] [blame] | 63 | * Some GL state that is relevant to programs is not stored per-program. In particular color |
skia.committer@gmail.com | 05a2ee0 | 2013-04-02 07:01:34 +0000 | [diff] [blame] | 64 | * and coverage attributes can be global state. This struct is read and updated by |
| 65 | * GrGLProgram::setColor and GrGLProgram::setCoverage to allow us to avoid setting this state |
jvanverth@google.com | 054ae99 | 2013-04-01 20:06:51 +0000 | [diff] [blame] | 66 | * redundantly. |
bsalomon@google.com | 9120748 | 2013-02-12 21:45:24 +0000 | [diff] [blame] | 67 | */ |
| 68 | struct SharedGLState { |
| 69 | GrColor fConstAttribColor; |
jvanverth@google.com | 054ae99 | 2013-04-01 20:06:51 +0000 | [diff] [blame] | 70 | int fConstAttribColorIndex; |
bsalomon@google.com | 9120748 | 2013-02-12 21:45:24 +0000 | [diff] [blame] | 71 | GrColor fConstAttribCoverage; |
jvanverth@google.com | 054ae99 | 2013-04-01 20:06:51 +0000 | [diff] [blame] | 72 | int fConstAttribCoverageIndex; |
bsalomon@google.com | 9120748 | 2013-02-12 21:45:24 +0000 | [diff] [blame] | 73 | |
| 74 | SharedGLState() { this->invalidate(); } |
| 75 | void invalidate() { |
| 76 | fConstAttribColor = GrColor_ILLEGAL; |
jvanverth@google.com | 054ae99 | 2013-04-01 20:06:51 +0000 | [diff] [blame] | 77 | fConstAttribColorIndex = -1; |
bsalomon@google.com | 9120748 | 2013-02-12 21:45:24 +0000 | [diff] [blame] | 78 | fConstAttribCoverage = GrColor_ILLEGAL; |
jvanverth@google.com | 054ae99 | 2013-04-01 20:06:51 +0000 | [diff] [blame] | 79 | fConstAttribCoverageIndex = -1; |
bsalomon@google.com | 9120748 | 2013-02-12 21:45:24 +0000 | [diff] [blame] | 80 | } |
| 81 | }; |
| 82 | |
| 83 | /** |
bsalomon@google.com | 6a51dcb | 2013-02-13 16:03:51 +0000 | [diff] [blame] | 84 | * The GrDrawState's view matrix along with the aspects of the render target determine the |
| 85 | * matrix sent to GL. The size of the render target affects the GL matrix because we must |
| 86 | * convert from Skia device coords to GL's normalized coords. Also the origin of the render |
| 87 | * target may require us to perform a mirror-flip. |
| 88 | */ |
| 89 | struct MatrixState { |
| 90 | SkMatrix fViewMatrix; |
| 91 | SkISize fRenderTargetSize; |
| 92 | GrSurfaceOrigin fRenderTargetOrigin; |
| 93 | |
| 94 | MatrixState() { this->invalidate(); } |
| 95 | void invalidate() { |
| 96 | fViewMatrix = SkMatrix::InvalidMatrix(); |
bsalomon@google.com | 45a412e | 2013-02-13 16:13:13 +0000 | [diff] [blame] | 97 | fRenderTargetSize.fWidth = -1; |
| 98 | fRenderTargetSize.fHeight = -1; |
bsalomon@google.com | 6a51dcb | 2013-02-13 16:03:51 +0000 | [diff] [blame] | 99 | fRenderTargetOrigin = (GrSurfaceOrigin) -1; |
| 100 | } |
commit-bot@chromium.org | 47c66dd | 2014-05-29 01:12:10 +0000 | [diff] [blame] | 101 | |
| 102 | /** |
| 103 | * Gets a matrix that goes from local coords to Skia's device coordinates. |
| 104 | */ |
commit-bot@chromium.org | 215a682 | 2013-09-05 18:28:42 +0000 | [diff] [blame] | 105 | template<int Size> void getGLMatrix(GrGLfloat* destMatrix) { |
commit-bot@chromium.org | 47c66dd | 2014-05-29 01:12:10 +0000 | [diff] [blame] | 106 | GrGLGetMatrix<Size>(destMatrix, fViewMatrix); |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * Gets a matrix that goes from local coordinates to GL normalized device coords. |
| 111 | */ |
| 112 | template<int Size> void getRTAdjustedGLMatrix(GrGLfloat* destMatrix) { |
commit-bot@chromium.org | 215a682 | 2013-09-05 18:28:42 +0000 | [diff] [blame] | 113 | SkMatrix combined; |
| 114 | if (kBottomLeft_GrSurfaceOrigin == fRenderTargetOrigin) { |
| 115 | combined.setAll(SkIntToScalar(2) / fRenderTargetSize.fWidth, 0, -SK_Scalar1, |
| 116 | 0, -SkIntToScalar(2) / fRenderTargetSize.fHeight, SK_Scalar1, |
commit-bot@chromium.org | 47c66dd | 2014-05-29 01:12:10 +0000 | [diff] [blame] | 117 | 0, 0, 1); |
commit-bot@chromium.org | 215a682 | 2013-09-05 18:28:42 +0000 | [diff] [blame] | 118 | } else { |
| 119 | combined.setAll(SkIntToScalar(2) / fRenderTargetSize.fWidth, 0, -SK_Scalar1, |
| 120 | 0, SkIntToScalar(2) / fRenderTargetSize.fHeight, -SK_Scalar1, |
commit-bot@chromium.org | 47c66dd | 2014-05-29 01:12:10 +0000 | [diff] [blame] | 121 | 0, 0, 1); |
commit-bot@chromium.org | 215a682 | 2013-09-05 18:28:42 +0000 | [diff] [blame] | 122 | } |
commit-bot@chromium.org | b930cc3 | 2014-03-28 14:29:23 +0000 | [diff] [blame] | 123 | combined.preConcat(fViewMatrix); |
commit-bot@chromium.org | 215a682 | 2013-09-05 18:28:42 +0000 | [diff] [blame] | 124 | GrGLGetMatrix<Size>(destMatrix, combined); |
| 125 | } |
commit-bot@chromium.org | 47c66dd | 2014-05-29 01:12:10 +0000 | [diff] [blame] | 126 | |
| 127 | /** |
| 128 | * Gets a vec4 that adjusts the position from Skia device coords to GL's normalized device |
| 129 | * coords. Assuming the transformed position, pos, is a homogeneous vec3, the vec, v, is |
| 130 | * applied as such: |
| 131 | * pos.x = dot(v.xy, pos.xz) |
| 132 | * pos.y = dot(v.zq, pos.yz) |
| 133 | */ |
| 134 | void getRTAdjustmentVec(GrGLfloat* destVec) { |
| 135 | destVec[0] = 2.f / fRenderTargetSize.fWidth; |
| 136 | destVec[1] = -1.f; |
| 137 | if (kBottomLeft_GrSurfaceOrigin == fRenderTargetOrigin) { |
| 138 | destVec[2] = -2.f / fRenderTargetSize.fHeight; |
| 139 | destVec[3] = 1.f; |
| 140 | } else { |
| 141 | destVec[2] = 2.f / fRenderTargetSize.fHeight; |
| 142 | destVec[3] = -1.f; |
| 143 | } |
| 144 | } |
bsalomon@google.com | 6a51dcb | 2013-02-13 16:03:51 +0000 | [diff] [blame] | 145 | }; |
| 146 | |
| 147 | /** |
joshualitt | b0a8a37 | 2014-09-23 09:50:21 -0700 | [diff] [blame] | 148 | * This function uploads uniforms and calls each GrGLProcessor's setData. It is called before a |
bsalomon@google.com | 34cccde | 2013-01-04 18:34:30 +0000 | [diff] [blame] | 149 | * draw occurs using the program after the program has already been bound. It also uses the |
joshualitt | b0a8a37 | 2014-09-23 09:50:21 -0700 | [diff] [blame] | 150 | * GrGpuGL object to bind the textures required by the GrGLProcessors. The color and coverage |
bsalomon@google.com | 2c84aa3 | 2013-06-06 20:28:57 +0000 | [diff] [blame] | 151 | * stages come from GrGLProgramDesc::Build(). |
bsalomon@google.com | 4285acc | 2012-10-22 14:11:24 +0000 | [diff] [blame] | 152 | */ |
egdaniel | 170f90b | 2014-09-16 12:54:40 -0700 | [diff] [blame] | 153 | void setData(const GrOptDrawState&, |
| 154 | GrGpu::DrawType, |
bsalomon@google.com | 26e18b5 | 2013-03-29 19:22:36 +0000 | [diff] [blame] | 155 | const GrDeviceCoordTexture* dstCopy, // can be NULL |
| 156 | SharedGLState*); |
bsalomon@google.com | 9196130 | 2011-05-09 18:39:58 +0000 | [diff] [blame] | 157 | |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 158 | protected: |
kkinnunen | 7510b22 | 2014-07-30 00:04:16 -0700 | [diff] [blame] | 159 | typedef GrGLProgramDataManager::UniformHandle UniformHandle; |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 160 | typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; |
bsalomon@google.com | dbbc4e2 | 2012-07-25 17:48:39 +0000 | [diff] [blame] | 161 | |
commit-bot@chromium.org | a05fa06 | 2014-05-30 18:55:03 +0000 | [diff] [blame] | 162 | GrGLProgram(GrGpuGL*, |
| 163 | const GrGLProgramDesc&, |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 164 | const BuiltinUniformHandles&, |
| 165 | GrGLuint programID, |
| 166 | const UniformInfoArray&, |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame^] | 167 | GrGLInstalledGeoProc* geometryProcessor, |
| 168 | GrGLInstalledFragProcs* fragmentProcessors); |
bsalomon@google.com | 2c84aa3 | 2013-06-06 20:28:57 +0000 | [diff] [blame] | 169 | |
commit-bot@chromium.org | a05fa06 | 2014-05-30 18:55:03 +0000 | [diff] [blame] | 170 | // Sets the texture units for samplers. |
bsalomon@google.com | 2c84aa3 | 2013-06-06 20:28:57 +0000 | [diff] [blame] | 171 | void initSamplerUniforms(); |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame^] | 172 | void initSamplers(GrGLInstalledProc*, int* texUnitIdx); |
bsalomon@google.com | 2c84aa3 | 2013-06-06 20:28:57 +0000 | [diff] [blame] | 173 | |
| 174 | // Helper for setData(). Makes GL calls to specify the initial color when there is not |
| 175 | // per-vertex colors. |
egdaniel | 170f90b | 2014-09-16 12:54:40 -0700 | [diff] [blame] | 176 | void setColor(const GrOptDrawState&, GrColor color, SharedGLState*); |
bsalomon@google.com | 2c84aa3 | 2013-06-06 20:28:57 +0000 | [diff] [blame] | 177 | |
| 178 | // Helper for setData(). Makes GL calls to specify the initial coverage when there is not |
| 179 | // per-vertex coverages. |
egdaniel | 170f90b | 2014-09-16 12:54:40 -0700 | [diff] [blame] | 180 | void setCoverage(const GrOptDrawState&, GrColor coverage, SharedGLState*); |
bsalomon@google.com | 2c84aa3 | 2013-06-06 20:28:57 +0000 | [diff] [blame] | 181 | |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 182 | // A templated helper to loop over effects, set the transforms(via subclass) and bind textures |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame^] | 183 | void setFragmentData(const GrOptDrawState&); |
| 184 | virtual void setTransformData(const GrFragmentStage& effectStage, GrGLInstalledFragProc* pe); |
| 185 | void bindTextures(const GrGLInstalledProc*, const GrProcessor&); |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 186 | |
| 187 | /* |
| 188 | * Legacy NVPR needs a hook here to flush path tex gen settings. |
| 189 | * TODO when legacy nvpr is removed, remove this call. |
| 190 | */ |
| 191 | virtual void didSetData(GrGpu::DrawType); |
| 192 | |
bsalomon@google.com | 2c84aa3 | 2013-06-06 20:28:57 +0000 | [diff] [blame] | 193 | // Helper for setData() that sets the view matrix and loads the render target height uniform |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 194 | void setMatrixAndRenderTargetHeight(GrGpu::DrawType, const GrOptDrawState&); |
| 195 | virtual void onSetMatrixAndRenderTargetHeight(GrGpu::DrawType, const GrOptDrawState&); |
bsalomon@google.com | 2c84aa3 | 2013-06-06 20:28:57 +0000 | [diff] [blame] | 196 | |
bsalomon@google.com | 34cccde | 2013-01-04 18:34:30 +0000 | [diff] [blame] | 197 | // these reflect the current values of uniforms (GL uniform values travel with program) |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 198 | MatrixState fMatrixState; |
| 199 | GrColor fColor; |
| 200 | GrColor fCoverage; |
| 201 | int fDstCopyTexUnit; |
| 202 | BuiltinUniformHandles fBuiltinUniformHandles; |
| 203 | GrGLuint fProgramID; |
junov@google.com | f93e717 | 2011-03-31 21:26:24 +0000 | [diff] [blame] | 204 | |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 205 | // the installed effects |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame^] | 206 | SkAutoTDelete<GrGLInstalledGeoProc> fGeometryProcessor; |
| 207 | SkAutoTUnref<GrGLInstalledFragProcs> fFragmentProcessors; |
skia.committer@gmail.com | 9681eeb | 2014-05-30 03:06:10 +0000 | [diff] [blame] | 208 | |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 209 | GrGLProgramDesc fDesc; |
| 210 | GrGpuGL* fGpu; |
| 211 | GrGLProgramDataManager fProgramDataManager; |
junov@google.com | f93e717 | 2011-03-31 21:26:24 +0000 | [diff] [blame] | 212 | |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 213 | friend class GrGLProgramBuilder; |
commit-bot@chromium.org | 6b30e45 | 2013-10-04 20:02:53 +0000 | [diff] [blame] | 214 | |
commit-bot@chromium.org | a4de8c2 | 2013-09-09 13:38:37 +0000 | [diff] [blame] | 215 | typedef SkRefCnt INHERITED; |
junov@google.com | f93e717 | 2011-03-31 21:26:24 +0000 | [diff] [blame] | 216 | }; |
| 217 | |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 218 | /* |
| 219 | * Below are slight specializations of the program object for the different types of programs |
| 220 | * The default GrGL programs consist of at the very least a vertex and fragment shader. |
| 221 | * Legacy Nvpr only has a fragment shader, 1.3+ Nvpr ignores the vertex shader, but both require |
| 222 | * specialized methods for setting transform data. Both types of NVPR also require setting the |
| 223 | * projection matrix through a special function call |
| 224 | */ |
| 225 | class GrGLNvprProgramBase : public GrGLProgram { |
| 226 | protected: |
| 227 | GrGLNvprProgramBase(GrGpuGL*, |
| 228 | const GrGLProgramDesc&, |
| 229 | const BuiltinUniformHandles&, |
| 230 | GrGLuint programID, |
| 231 | const UniformInfoArray&, |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame^] | 232 | GrGLInstalledFragProcs* fragmentProcessors); |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 233 | virtual void onSetMatrixAndRenderTargetHeight(GrGpu::DrawType, const GrOptDrawState&); |
| 234 | |
| 235 | typedef GrGLProgram INHERITED; |
| 236 | }; |
| 237 | |
| 238 | class GrGLNvprProgram : public GrGLNvprProgramBase { |
| 239 | public: |
| 240 | virtual bool hasVertexShader() const SK_OVERRIDE { return true; } |
| 241 | |
| 242 | private: |
| 243 | typedef GrGLNvprProgramBuilder::SeparableVaryingInfo SeparableVaryingInfo; |
| 244 | typedef GrGLNvprProgramBuilder::SeparableVaryingInfoArray SeparableVaryingInfoArray; |
| 245 | GrGLNvprProgram(GrGpuGL*, |
| 246 | const GrGLProgramDesc&, |
| 247 | const BuiltinUniformHandles&, |
| 248 | GrGLuint programID, |
| 249 | const UniformInfoArray&, |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame^] | 250 | GrGLInstalledFragProcs* fragmentProcessors, |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 251 | const SeparableVaryingInfoArray& separableVaryings); |
| 252 | virtual void didSetData(GrGpu::DrawType) SK_OVERRIDE; |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame^] | 253 | virtual void setTransformData(const GrFragmentStage&, GrGLInstalledFragProc*) SK_OVERRIDE; |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 254 | |
| 255 | struct Varying { |
| 256 | GrGLint fLocation; |
| 257 | SkDEBUGCODE( |
| 258 | GrSLType fType; |
| 259 | ); |
| 260 | }; |
| 261 | SkTArray<Varying, true> fVaryings; |
| 262 | |
| 263 | friend class GrGLNvprProgramBuilder; |
| 264 | |
| 265 | typedef GrGLNvprProgramBase INHERITED; |
| 266 | }; |
| 267 | |
| 268 | class GrGLLegacyNvprProgram : public GrGLNvprProgramBase { |
| 269 | public: |
| 270 | virtual bool hasVertexShader() const SK_OVERRIDE { return false; } |
| 271 | |
| 272 | private: |
| 273 | GrGLLegacyNvprProgram(GrGpuGL* gpu, |
| 274 | const GrGLProgramDesc& desc, |
| 275 | const BuiltinUniformHandles&, |
| 276 | GrGLuint programID, |
| 277 | const UniformInfoArray&, |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame^] | 278 | GrGLInstalledFragProcs* fragmentProcessors, |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 279 | int texCoordSetCnt); |
| 280 | virtual void didSetData(GrGpu::DrawType) SK_OVERRIDE; |
joshualitt | a5305a1 | 2014-10-10 17:47:00 -0700 | [diff] [blame^] | 281 | virtual void setTransformData(const GrFragmentStage&, GrGLInstalledFragProc*) SK_OVERRIDE; |
joshualitt | 47bb382 | 2014-10-07 16:43:25 -0700 | [diff] [blame] | 282 | |
| 283 | int fTexCoordSetCnt; |
| 284 | |
| 285 | friend class GrGLLegacyNvprProgramBuilder; |
| 286 | |
| 287 | typedef GrGLNvprProgramBase INHERITED; |
| 288 | }; |
| 289 | |
junov@google.com | f93e717 | 2011-03-31 21:26:24 +0000 | [diff] [blame] | 290 | #endif |