uniform location caching
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-05-22 21:12:00 -04:00
parent 4a23339807
commit 69429d70a4
2 changed files with 11 additions and 2 deletions

View File

@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file
#Thu May 22 18:46:40 EDT 2025
buildNumber=630
#Thu May 22 21:10:50 EDT 2025
buildNumber=632

View File

@ -45,6 +45,11 @@ public class VisualShader implements Shader {
* Map of uniform name -> data about the uniform
*/
private Map<String,ShaderUniform> uniformNameMap = new HashMap<String,ShaderUniform>();
/**
* Map of uniform name -> location of uniform
*/
public Map<String,Integer> uniformNameLocMap = new HashMap<String,Integer>();
/**
* The map of uniform location -> current value of uniform
@ -369,7 +374,11 @@ public class VisualShader implements Shader {
}
return uniform.getLocation();
}
if(this.uniformNameLocMap.containsKey(uniformName)){
return uniformNameLocMap.get(uniformName);
}
int rVal = GL40.glGetUniformLocation(this.getId(), uniformName);
uniformNameLocMap.put(uniformName,rVal);
if(Globals.renderingEngine.checkError()){
LoggerInterface.loggerRenderer.WARNING("Uniform failed with shader id " + this.getId());
}