You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
Proper texture reloading (was broken).
This commit is contained in:
@@ -246,7 +246,13 @@ void ResourceImporterTexture::_save_stex(const Ref<Image> &p_image, const String
|
|||||||
f->store_32(0); //texture flags deprecated
|
f->store_32(0); //texture flags deprecated
|
||||||
|
|
||||||
uint32_t format = 0;
|
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)
|
if (p_streamable)
|
||||||
format |= StreamTexture::FORMAT_BIT_STREAM;
|
format |= StreamTexture::FORMAT_BIT_STREAM;
|
||||||
if (p_mipmaps)
|
if (p_mipmaps)
|
||||||
|
|||||||
@@ -1125,22 +1125,23 @@ void RasterizerSceneForwardRD::_add_geometry(InstanceBase *p_instance, uint32_t
|
|||||||
|
|
||||||
if (!material) {
|
if (!material) {
|
||||||
material = (MaterialData *)storage->material_get_data(default_material, RasterizerStorageRD::SHADER_TYPE_3D);
|
material = (MaterialData *)storage->material_get_data(default_material, RasterizerStorageRD::SHADER_TYPE_3D);
|
||||||
|
m_src = default_material;
|
||||||
}
|
}
|
||||||
|
|
||||||
ERR_FAIL_COND(!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()) {
|
while (material->next_pass.is_valid()) {
|
||||||
|
|
||||||
material = (MaterialData *)storage->material_get_data(material->next_pass, RasterizerStorageRD::SHADER_TYPE_3D);
|
material = (MaterialData *)storage->material_get_data(material->next_pass, RasterizerStorageRD::SHADER_TYPE_3D);
|
||||||
if (!material || !material->shader_data->valid)
|
if (!material || !material->shader_data->valid)
|
||||||
break;
|
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_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);
|
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;
|
e->sort_key = 0;
|
||||||
|
|
||||||
if (e->material->last_pass != render_pass) {
|
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->last_pass = render_pass;
|
||||||
e->material->index = scene_state.current_material_index++;
|
e->material->index = scene_state.current_material_index++;
|
||||||
if (e->material->shader_data->last_pass != render_pass) {
|
if (e->material->shader_data->last_pass != render_pass) {
|
||||||
|
|||||||
@@ -501,7 +501,7 @@ class RasterizerSceneForwardRD : public RasterizerSceneRD {
|
|||||||
void _fill_instances(RenderList::Element **p_elements, int p_element_count);
|
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);
|
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(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);
|
void _fill_render_list(InstanceBase **p_cull_result, int p_cull_count, PassMode p_pass_mode, bool p_no_gi);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user