blob: c4c51933c77e08b244f5a457dfc7521223bde35a [file] [log] [blame]
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +00001/*
2 * Copyright 2012 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.
6 */
7
8#include "gl/GrGLShaderBuilder.h"
9#include "gl/GrGLProgram.h"
10#include "gl/GrGLUniformHandle.h"
commit-bot@chromium.org9188a152013-09-05 18:28:24 +000011#include "gl/GrGpuGL.h"
bsalomon@google.comd8b5fac2012-11-01 17:02:46 +000012#include "SkMatrix.h"
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000013
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +000014#define ASSERT_ARRAY_UPLOAD_IN_BOUNDS(UNI, COUNT) \
15 SkASSERT(arrayCount <= uni.fArrayCount || \
16 (1 == arrayCount && GrGLShaderVar::kNonArray == uni.fArrayCount))
17
kkinnunendddc18a2014-08-03 23:19:46 -070018GrGLProgramDataManager::GrGLProgramDataManager(GrGpuGL* gpu,
19 GrGLProgram*,
20 const GrGLShaderBuilder& builder)
21 : fGpu(gpu) {
22 int count = builder.getUniformInfos().count();
23 fUniforms.push_back_n(count);
24 for (int i = 0; i < count; i++) {
25 Uniform& uniform = fUniforms[i];
26 const GrGLShaderBuilder::UniformInfo& builderUniform = builder.getUniformInfos()[i];
27 SkASSERT(GrGLShaderVar::kNonArray == builderUniform.fVariable.getArrayCount() ||
28 builderUniform.fVariable.getArrayCount() > 0);
29 SkDEBUGCODE(
30 uniform.fArrayCount = builderUniform.fVariable.getArrayCount();
31 uniform.fType = builderUniform.fVariable.getType();
32 );
33 // TODO: Move the Xoom uniform array in both FS and VS bug workaround here.
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000034
kkinnunendddc18a2014-08-03 23:19:46 -070035 if (GrGLShaderBuilder::kVertex_Visibility & builderUniform.fVisibility) {
36 uniform.fVSLocation = builderUniform.fLocation;
37 } else {
38 uniform.fVSLocation = kUnusedUniform;
39 }
40 if (GrGLShaderBuilder::kFragment_Visibility & builderUniform.fVisibility) {
41 uniform.fFSLocation = builderUniform.fLocation;
42 } else {
43 uniform.fFSLocation = kUnusedUniform;
44 }
45 }
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000046}
47
kkinnunen7510b222014-07-30 00:04:16 -070048void GrGLProgramDataManager::setSampler(UniformHandle u, GrGLint texUnit) const {
kkinnunendddc18a2014-08-03 23:19:46 -070049 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +000050 SkASSERT(uni.fType == kSampler2D_GrSLType);
51 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
bsalomon@google.com0982d352012-07-31 15:33:25 +000052 // FIXME: We still insert a single sampler uniform for every stage. If the shader does not
53 // reference the sampler then the compiler may have optimized it out. Uncomment this assert
54 // once stages insert their own samplers.
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +000055 // SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000056 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +000057 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, texUnit));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000058 }
59 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +000060 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, texUnit));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000061 }
62}
63
kkinnunen7510b222014-07-30 00:04:16 -070064void GrGLProgramDataManager::set1f(UniformHandle u, GrGLfloat v0) const {
kkinnunendddc18a2014-08-03 23:19:46 -070065 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +000066 SkASSERT(uni.fType == kFloat_GrSLType);
67 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
68 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000069 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +000070 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fFSLocation, v0));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000071 }
72 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +000073 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fVSLocation, v0));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000074 }
75}
76
kkinnunen7510b222014-07-30 00:04:16 -070077void GrGLProgramDataManager::set1fv(UniformHandle u,
78 int arrayCount,
79 const GrGLfloat v[]) const {
kkinnunendddc18a2014-08-03 23:19:46 -070080 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +000081 SkASSERT(uni.fType == kFloat_GrSLType);
82 SkASSERT(arrayCount > 0);
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +000083 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000084 // This assert fires in some instances of the two-pt gradient for its VSParams.
85 // Once the uniform manager is responsible for inserting the duplicate uniform
86 // arrays in VS and FS driver bug workaround, this can be enabled.
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +000087 //SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000088 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +000089 GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fFSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000090 }
91 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +000092 GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fVSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000093 }
94}
95
kkinnunen7510b222014-07-30 00:04:16 -070096void GrGLProgramDataManager::set2f(UniformHandle u, GrGLfloat v0, GrGLfloat v1) const {
kkinnunendddc18a2014-08-03 23:19:46 -070097 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +000098 SkASSERT(uni.fType == kVec2f_GrSLType);
99 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
100 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000101 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000102 GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fFSLocation, v0, v1));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000103 }
104 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000105 GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fVSLocation, v0, v1));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000106 }
107}
108
kkinnunen7510b222014-07-30 00:04:16 -0700109void GrGLProgramDataManager::set2fv(UniformHandle u,
110 int arrayCount,
111 const GrGLfloat v[]) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700112 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000113 SkASSERT(uni.fType == kVec2f_GrSLType);
114 SkASSERT(arrayCount > 0);
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000115 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000116 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000117 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000118 GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fFSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000119 }
120 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000121 GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fVSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000122 }
123}
124
kkinnunen7510b222014-07-30 00:04:16 -0700125void GrGLProgramDataManager::set3f(UniformHandle u, GrGLfloat v0, GrGLfloat v1, GrGLfloat v2) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700126 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000127 SkASSERT(uni.fType == kVec3f_GrSLType);
128 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
129 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000130 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000131 GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fFSLocation, v0, v1, v2));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000132 }
133 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000134 GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fVSLocation, v0, v1, v2));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000135 }
136}
137
kkinnunen7510b222014-07-30 00:04:16 -0700138void GrGLProgramDataManager::set3fv(UniformHandle u,
139 int arrayCount,
140 const GrGLfloat v[]) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700141 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000142 SkASSERT(uni.fType == kVec3f_GrSLType);
143 SkASSERT(arrayCount > 0);
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000144 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000145 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000146 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000147 GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fFSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000148 }
149 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000150 GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fVSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000151 }
152}
153
kkinnunen7510b222014-07-30 00:04:16 -0700154void GrGLProgramDataManager::set4f(UniformHandle u,
155 GrGLfloat v0,
156 GrGLfloat v1,
157 GrGLfloat v2,
158 GrGLfloat v3) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700159 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000160 SkASSERT(uni.fType == kVec4f_GrSLType);
161 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
162 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000163 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000164 GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fFSLocation, v0, v1, v2, v3));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000165 }
166 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000167 GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fVSLocation, v0, v1, v2, v3));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000168 }
169}
170
kkinnunen7510b222014-07-30 00:04:16 -0700171void GrGLProgramDataManager::set4fv(UniformHandle u,
172 int arrayCount,
173 const GrGLfloat v[]) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700174 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000175 SkASSERT(uni.fType == kVec4f_GrSLType);
176 SkASSERT(arrayCount > 0);
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000177 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000178 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000179 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000180 GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fFSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000181 }
182 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000183 GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fVSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000184 }
185}
186
kkinnunen7510b222014-07-30 00:04:16 -0700187void GrGLProgramDataManager::setMatrix3f(UniformHandle u, const GrGLfloat matrix[]) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700188 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000189 SkASSERT(uni.fType == kMat33f_GrSLType);
190 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
bsalomon@google.com8ea78d82012-10-24 20:11:30 +0000191 // TODO: Re-enable this assert once texture matrices aren't forced on all effects
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000192 // SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000193 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000194 GR_GL_CALL(fGpu->glInterface(), UniformMatrix3fv(uni.fFSLocation, 1, false, matrix));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000195 }
196 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000197 GR_GL_CALL(fGpu->glInterface(), UniformMatrix3fv(uni.fVSLocation, 1, false, matrix));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000198 }
199}
200
kkinnunen7510b222014-07-30 00:04:16 -0700201void GrGLProgramDataManager::setMatrix4f(UniformHandle u, const GrGLfloat matrix[]) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700202 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000203 SkASSERT(uni.fType == kMat44f_GrSLType);
204 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
205 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000206 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000207 GR_GL_CALL(fGpu->glInterface(), UniformMatrix4fv(uni.fFSLocation, 1, false, matrix));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000208 }
209 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000210 GR_GL_CALL(fGpu->glInterface(), UniformMatrix4fv(uni.fVSLocation, 1, false, matrix));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000211 }
212}
213
kkinnunen7510b222014-07-30 00:04:16 -0700214void GrGLProgramDataManager::setMatrix3fv(UniformHandle u,
215 int arrayCount,
216 const GrGLfloat matrices[]) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700217 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000218 SkASSERT(uni.fType == kMat33f_GrSLType);
219 SkASSERT(arrayCount > 0);
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000220 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000221 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000222 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000223 GR_GL_CALL(fGpu->glInterface(),
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000224 UniformMatrix3fv(uni.fFSLocation, arrayCount, false, matrices));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000225 }
226 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000227 GR_GL_CALL(fGpu->glInterface(),
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000228 UniformMatrix3fv(uni.fVSLocation, arrayCount, false, matrices));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000229 }
230}
231
kkinnunen7510b222014-07-30 00:04:16 -0700232void GrGLProgramDataManager::setMatrix4fv(UniformHandle u,
233 int arrayCount,
234 const GrGLfloat matrices[]) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700235 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000236 SkASSERT(uni.fType == kMat44f_GrSLType);
237 SkASSERT(arrayCount > 0);
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000238 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000239 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000240 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000241 GR_GL_CALL(fGpu->glInterface(),
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000242 UniformMatrix4fv(uni.fFSLocation, arrayCount, false, matrices));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000243 }
244 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000245 GR_GL_CALL(fGpu->glInterface(),
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000246 UniformMatrix4fv(uni.fVSLocation, arrayCount, false, matrices));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000247 }
248}
249
kkinnunen7510b222014-07-30 00:04:16 -0700250void GrGLProgramDataManager::setSkMatrix(UniformHandle u, const SkMatrix& matrix) const {
bsalomon@google.comd8b5fac2012-11-01 17:02:46 +0000251 GrGLfloat mt[] = {
252 matrix.get(SkMatrix::kMScaleX),
253 matrix.get(SkMatrix::kMSkewY),
254 matrix.get(SkMatrix::kMPersp0),
255 matrix.get(SkMatrix::kMSkewX),
256 matrix.get(SkMatrix::kMScaleY),
257 matrix.get(SkMatrix::kMPersp1),
258 matrix.get(SkMatrix::kMTransX),
259 matrix.get(SkMatrix::kMTransY),
260 matrix.get(SkMatrix::kMPersp2),
261 };
262 this->setMatrix3f(u, mt);
263}