Godot version:
22ee7ba4f
OS/device including version:
macOS Mojave / Intel HD Graphics 5000
Issue description:
Due to severe fps drops, I was profiling my game with Xcode Instruments,
and I found quite a lot of time is consumed in glGetActiveUnform
in ShaderGLES2::bind
like below.
After looking at related codes, the function is called for setting uniform_names
variable of ShaderGLES2::Version
but I couldn't find any reference of that variable.
https://github.com/godotengine/godot/blob/caa42667e801318fcb78c9f52921a48cf985b62f/drivers/gles2/shader_gles2.cpp#L148-L162
Moreover, even though this does not affect the performance, the function bind_uniforms
in ShaderGLES2::bind
has no effect.(bind_uniforms
sets the uniforms according to the variables uniform_defaults
and uniform_cameras
, but no one access these variables)
Because of this, the variable uniforms_dirty
is not necessary since its sole purpose seems to control the behavior of bind_uniforms
.
I could've submitted PR according to my analysis but I'd like to confirm this from more involved person.
Ah.. I worked on every file of the GLES2 renderer except this one... you are right, this is a very severe performance bottleneck. Thanks for pointing it out!
Wow, I fixed this and got a massive performance improvement in GLES2, this is pretty cool.
Most helpful comment
Wow, I fixed this and got a massive performance improvement in GLES2, this is pretty cool.