-
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UPBGE: Avoid calling glGetUniformLocation while setting a uniform thr…
…ough BL_Shader. (#733) All the setUniform functions in BL_Shader are using name to identify the uniform, these functions call RAS_Shader::GetUniformLocation. This last function was naively calling indirectly glGetUniformLocation, but even simple OpenGL calls cost more than caching. Fortunatly OpenGL allows to enumerate all active uniforms thanks to glGetActiveUniform, this function is used in GPUShader side inside function GPU_shader_get_uniform_infos constructing a list of GPUUniformInfo storing the uniform location, size, type and name. These uniform info are used in RAS_Shader::ExtractUniformInfos which insert the info in a map associating to the name the location, size and type> This map is then used into GetUniformLocation. Tested with a 4 uniforms shader and 1000 updates : Previous : 3.26ms Current : 2.88ms
- Loading branch information
1 parent
155b83a
commit 18e5a96
Showing
4 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters