Merge pull request #8141 from elasota/fix-unshaded-spillover
Fix renderer sometimes not applying "unshaded" flag (2.1)
This commit is contained in:
commit
93107f4245
|
@ -5971,6 +5971,7 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list, const Tran
|
|||
RID prev_baked_light_texture;
|
||||
const float *prev_morph_values = NULL;
|
||||
int prev_receive_shadows_state = -1;
|
||||
int prev_unshaded_state = -1;
|
||||
|
||||
material_shader.set_conditional(MaterialShaderGLES2::USE_VERTEX_LIGHTING, !shadow && !p_fragment_light);
|
||||
material_shader.set_conditional(MaterialShaderGLES2::USE_FRAGMENT_LIGHTING, !shadow && p_fragment_light);
|
||||
|
@ -6006,6 +6007,7 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list, const Tran
|
|||
const BakedLightData *baked_light = e->instance->baked_light;
|
||||
const float *morph_values = e->instance->morph_values.ptr();
|
||||
int receive_shadows_state = e->instance->receive_shadows == true ? 1 : 0;
|
||||
int unshaded_state = (material->flags[VS::MATERIAL_FLAG_UNSHADED] || current_debug == VS::SCENARIO_DEBUG_SHADELESS) ? 1 : 0;
|
||||
|
||||
bool rebind = false;
|
||||
bool bind_baked_light_octree = false;
|
||||
|
@ -6028,15 +6030,16 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list, const Tran
|
|||
prev_sort_flags = 0xFF;
|
||||
prev_morph_values = NULL;
|
||||
prev_receive_shadows_state = -1;
|
||||
prev_unshaded_state = -1;
|
||||
glEnable(GL_BLEND);
|
||||
glDepthMask(GL_TRUE);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
if (light_type != prev_light_type || receive_shadows_state != prev_receive_shadows_state) {
|
||||
if (light_type != prev_light_type || receive_shadows_state != prev_receive_shadows_state || unshaded_state != prev_unshaded_state) {
|
||||
|
||||
if (material->flags[VS::MATERIAL_FLAG_UNSHADED] || current_debug == VS::SCENARIO_DEBUG_SHADELESS) {
|
||||
if (unshaded_state == 1) {
|
||||
material_shader.set_conditional(MaterialShaderGLES2::LIGHT_TYPE_DIRECTIONAL, false);
|
||||
material_shader.set_conditional(MaterialShaderGLES2::LIGHT_TYPE_OMNI, false);
|
||||
material_shader.set_conditional(MaterialShaderGLES2::LIGHT_TYPE_SPOT, false);
|
||||
|
@ -6385,6 +6388,7 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list, const Tran
|
|||
prev_baked_light = baked_light;
|
||||
prev_morph_values = morph_values;
|
||||
prev_receive_shadows_state = receive_shadows_state;
|
||||
prev_unshaded_state = unshaded_state;
|
||||
}
|
||||
|
||||
//print_line("shaderchanges: "+itos(p_alpha_pass)+": "+itos(_rinfo.shader_change_count));
|
||||
|
|
Loading…
Reference in New Issue