Skip to content

Commit

Permalink
Merge pull request #58808 from The-O-King/shader_state_blend_shapes
Browse files Browse the repository at this point in the history
Fix shader state caching when blend shapes used
  • Loading branch information
akien-mga authored Mar 6, 2022
2 parents f622c60 + 9988739 commit b81251d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/gles3/rasterizer_scene_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1297,8 +1297,6 @@ void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e, const Transfo
if (s->blend_shapes.size() && e->instance->blend_values.size()) {
//blend shapes, use transform feedback
storage->mesh_render_blend_shapes(s, e->instance->blend_values.read().ptr());
//disable octahedral compression as the result of blend shapes is always uncompressed cartesian coordinates
state.scene_shader.set_conditional(SceneShaderGLES3::ENABLE_OCTAHEDRAL_COMPRESSION, false);
//rebind shader
state.scene_shader.bind();
#ifdef DEBUG_ENABLED
Expand Down Expand Up @@ -2147,7 +2145,9 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_

state.scene_shader.set_conditional(SceneShaderGLES3::USE_PHYSICAL_LIGHT_ATTENUATION, storage->config.use_physical_light_attenuation);

bool octahedral_compression = e->instance->base_type != VS::INSTANCE_IMMEDIATE && ((RasterizerStorageGLES3::Surface *)e->geometry)->format & VisualServer::ArrayFormat::ARRAY_FLAG_USE_OCTAHEDRAL_COMPRESSION;
bool octahedral_compression = e->instance->base_type != VS::INSTANCE_IMMEDIATE &&
((RasterizerStorageGLES3::Surface *)e->geometry)->format & VisualServer::ArrayFormat::ARRAY_FLAG_USE_OCTAHEDRAL_COMPRESSION &&
!(((RasterizerStorageGLES3::Surface *)e->geometry)->blend_shapes.size() && e->instance->blend_values.size());
if (octahedral_compression != prev_octahedral_compression) {
state.scene_shader.set_conditional(SceneShaderGLES3::ENABLE_OCTAHEDRAL_COMPRESSION, octahedral_compression);
rebind = true;
Expand Down

0 comments on commit b81251d

Please sign in to comment.