blob: f8d996b542e0cd8c11f33dd27bebb5fc73f67a4e [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
kkinnunenec56e452014-08-25 22:21:16 -07008#include "gl/GrGLPathRendering.h"
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +00009#include "gl/GrGLUniformHandle.h"
commit-bot@chromium.org9188a152013-09-05 18:28:24 +000010#include "gl/GrGpuGL.h"
bsalomon@google.comd8b5fac2012-11-01 17:02:46 +000011#include "SkMatrix.h"
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000012
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +000013#define ASSERT_ARRAY_UPLOAD_IN_BOUNDS(UNI, COUNT) \
14 SkASSERT(arrayCount <= uni.fArrayCount || \
15 (1 == arrayCount && GrGLShaderVar::kNonArray == uni.fArrayCount))
16
joshualitt47bb3822014-10-07 16:43:25 -070017GrGLProgramDataManager::GrGLProgramDataManager(GrGpuGL* gpu, const UniformInfoArray& uniforms)
18 : fGpu(gpu) {
19 int count = uniforms.count();
kkinnunendddc18a2014-08-03 23:19:46 -070020 fUniforms.push_back_n(count);
21 for (int i = 0; i < count; i++) {
22 Uniform& uniform = fUniforms[i];
joshualitt47bb3822014-10-07 16:43:25 -070023 const UniformInfo& builderUniform = uniforms[i];
kkinnunendddc18a2014-08-03 23:19:46 -070024 SkASSERT(GrGLShaderVar::kNonArray == builderUniform.fVariable.getArrayCount() ||
25 builderUniform.fVariable.getArrayCount() > 0);
26 SkDEBUGCODE(
27 uniform.fArrayCount = builderUniform.fVariable.getArrayCount();
28 uniform.fType = builderUniform.fVariable.getType();
29 );
30 // TODO: Move the Xoom uniform array in both FS and VS bug workaround here.
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000031
joshualitt30ba4362014-08-21 20:18:45 -070032 if (GrGLProgramBuilder::kVertex_Visibility & builderUniform.fVisibility) {
kkinnunendddc18a2014-08-03 23:19:46 -070033 uniform.fVSLocation = builderUniform.fLocation;
34 } else {
35 uniform.fVSLocation = kUnusedUniform;
joshualitt47bb3822014-10-07 16:43:25 -070036 }
joshualitt30ba4362014-08-21 20:18:45 -070037 if (GrGLProgramBuilder::kFragment_Visibility & builderUniform.fVisibility) {
kkinnunendddc18a2014-08-03 23:19:46 -070038 uniform.fFSLocation = builderUniform.fLocation;
39 } else {
40 uniform.fFSLocation = kUnusedUniform;
41 }
42 }
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000043}
44
kkinnunen7510b222014-07-30 00:04:16 -070045void GrGLProgramDataManager::setSampler(UniformHandle u, GrGLint texUnit) const {
kkinnunendddc18a2014-08-03 23:19:46 -070046 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +000047 SkASSERT(uni.fType == kSampler2D_GrSLType);
48 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
bsalomon@google.com0982d352012-07-31 15:33:25 +000049 // FIXME: We still insert a single sampler uniform for every stage. If the shader does not
50 // reference the sampler then the compiler may have optimized it out. Uncomment this assert
51 // once stages insert their own samplers.
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +000052 // SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000053 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +000054 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, texUnit));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000055 }
56 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +000057 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, texUnit));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000058 }
59}
60
kkinnunen7510b222014-07-30 00:04:16 -070061void GrGLProgramDataManager::set1f(UniformHandle u, GrGLfloat v0) const {
kkinnunendddc18a2014-08-03 23:19:46 -070062 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +000063 SkASSERT(uni.fType == kFloat_GrSLType);
64 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
65 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000066 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +000067 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fFSLocation, v0));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000068 }
69 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +000070 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fVSLocation, v0));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000071 }
72}
73
kkinnunen7510b222014-07-30 00:04:16 -070074void GrGLProgramDataManager::set1fv(UniformHandle u,
75 int arrayCount,
76 const GrGLfloat v[]) const {
kkinnunendddc18a2014-08-03 23:19:46 -070077 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +000078 SkASSERT(uni.fType == kFloat_GrSLType);
79 SkASSERT(arrayCount > 0);
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +000080 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000081 // This assert fires in some instances of the two-pt gradient for its VSParams.
82 // Once the uniform manager is responsible for inserting the duplicate uniform
83 // arrays in VS and FS driver bug workaround, this can be enabled.
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +000084 //SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000085 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +000086 GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fFSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000087 }
88 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +000089 GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fVSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000090 }
91}
92
kkinnunen7510b222014-07-30 00:04:16 -070093void GrGLProgramDataManager::set2f(UniformHandle u, GrGLfloat v0, GrGLfloat v1) const {
kkinnunendddc18a2014-08-03 23:19:46 -070094 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +000095 SkASSERT(uni.fType == kVec2f_GrSLType);
96 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
97 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000098 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +000099 GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fFSLocation, v0, v1));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000100 }
101 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000102 GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fVSLocation, v0, v1));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000103 }
104}
105
kkinnunen7510b222014-07-30 00:04:16 -0700106void GrGLProgramDataManager::set2fv(UniformHandle u,
107 int arrayCount,
108 const GrGLfloat v[]) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700109 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000110 SkASSERT(uni.fType == kVec2f_GrSLType);
111 SkASSERT(arrayCount > 0);
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000112 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000113 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000114 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000115 GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fFSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000116 }
117 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000118 GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fVSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000119 }
120}
121
kkinnunen7510b222014-07-30 00:04:16 -0700122void GrGLProgramDataManager::set3f(UniformHandle u, GrGLfloat v0, GrGLfloat v1, GrGLfloat v2) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700123 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000124 SkASSERT(uni.fType == kVec3f_GrSLType);
125 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
126 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000127 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000128 GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fFSLocation, v0, v1, v2));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000129 }
130 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000131 GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fVSLocation, v0, v1, v2));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000132 }
133}
134
kkinnunen7510b222014-07-30 00:04:16 -0700135void GrGLProgramDataManager::set3fv(UniformHandle u,
136 int arrayCount,
137 const GrGLfloat v[]) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700138 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000139 SkASSERT(uni.fType == kVec3f_GrSLType);
140 SkASSERT(arrayCount > 0);
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000141 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000142 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000143 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000144 GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fFSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000145 }
146 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000147 GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fVSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000148 }
149}
150
kkinnunen7510b222014-07-30 00:04:16 -0700151void GrGLProgramDataManager::set4f(UniformHandle u,
152 GrGLfloat v0,
153 GrGLfloat v1,
154 GrGLfloat v2,
155 GrGLfloat v3) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700156 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000157 SkASSERT(uni.fType == kVec4f_GrSLType);
158 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
159 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000160 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000161 GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fFSLocation, v0, v1, v2, v3));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000162 }
163 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000164 GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fVSLocation, v0, v1, v2, v3));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000165 }
166}
167
kkinnunen7510b222014-07-30 00:04:16 -0700168void GrGLProgramDataManager::set4fv(UniformHandle u,
169 int arrayCount,
170 const GrGLfloat v[]) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700171 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000172 SkASSERT(uni.fType == kVec4f_GrSLType);
173 SkASSERT(arrayCount > 0);
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000174 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000175 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000176 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000177 GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fFSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000178 }
179 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000180 GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fVSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000181 }
182}
183
kkinnunen7510b222014-07-30 00:04:16 -0700184void GrGLProgramDataManager::setMatrix3f(UniformHandle u, const GrGLfloat matrix[]) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700185 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000186 SkASSERT(uni.fType == kMat33f_GrSLType);
187 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
bsalomon@google.com8ea78d82012-10-24 20:11:30 +0000188 // TODO: Re-enable this assert once texture matrices aren't forced on all effects
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000189 // SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000190 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000191 GR_GL_CALL(fGpu->glInterface(), UniformMatrix3fv(uni.fFSLocation, 1, false, matrix));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000192 }
193 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000194 GR_GL_CALL(fGpu->glInterface(), UniformMatrix3fv(uni.fVSLocation, 1, false, matrix));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000195 }
196}
197
kkinnunen7510b222014-07-30 00:04:16 -0700198void GrGLProgramDataManager::setMatrix4f(UniformHandle u, const GrGLfloat matrix[]) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700199 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000200 SkASSERT(uni.fType == kMat44f_GrSLType);
201 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
202 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000203 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000204 GR_GL_CALL(fGpu->glInterface(), UniformMatrix4fv(uni.fFSLocation, 1, false, matrix));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000205 }
206 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000207 GR_GL_CALL(fGpu->glInterface(), UniformMatrix4fv(uni.fVSLocation, 1, false, matrix));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000208 }
209}
210
kkinnunen7510b222014-07-30 00:04:16 -0700211void GrGLProgramDataManager::setMatrix3fv(UniformHandle u,
212 int arrayCount,
213 const GrGLfloat matrices[]) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700214 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000215 SkASSERT(uni.fType == kMat33f_GrSLType);
216 SkASSERT(arrayCount > 0);
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000217 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000218 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000219 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000220 GR_GL_CALL(fGpu->glInterface(),
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000221 UniformMatrix3fv(uni.fFSLocation, arrayCount, false, matrices));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000222 }
223 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000224 GR_GL_CALL(fGpu->glInterface(),
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000225 UniformMatrix3fv(uni.fVSLocation, arrayCount, false, matrices));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000226 }
227}
228
kkinnunen7510b222014-07-30 00:04:16 -0700229void GrGLProgramDataManager::setMatrix4fv(UniformHandle u,
230 int arrayCount,
231 const GrGLfloat matrices[]) const {
kkinnunendddc18a2014-08-03 23:19:46 -0700232 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000233 SkASSERT(uni.fType == kMat44f_GrSLType);
234 SkASSERT(arrayCount > 0);
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000235 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000236 SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000237 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000238 GR_GL_CALL(fGpu->glInterface(),
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000239 UniformMatrix4fv(uni.fFSLocation, arrayCount, false, matrices));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000240 }
241 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000242 GR_GL_CALL(fGpu->glInterface(),
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000243 UniformMatrix4fv(uni.fVSLocation, arrayCount, false, matrices));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000244 }
245}
246
kkinnunen7510b222014-07-30 00:04:16 -0700247void GrGLProgramDataManager::setSkMatrix(UniformHandle u, const SkMatrix& matrix) const {
bsalomon@google.comd8b5fac2012-11-01 17:02:46 +0000248 GrGLfloat mt[] = {
249 matrix.get(SkMatrix::kMScaleX),
250 matrix.get(SkMatrix::kMSkewY),
251 matrix.get(SkMatrix::kMPersp0),
252 matrix.get(SkMatrix::kMSkewX),
253 matrix.get(SkMatrix::kMScaleY),
254 matrix.get(SkMatrix::kMPersp1),
255 matrix.get(SkMatrix::kMTransX),
256 matrix.get(SkMatrix::kMTransY),
257 matrix.get(SkMatrix::kMPersp2),
258 };
259 this->setMatrix3f(u, mt);
260}