Преглед изворни кода

Fix empty shader related crash, closes #8314

Juan Linietsky пре 8 година
родитељ
комит
831860695c

+ 1 - 1
drivers/gles3/rasterizer_scene_gles3.cpp

@@ -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;
 		}
 	}

+ 5 - 0
drivers/gles3/rasterizer_storage_gles3.cpp

@@ -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
 
 	{

+ 2 - 1
editor/plugins/shader_editor_plugin.cpp

@@ -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() {