Fix empty shader related crash, closes #8314

This commit is contained in:
Juan Linietsky 2017-06-12 19:23:37 -03:00
parent 41c3ca358e
commit 831860695c
3 changed files with 8 additions and 2 deletions

View file

@ -2113,7 +2113,7 @@ void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geo
if (m_src.is_valid()) {
m = storage->material_owner.getornull(m_src);
if (!m->shader) {
if (!m->shader || !m->shader->valid) {
m = NULL;
}
}

View file

@ -1425,6 +1425,7 @@ void RasterizerStorageGLES3::_update_shader(Shader *p_shader) const {
_shader_dirty_list.remove(&p_shader->dirty_list);
p_shader->valid = false;
p_shader->ubo_size = 0;
p_shader->uniforms.clear();
@ -2244,6 +2245,10 @@ void RasterizerStorageGLES3::_update_material(Material *material) {
if (material->shader && material->shader->dirty_list.in_list()) {
_update_shader(material->shader);
}
if (material->shader && !material->shader->valid)
return;
//update caches
{

View file

@ -552,7 +552,8 @@ ShaderEditorPlugin::ShaderEditorPlugin(EditorNode *p_node) {
shader_editor = memnew(ShaderEditor);
shader_editor->set_custom_minimum_size(Size2(0, 300));
button = editor->add_bottom_panel_item("Shader", shader_editor);
button = editor->add_bottom_panel_item(TTR("Shader"), shader_editor);
button->hide();
}
ShaderEditorPlugin::~ShaderEditorPlugin() {