Godot: Dead codes make severe performance degradation (GLES2)

Created on 27 Feb 2019  路  2Comments  路  Source: godotengine/godot

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.
screen shot 2019-02-27 at 3 19 05 pm

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.

bug rendering

Most helpful comment

Wow, I fixed this and got a massive performance improvement in GLES2, this is pretty cool.

All 2 comments

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.

Was this page helpful?
0 / 5 - 0 ratings