2 * Copyright 2020 Google LLC
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #include "src/gpu/ganesh/glsl/GrGLSLUniformHandler.h"
10 #include "src/gpu/ganesh/glsl/GrGLSL.h"
11 #include "src/gpu/ganesh/glsl/GrGLSLShaderBuilder.h"
13 GrShaderVar GrGLSLUniformHandler::getUniformMapping(const GrProcessor& owner,
14 SkString rawName) const {
15 for (int i = this->numUniforms() - 1; i >= 0; i--) {
16 const UniformInfo& u = this->uniform(i);
17 if (u.fOwner == &owner && u.fRawName == rawName) {
24 GrShaderVar GrGLSLUniformHandler::liftUniformToVertexShader(const GrProcessor& owner,
26 for (int i = this->numUniforms() - 1; i >= 0; i--) {
27 UniformInfo& u = this->uniform(i);
28 if (u.fOwner == &owner && u.fRawName == rawName) {
29 u.fVisibility |= kVertex_GrShaderFlag;
33 // Uniform not found; it's better to return a void variable than to assert because sample
34 // matrices that are uniform are treated the same for most of the code. When the sample
35 // matrix expression can't be found as a uniform, we can infer it's a constant.