diff options
author | Juan Linietsky <reduzio@gmail.com> | 2019-09-16 15:51:33 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-02-11 12:01:25 +0100 |
commit | dc32083681a770e9d7e332c5beed30b52c793752 (patch) | |
tree | 1baaa88b80ed40ae1f19dfc1ad812fa130b8ab61 /servers/visual | |
parent | dd3682e5feb433117fbf62c363c7ba6ff214f8fa (diff) |
Proper texture reloading (was broken).
Diffstat (limited to 'servers/visual')
-rw-r--r-- | servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp | 11 | ||||
-rw-r--r-- | servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.h | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp index 7164624c9f..82a5d8ba65 100644 --- a/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp @@ -1125,22 +1125,23 @@ void RasterizerSceneForwardRD::_add_geometry(InstanceBase *p_instance, uint32_t if (!material) { material = (MaterialData *)storage->material_get_data(default_material, RasterizerStorageRD::SHADER_TYPE_3D); + m_src = default_material; } ERR_FAIL_COND(!material); - _add_geometry_with_material(p_instance, p_surface, material, p_pass_mode, p_geometry_index); + _add_geometry_with_material(p_instance, p_surface, material, m_src, p_pass_mode, p_geometry_index); while (material->next_pass.is_valid()) { material = (MaterialData *)storage->material_get_data(material->next_pass, RasterizerStorageRD::SHADER_TYPE_3D); if (!material || !material->shader_data->valid) break; - _add_geometry_with_material(p_instance, p_surface, material, p_pass_mode, p_geometry_index); + _add_geometry_with_material(p_instance, p_surface, material, material->next_pass, p_pass_mode, p_geometry_index); } } -void RasterizerSceneForwardRD::_add_geometry_with_material(InstanceBase *p_instance, uint32_t p_surface, MaterialData *p_material, PassMode p_pass_mode, uint32_t p_geometry_index) { +void RasterizerSceneForwardRD::_add_geometry_with_material(InstanceBase *p_instance, uint32_t p_surface, MaterialData *p_material, RID p_material_rid, PassMode p_pass_mode, uint32_t p_geometry_index) { bool has_read_screen_alpha = p_material->shader_data->uses_screen_texture || p_material->shader_data->uses_depth_texture || p_material->shader_data->uses_normal_texture; bool has_base_alpha = (p_material->shader_data->uses_alpha || has_read_screen_alpha); @@ -1195,6 +1196,10 @@ void RasterizerSceneForwardRD::_add_geometry_with_material(InstanceBase *p_insta e->sort_key = 0; if (e->material->last_pass != render_pass) { + if (!RD::get_singleton()->uniform_set_is_valid(e->material->uniform_set)) { + //uniform set no longer valid, probably a texture changed + storage->material_force_update_textures(p_material_rid, RasterizerStorageRD::SHADER_TYPE_3D); + } e->material->last_pass = render_pass; e->material->index = scene_state.current_material_index++; if (e->material->shader_data->last_pass != render_pass) { diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.h b/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.h index 912d62b1d8..bd6d6563f5 100644 --- a/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.h +++ b/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.h @@ -501,7 +501,7 @@ class RasterizerSceneForwardRD : public RasterizerSceneRD { void _fill_instances(RenderList::Element **p_elements, int p_element_count); void _render_list(RenderingDevice::DrawListID p_draw_list, RenderingDevice::FramebufferFormatID p_framebuffer_Format, RenderList::Element **p_elements, int p_element_count, bool p_reverse_cull, PassMode p_pass_mode, bool p_no_gi); _FORCE_INLINE_ void _add_geometry(InstanceBase *p_instance, uint32_t p_surface, RID p_material, PassMode p_pass_mode, uint32_t p_geometry_index); - _FORCE_INLINE_ void _add_geometry_with_material(InstanceBase *p_instance, uint32_t p_surface, MaterialData *p_material, PassMode p_pass_mode, uint32_t p_geometry_index); + _FORCE_INLINE_ void _add_geometry_with_material(InstanceBase *p_instance, uint32_t p_surface, MaterialData *p_material, RID p_material_rid, PassMode p_pass_mode, uint32_t p_geometry_index); void _fill_render_list(InstanceBase **p_cull_result, int p_cull_count, PassMode p_pass_mode, bool p_no_gi); |