diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-06-30 12:39:10 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-06-30 12:39:10 +0200 |
| commit | a7ebf0ddc346756a89c0ea104e41d75ee752cb72 (patch) | |
| tree | 247e51605bd1a9936fdde7009476d56723dd1d0b /src/render/Shader.cpp | |
| parent | 4101006b5ed20efbde2accfbff0403e1ced3d113 (diff) | |
added CPU uniform location lookup optimization
Diffstat (limited to 'src/render/Shader.cpp')
| -rw-r--r-- | src/render/Shader.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/render/Shader.cpp b/src/render/Shader.cpp index e69de29b..96b3caf7 100644 --- a/src/render/Shader.cpp +++ b/src/render/Shader.cpp @@ -0,0 +1,13 @@ +#include "Shader.hpp" + +GLint CShader::getUniformLocation(const std::string& unif) { + const auto itpos = m_muUniforms.find(unif); + + if (itpos == m_muUniforms.end()) { + const auto unifLoc = glGetUniformLocation(program, unif.c_str()); + m_muUniforms[unif] = unifLoc; + return unifLoc; + } + + return itpos->second; +}
\ No newline at end of file |
