| 81 | } |
| 82 | |
| 83 | std::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 |
no test coverage detected