summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editor/import/resource_importer_texture.cpp8
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp11
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.h2
3 files changed, 16 insertions, 5 deletions
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index 32bf9c6f40..b29f78c236 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -246,7 +246,13 @@ void ResourceImporterTexture::_save_stex(const Ref<Image> &p_image, const String
f->store_32(0); //texture flags deprecated
uint32_t format = 0;
-
+ /*
+ print_line("streamable " + itos(p_streamable));
+ print_line("mipmaps " + itos(p_mipmaps));
+ print_line("detect_3d " + itos(p_detect_3d));
+ print_line("roughness " + itos(p_detect_roughness));
+ print_line("normal " + itos(p_detect_normal));
+*/
if (p_streamable)
format |= StreamTexture::FORMAT_BIT_STREAM;
if (p_mipmaps)
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);