summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclayjohn <claynjohn@gmail.com>2020-04-07 10:34:35 -0700
committerclayjohn <claynjohn@gmail.com>2020-04-07 10:34:35 -0700
commit3db61ce91c3d2ee0e91217e8ccae45007fd3a2bf (patch)
tree5fe59895139351f4713fb2637913685f2f043779
parenta10f28ff342c9503d3b5c82c48517e21dbbc7a77 (diff)
Avoid material rebinds when using skeletons
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
index 8d4c6e87fa..2ba2147de9 100644
--- a/drivers/gles2/rasterizer_scene_gles2.cpp
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -2501,16 +2501,16 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
RasterizerStorageGLES2::Skeleton *skeleton = storage->skeleton_owner.getornull(e->instance->skeleton);
if (skeleton != prev_skeleton) {
-
- if (skeleton) {
- state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON, true);
- state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON_SOFTWARE, storage->config.use_skeleton_software);
- } else {
- state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON, false);
- state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON_SOFTWARE, false);
+ if ((prev_skeleton == nullptr) != (skeleton == nullptr)) {
+ if (skeleton) {
+ state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON, true);
+ state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON_SOFTWARE, storage->config.use_skeleton_software);
+ } else {
+ state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON, false);
+ state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON_SOFTWARE, false);
+ }
+ rebind = true;
}
-
- rebind = true;
}
if (e->owner != prev_owner || e->geometry != prev_geometry || skeleton != prev_skeleton) {