blob: ace0311922fb9744d4db68ac84b2792d45db758f [file] [log] [blame]
Ethan Nicholas58430122020-04-14 09:54:02 -04001/*
2 * Copyright 2020 Google LLC
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 "src/gpu/glsl/GrGLSLUniformHandler.h"
9
10#include "src/gpu/glsl/GrGLSL.h"
11#include "src/gpu/glsl/GrGLSLShaderBuilder.h"
12
13void GrGLSLUniformHandler::writeUniformMappings(GrFragmentProcessor* owner,
14 GrGLSLShaderBuilder* b) {
15 for (int i = this->numUniforms() - 1; i >= 0; i--) {
16 UniformInfo& u = this->uniform(i);
17 if (u.fOwner == owner) {
18 u.fVisibility |= kVertex_GrShaderFlag;
19 b->codeAppendf("%s %s = %s;\n", GrGLSLTypeString(u.fVariable.getType()),
20 u.fRawName.c_str(), u.fVariable.getName().c_str());
21 }
22 }
23}