Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
gpu
ganesh
glsl
GrGLSLUniformHandler.cpp
Go to the documentation of this file.
1
/*
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/ganesh/glsl/GrGLSLUniformHandler.h
"
9
10
GrShaderVar
GrGLSLUniformHandler::getUniformMapping
(
const
GrProcessor
& owner,
11
SkString
rawName)
const
{
12
for
(
int
i = this->
numUniforms
() - 1; i >= 0; i--) {
13
const
UniformInfo
& u = this->
uniform
(i);
14
if
(u.
fOwner
== &owner && u.
fRawName
== rawName) {
15
return
u.
fVariable
;
16
}
17
}
18
return
GrShaderVar
();
19
}
20
21
GrShaderVar
GrGLSLUniformHandler::liftUniformToVertexShader
(
const
GrProcessor
& owner,
22
SkString
rawName) {
23
for
(
int
i = this->
numUniforms
() - 1; i >= 0; i--) {
24
UniformInfo
& u = this->
uniform
(i);
25
if
(u.
fOwner
== &owner && u.
fRawName
== rawName) {
26
u.
fVisibility
|=
kVertex_GrShaderFlag
;
27
return
u.
fVariable
;
28
}
29
}
30
// Uniform not found; it's better to return a void variable than to assert because sample
31
// matrices that are uniform are treated the same for most of the code. When the sample
32
// matrix expression can't be found as a uniform, we can infer it's a constant.
33
return
GrShaderVar
();
34
}
GrGLSLUniformHandler.h
kVertex_GrShaderFlag
@ kVertex_GrShaderFlag
Definition
GrTypesPriv.h:285
GrGLSLUniformHandler::uniform
virtual UniformInfo & uniform(int idx)=0
GrGLSLUniformHandler::numUniforms
virtual int numUniforms() const =0
GrGLSLUniformHandler::liftUniformToVertexShader
GrShaderVar liftUniformToVertexShader(const GrProcessor &owner, SkString rawName)
Definition
GrGLSLUniformHandler.cpp:21
GrGLSLUniformHandler::getUniformMapping
GrShaderVar getUniformMapping(const GrProcessor &owner, SkString rawName) const
Definition
GrGLSLUniformHandler.cpp:10
GrProcessor
Definition
GrProcessor.h:22
GrShaderVar
Definition
GrShaderVar.h:20
SkString
Definition
SkString.h:118
GrGLSLUniformHandler::UniformInfo
Definition
GrGLSLUniformHandler.h:43
GrGLSLUniformHandler::UniformInfo::fOwner
const GrProcessor * fOwner
Definition
GrGLSLUniformHandler.h:46
GrGLSLUniformHandler::UniformInfo::fVisibility
uint32_t fVisibility
Definition
GrGLSLUniformHandler.h:45
GrGLSLUniformHandler::UniformInfo::fRawName
SkString fRawName
Definition
GrGLSLUniformHandler.h:47
GrGLSLUniformHandler::UniformInfo::fVariable
GrShaderVar fVariable
Definition
GrGLSLUniformHandler.h:44
Generated on Fri Apr 26 2024 06:17:02 for Flutter Engine by
1.9.8