mirror of
https://github.com/godotengine/godot
synced 2024-09-15 23:46:15 +00:00
Avoid crash when importing .glsl in headless
This commit is contained in:
parent
b7feebefab
commit
c1d5a2c8c6
|
@ -92,6 +92,7 @@ static String _include_function(const String &p_path, void *userpointer) {
|
||||||
Error ResourceImporterShaderFile::import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
|
Error ResourceImporterShaderFile::import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
|
||||||
/* STEP 1, Read shader code */
|
/* STEP 1, Read shader code */
|
||||||
ERR_FAIL_COND_V_EDMSG((OS::get_singleton()->get_current_rendering_method() == "gl_compatibility"), ERR_UNAVAILABLE, "Cannot import custom .glsl shaders when using the gl_compatibility rendering_method. Please switch to the forward_plus or mobile rendering methods to use custom shaders.");
|
ERR_FAIL_COND_V_EDMSG((OS::get_singleton()->get_current_rendering_method() == "gl_compatibility"), ERR_UNAVAILABLE, "Cannot import custom .glsl shaders when using the gl_compatibility rendering_method. Please switch to the forward_plus or mobile rendering methods to use custom shaders.");
|
||||||
|
ERR_FAIL_COND_V_EDMSG((DisplayServer::get_singleton()->get_name() == "headless"), ERR_UNAVAILABLE, "Cannot import custom .glsl shaders when running in headless mode.");
|
||||||
|
|
||||||
Error err;
|
Error err;
|
||||||
Ref<FileAccess> file = FileAccess::open(p_source_file, FileAccess::READ, &err);
|
Ref<FileAccess> file = FileAccess::open(p_source_file, FileAccess::READ, &err);
|
||||||
|
|
Loading…
Reference in a new issue