MCPcopy Create free account
hub / github.com/Tencent/tgfx / getUniformDeclarations

Method getUniformDeclarations

src/gpu/UniformHandler.cpp:83–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83std::string UniformHandler::getUniformDeclarations(ShaderStage stage) const {
84 std::string ret;
85 auto& uniforms = stage == ShaderStage::Vertex ? vertexUniforms : fragmentUniforms;
86 auto shaderCaps = programBuilder->getContext()->caps()->shaderCaps();
87 if (shaderCaps->uboSupport) {
88 ret += programBuilder->getUniformBlockDeclaration(stage, uniforms);
89 } else {
90 for (auto& uniform : uniforms) {
91 ret += programBuilder->getShaderVarDeclarations(ShaderVar(uniform), stage);
92 ret += ";\n";
93 }
94 }
95
96 if (stage == ShaderStage::Fragment) {
97 for (const auto& sampler : samplers) {
98 ret += programBuilder->getShaderVarDeclarations(ShaderVar(sampler), stage);
99 ret += ";\n";
100 }
101 }
102 return ret;
103}
104
105} // namespace tgfx

Callers 1

finalizeMethod · 0.80

Calls 6

ShaderVarClass · 0.85
shaderCapsMethod · 0.80
capsMethod · 0.45
getContextMethod · 0.45

Tested by

no test coverage detected