From a7ebf0ddc346756a89c0ea104e41d75ee752cb72 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 30 Jun 2022 12:39:10 +0200 Subject: added CPU uniform location lookup optimization --- src/render/Shader.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/render/Shader.cpp') 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 -- cgit v1.2.3