Check if shader cache directory is available before using cache

This commit is contained in:
clayjohn 2023-07-25 14:33:37 +02:00
parent 0c2144da90
commit 52fb5bf986
1 changed files with 4 additions and 2 deletions

View File

@ -667,7 +667,7 @@ void ShaderGLES3::_clear_version(Version *p_version) {
void ShaderGLES3::_initialize_version(Version *p_version) { void ShaderGLES3::_initialize_version(Version *p_version) {
ERR_FAIL_COND(p_version->variants.size() > 0); ERR_FAIL_COND(p_version->variants.size() > 0);
if (_load_from_cache(p_version)) { if (shader_cache_dir_valid && _load_from_cache(p_version)) {
return; return;
} }
p_version->variants.reserve(variant_count); p_version->variants.reserve(variant_count);
@ -678,7 +678,9 @@ void ShaderGLES3::_initialize_version(Version *p_version) {
_compile_specialization(spec, i, p_version, specialization_default_mask); _compile_specialization(spec, i, p_version, specialization_default_mask);
p_version->variants[i].insert(specialization_default_mask, spec); p_version->variants[i].insert(specialization_default_mask, spec);
} }
_save_to_cache(p_version); if (shader_cache_dir_valid) {
_save_to_cache(p_version);
}
} }
void ShaderGLES3::version_set_code(RID p_version, const HashMap<String, String> &p_code, const String &p_uniforms, const String &p_vertex_globals, const String &p_fragment_globals, const Vector<String> &p_custom_defines, const LocalVector<ShaderGLES3::TextureUniformData> &p_texture_uniforms, bool p_initialize) { void ShaderGLES3::version_set_code(RID p_version, const HashMap<String, String> &p_code, const String &p_uniforms, const String &p_vertex_globals, const String &p_fragment_globals, const Vector<String> &p_custom_defines, const LocalVector<ShaderGLES3::TextureUniformData> &p_texture_uniforms, bool p_initialize) {