Merge pull request #37666 from clayjohn/GLES2-4-skeleton-rebind
Avoid material rebinds when using skeletons
This commit is contained in:
commit
b1cd4da91b
1 changed files with 9 additions and 9 deletions
|
@ -2501,16 +2501,16 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
|
||||||
RasterizerStorageGLES2::Skeleton *skeleton = storage->skeleton_owner.getornull(e->instance->skeleton);
|
RasterizerStorageGLES2::Skeleton *skeleton = storage->skeleton_owner.getornull(e->instance->skeleton);
|
||||||
|
|
||||||
if (skeleton != prev_skeleton) {
|
if (skeleton != prev_skeleton) {
|
||||||
|
if ((prev_skeleton == nullptr) != (skeleton == nullptr)) {
|
||||||
if (skeleton) {
|
if (skeleton) {
|
||||||
state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON, true);
|
state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON, true);
|
||||||
state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON_SOFTWARE, storage->config.use_skeleton_software);
|
state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON_SOFTWARE, storage->config.use_skeleton_software);
|
||||||
} else {
|
} else {
|
||||||
state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON, false);
|
state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON, false);
|
||||||
state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON_SOFTWARE, 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) {
|
if (e->owner != prev_owner || e->geometry != prev_geometry || skeleton != prev_skeleton) {
|
||||||
|
|
Loading…
Reference in a new issue