Skip to content

Commit

Permalink
Merge pull request #92539 from RandomShaper/no_crash_glsl_headless
Browse files Browse the repository at this point in the history
Avoid crash when importing .glsl in headless
  • Loading branch information
akien-mga committed May 30, 2024
2 parents be2c5e6 + c1d5a2c commit ff242e2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions editor/import/resource_importer_shader_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
/* 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((DisplayServer::get_singleton()->get_name() == "headless"), ERR_UNAVAILABLE, "Cannot import custom .glsl shaders when running in headless mode.");

Error err;
Ref<FileAccess> file = FileAccess::open(p_source_file, FileAccess::READ, &err);
Expand Down

0 comments on commit ff242e2

Please sign in to comment.