blob: 056e7b73dd2c4a2314130385c1b692de7fb130c8 [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
bsalomon@google.comd8b5fac2012-11-01 17:02:46 +00008#include "SkMatrix.h"
joshualitte7afc2d2015-09-11 10:44:13 -07009#include "gl/GrGLProgramDataManager.h"
10#include "gl/GrGLGpu.h"
egdaniel7ea439b2015-12-03 09:20:44 -080011#include "glsl/GrGLSLUniformHandler.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) \
cdalton8d988b32016-03-07 15:39:09 -080014 SkASSERT((COUNT) <= (UNI).fArrayCount || \
15 (1 == (COUNT) && GrGLSLShaderVar::kNonArray == (UNI).fArrayCount))
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +000016
joshualittd8dd47b2015-09-11 11:45:01 -070017GrGLProgramDataManager::GrGLProgramDataManager(GrGLGpu* gpu, GrGLuint programID,
18 const UniformInfoArray& uniforms,
egdaniel0eafe792015-11-20 14:01:22 -080019 const VaryingInfoArray& pathProcVaryings)
joshualittd8dd47b2015-09-11 11:45:01 -070020 : fGpu(gpu)
21 , fProgramID(programID) {
joshualitt47bb3822014-10-07 16:43:25 -070022 int count = uniforms.count();
kkinnunendddc18a2014-08-03 23:19:46 -070023 fUniforms.push_back_n(count);
24 for (int i = 0; i < count; i++) {
25 Uniform& uniform = fUniforms[i];
joshualitt47bb3822014-10-07 16:43:25 -070026 const UniformInfo& builderUniform = uniforms[i];
egdaniel0d3f0612015-10-21 10:45:48 -070027 SkASSERT(GrGLSLShaderVar::kNonArray == builderUniform.fVariable.getArrayCount() ||
kkinnunendddc18a2014-08-03 23:19:46 -070028 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
cdalton5e58cee2016-02-11 12:49:47 -080035 if (kVertex_GrShaderFlag & builderUniform.fVisibility) {
kkinnunendddc18a2014-08-03 23:19:46 -070036 uniform.fVSLocation = builderUniform.fLocation;
37 } else {
38 uniform.fVSLocation = kUnusedUniform;
joshualitt47bb3822014-10-07 16:43:25 -070039 }
cdalton5e58cee2016-02-11 12:49:47 -080040 if (kFragment_GrShaderFlag & builderUniform.fVisibility) {
kkinnunendddc18a2014-08-03 23:19:46 -070041 uniform.fFSLocation = builderUniform.fLocation;
42 } else {
43 uniform.fFSLocation = kUnusedUniform;
44 }
45 }
joshualittd8dd47b2015-09-11 11:45:01 -070046
47 // NVPR programs have separable varyings
egdaniel0eafe792015-11-20 14:01:22 -080048 count = pathProcVaryings.count();
49 fPathProcVaryings.push_back_n(count);
joshualittd8dd47b2015-09-11 11:45:01 -070050 for (int i = 0; i < count; i++) {
51 SkASSERT(fGpu->glCaps().shaderCaps()->pathRenderingSupport());
egdaniel0eafe792015-11-20 14:01:22 -080052 PathProcVarying& pathProcVarying = fPathProcVaryings[i];
53 const VaryingInfo& builderPathProcVarying = pathProcVaryings[i];
54 SkASSERT(GrGLSLShaderVar::kNonArray == builderPathProcVarying.fVariable.getArrayCount() ||
55 builderPathProcVarying.fVariable.getArrayCount() > 0);
joshualittd8dd47b2015-09-11 11:45:01 -070056 SkDEBUGCODE(
egdaniel0eafe792015-11-20 14:01:22 -080057 pathProcVarying.fArrayCount = builderPathProcVarying.fVariable.getArrayCount();
58 pathProcVarying.fType = builderPathProcVarying.fVariable.getType();
joshualittd8dd47b2015-09-11 11:45:01 -070059 );
egdaniel0eafe792015-11-20 14:01:22 -080060 pathProcVarying.fLocation = builderPathProcVarying.fLocation;
joshualittd8dd47b2015-09-11 11:45:01 -070061 }
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000062}
63
egdaniel09aa1fc2016-04-20 07:09:46 -070064void GrGLProgramDataManager::setSamplers(const SkTArray<GrGLSampler>& samplers) const {
65 for (int i = 0; i < samplers.count(); ++i) {
66 GrGLint vsLocation;
67 GrGLint fsLocation;
68 const GrGLSampler& sampler = samplers[i];
69 if (kVertex_GrShaderFlag & sampler.visibility()) {
70 vsLocation = sampler.location();
71 } else {
72 vsLocation = kUnusedUniform;
73 }
74 if (kFragment_GrShaderFlag & sampler.visibility()) {
75 fsLocation = sampler.location();
76 } else {
77 fsLocation = kUnusedUniform;
78 }
79 // FIXME: We still insert a single sampler uniform for every stage. If the shader does not
80 // reference the sampler then the compiler may have optimized it out. Uncomment this assert
81 // once stages insert their own samplers.
82 // this->printUnused(uni);
83 if (kUnusedUniform != fsLocation) {
84 GR_GL_CALL(fGpu->glInterface(), Uniform1i(fsLocation, i));
85 }
86 if (kUnusedUniform != vsLocation && vsLocation != fsLocation) {
87 GR_GL_CALL(fGpu->glInterface(), Uniform1i(vsLocation, i));
88 }
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +000089 }
90}
91
fmenozzi497e9e22016-06-21 09:42:12 -070092void GrGLProgramDataManager::set1i(UniformHandle u, int32_t i) const {
93 const Uniform& uni = fUniforms[u.toIndex()];
94 SkASSERT(uni.fType == kInt_GrSLType);
95 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount);
96 SkDEBUGCODE(this->printUnused(uni));
97 if (kUnusedUniform != uni.fFSLocation) {
98 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, i));
99 }
100 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
101 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, i));
102 }
103}
104
egdaniel018fb622015-10-28 07:26:40 -0700105void GrGLProgramDataManager::set1f(UniformHandle u, float v0) const {
joshualitte7afc2d2015-09-11 10:44:13 -0700106 const Uniform& uni = fUniforms[u.toIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000107 SkASSERT(uni.fType == kFloat_GrSLType);
egdaniel0d3f0612015-10-21 10:45:48 -0700108 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount);
joshualitt7d022d62015-05-12 12:03:50 -0700109 SkDEBUGCODE(this->printUnused(uni);)
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000110 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000111 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fFSLocation, v0));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000112 }
113 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000114 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fVSLocation, v0));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000115 }
116}
117
kkinnunen7510b222014-07-30 00:04:16 -0700118void GrGLProgramDataManager::set1fv(UniformHandle u,
119 int arrayCount,
egdaniel018fb622015-10-28 07:26:40 -0700120 const float v[]) const {
joshualitte7afc2d2015-09-11 10:44:13 -0700121 const Uniform& uni = fUniforms[u.toIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000122 SkASSERT(uni.fType == kFloat_GrSLType);
123 SkASSERT(arrayCount > 0);
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000124 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000125 // This assert fires in some instances of the two-pt gradient for its VSParams.
126 // Once the uniform manager is responsible for inserting the duplicate uniform
127 // arrays in VS and FS driver bug workaround, this can be enabled.
joshualittaf2d56d2015-05-11 06:21:34 -0700128 // this->printUni(uni);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000129 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000130 GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fFSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000131 }
132 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000133 GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fVSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000134 }
135}
136
egdaniel018fb622015-10-28 07:26:40 -0700137void GrGLProgramDataManager::set2f(UniformHandle u, float v0, float v1) const {
joshualitte7afc2d2015-09-11 10:44:13 -0700138 const Uniform& uni = fUniforms[u.toIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000139 SkASSERT(uni.fType == kVec2f_GrSLType);
egdaniel0d3f0612015-10-21 10:45:48 -0700140 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount);
joshualitt7d022d62015-05-12 12:03:50 -0700141 SkDEBUGCODE(this->printUnused(uni);)
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000142 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000143 GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fFSLocation, v0, v1));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000144 }
145 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000146 GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fVSLocation, v0, v1));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000147 }
148}
149
kkinnunen7510b222014-07-30 00:04:16 -0700150void GrGLProgramDataManager::set2fv(UniformHandle u,
151 int arrayCount,
egdaniel018fb622015-10-28 07:26:40 -0700152 const float v[]) const {
joshualitte7afc2d2015-09-11 10:44:13 -0700153 const Uniform& uni = fUniforms[u.toIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000154 SkASSERT(uni.fType == kVec2f_GrSLType);
155 SkASSERT(arrayCount > 0);
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000156 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
joshualitt7d022d62015-05-12 12:03:50 -0700157 SkDEBUGCODE(this->printUnused(uni);)
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000158 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000159 GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fFSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000160 }
161 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000162 GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fVSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000163 }
164}
165
egdaniel018fb622015-10-28 07:26:40 -0700166void GrGLProgramDataManager::set3f(UniformHandle u, float v0, float v1, float v2) const {
joshualitte7afc2d2015-09-11 10:44:13 -0700167 const Uniform& uni = fUniforms[u.toIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000168 SkASSERT(uni.fType == kVec3f_GrSLType);
egdaniel0d3f0612015-10-21 10:45:48 -0700169 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount);
joshualitt7d022d62015-05-12 12:03:50 -0700170 SkDEBUGCODE(this->printUnused(uni);)
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000171 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000172 GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fFSLocation, v0, v1, v2));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000173 }
174 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000175 GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fVSLocation, v0, v1, v2));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000176 }
177}
178
kkinnunen7510b222014-07-30 00:04:16 -0700179void GrGLProgramDataManager::set3fv(UniformHandle u,
180 int arrayCount,
egdaniel018fb622015-10-28 07:26:40 -0700181 const float v[]) const {
joshualitte7afc2d2015-09-11 10:44:13 -0700182 const Uniform& uni = fUniforms[u.toIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000183 SkASSERT(uni.fType == kVec3f_GrSLType);
184 SkASSERT(arrayCount > 0);
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000185 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
joshualitt7d022d62015-05-12 12:03:50 -0700186 SkDEBUGCODE(this->printUnused(uni);)
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000187 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000188 GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fFSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000189 }
190 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000191 GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fVSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000192 }
193}
194
kkinnunen7510b222014-07-30 00:04:16 -0700195void GrGLProgramDataManager::set4f(UniformHandle u,
egdaniel018fb622015-10-28 07:26:40 -0700196 float v0,
197 float v1,
198 float v2,
199 float v3) const {
joshualitte7afc2d2015-09-11 10:44:13 -0700200 const Uniform& uni = fUniforms[u.toIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000201 SkASSERT(uni.fType == kVec4f_GrSLType);
egdaniel0d3f0612015-10-21 10:45:48 -0700202 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount);
joshualitt7d022d62015-05-12 12:03:50 -0700203 SkDEBUGCODE(this->printUnused(uni);)
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000204 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000205 GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fFSLocation, v0, v1, v2, v3));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000206 }
207 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.org9188a152013-09-05 18:28:24 +0000208 GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fVSLocation, v0, v1, v2, v3));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000209 }
210}
211
kkinnunen7510b222014-07-30 00:04:16 -0700212void GrGLProgramDataManager::set4fv(UniformHandle u,
213 int arrayCount,
egdaniel018fb622015-10-28 07:26:40 -0700214 const float v[]) const {
joshualitte7afc2d2015-09-11 10:44:13 -0700215 const Uniform& uni = fUniforms[u.toIndex()];
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000216 SkASSERT(uni.fType == kVec4f_GrSLType);
217 SkASSERT(arrayCount > 0);
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000218 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
joshualitt7d022d62015-05-12 12:03:50 -0700219 SkDEBUGCODE(this->printUnused(uni);)
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000220 if (kUnusedUniform != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000221 GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fFSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000222 }
223 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000224 GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fVSLocation, arrayCount, v));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000225 }
226}
227
cdalton8d988b32016-03-07 15:39:09 -0800228void GrGLProgramDataManager::setMatrix2f(UniformHandle u, const float matrix[]) const {
229 this->setMatrices<2>(u, 1, matrix);
230}
231
egdaniel018fb622015-10-28 07:26:40 -0700232void GrGLProgramDataManager::setMatrix3f(UniformHandle u, const float matrix[]) const {
cdalton8d988b32016-03-07 15:39:09 -0800233 this->setMatrices<3>(u, 1, matrix);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000234}
235
egdaniel018fb622015-10-28 07:26:40 -0700236void GrGLProgramDataManager::setMatrix4f(UniformHandle u, const float matrix[]) const {
cdalton8d988b32016-03-07 15:39:09 -0800237 this->setMatrices<4>(u, 1, matrix);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000238}
239
cdalton8d988b32016-03-07 15:39:09 -0800240void GrGLProgramDataManager::setMatrix2fv(UniformHandle u, int arrayCount, const float m[]) const {
241 this->setMatrices<2>(u, arrayCount, m);
242}
243
244void GrGLProgramDataManager::setMatrix3fv(UniformHandle u, int arrayCount, const float m[]) const {
245 this->setMatrices<3>(u, arrayCount, m);
246}
247
248void GrGLProgramDataManager::setMatrix4fv(UniformHandle u, int arrayCount, const float m[]) const {
249 this->setMatrices<4>(u, arrayCount, m);
250}
251
252template<int N> struct set_uniform_matrix;
253
254template<int N> inline void GrGLProgramDataManager::setMatrices(UniformHandle u,
255 int arrayCount,
256 const float matrices[]) const {
joshualitte7afc2d2015-09-11 10:44:13 -0700257 const Uniform& uni = fUniforms[u.toIndex()];
cdalton8d988b32016-03-07 15:39:09 -0800258 SkASSERT(uni.fType == kMat22f_GrSLType + (N - 2));
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +0000259 SkASSERT(arrayCount > 0);
commit-bot@chromium.orgd3baf202013-11-07 22:06:08 +0000260 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
joshualitt7d022d62015-05-12 12:03:50 -0700261 SkDEBUGCODE(this->printUnused(uni);)
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000262 if (kUnusedUniform != uni.fFSLocation) {
cdalton8d988b32016-03-07 15:39:09 -0800263 set_uniform_matrix<N>::set(fGpu->glInterface(), uni.fFSLocation, arrayCount, matrices);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000264 }
265 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation) {
cdalton8d988b32016-03-07 15:39:09 -0800266 set_uniform_matrix<N>::set(fGpu->glInterface(), uni.fVSLocation, arrayCount, matrices);
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000267 }
268}
269
cdalton8d988b32016-03-07 15:39:09 -0800270template<> struct set_uniform_matrix<2> {
271 inline static void set(const GrGLInterface* gli, const GrGLint loc, int cnt, const float m[]) {
272 GR_GL_CALL(gli, UniformMatrix2fv(loc, cnt, false, m));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000273 }
cdalton8d988b32016-03-07 15:39:09 -0800274};
275
276template<> struct set_uniform_matrix<3> {
277 inline static void set(const GrGLInterface* gli, const GrGLint loc, int cnt, const float m[]) {
278 GR_GL_CALL(gli, UniformMatrix3fv(loc, cnt, false, m));
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000279 }
cdalton8d988b32016-03-07 15:39:09 -0800280};
281
282template<> struct set_uniform_matrix<4> {
283 inline static void set(const GrGLInterface* gli, const GrGLint loc, int cnt, const float m[]) {
284 GR_GL_CALL(gli, UniformMatrix4fv(loc, cnt, false, m));
285 }
286};
bsalomon@google.comdbbc4e22012-07-25 17:48:39 +0000287
egdaniel0eafe792015-11-20 14:01:22 -0800288void GrGLProgramDataManager::setPathFragmentInputTransform(VaryingHandle u,
joshualittd8dd47b2015-09-11 11:45:01 -0700289 int components,
290 const SkMatrix& matrix) const {
291 SkASSERT(fGpu->glCaps().shaderCaps()->pathRenderingSupport());
egdaniel0eafe792015-11-20 14:01:22 -0800292 const PathProcVarying& fragmentInput = fPathProcVaryings[u.toIndex()];
joshualittd8dd47b2015-09-11 11:45:01 -0700293
294 SkASSERT((components == 2 && fragmentInput.fType == kVec2f_GrSLType) ||
295 (components == 3 && fragmentInput.fType == kVec3f_GrSLType));
296
297 fGpu->glPathRendering()->setProgramPathFragmentInputTransform(fProgramID,
298 fragmentInput.fLocation,
299 GR_GL_OBJECT_LINEAR,
300 components,
301 matrix);
302}
303
joshualittaf2d56d2015-05-11 06:21:34 -0700304#ifdef SK_DEBUG
305void GrGLProgramDataManager::printUnused(const Uniform& uni) const {
306 if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation) {
bsalomon682c2692015-05-22 14:01:46 -0700307 GrCapsDebugf(fGpu->caps(), "Unused uniform in shader\n");
joshualittaf2d56d2015-05-11 06:21:34 -0700308 }
309}
310#endif