Skip to content

Commit

Permalink
Add shader_cache_dir_valid check to _save_to_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
jsjtxietian committed Jan 12, 2024
1 parent 3524346 commit a365c07
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions drivers/gles3/shader_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ void ShaderGLES3::_save_to_cache(Version *p_version) {
#ifdef WEB_ENABLED // not supported in webgl
return;
#else
ERR_FAIL_COND(!shader_cache_dir_valid);
#if !defined(ANDROID_ENABLED) && !defined(IOS_ENABLED)
if (RasterizerGLES3::is_gles_over_gl() && (glGetProgramBinary == NULL)) { // ARB_get_program_binary extension not available.
return;
Expand Down
4 changes: 3 additions & 1 deletion drivers/gles3/shader_gles3.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ class ShaderGLES3 {
_compile_specialization(s, p_variant, version, p_specialization);
version->variants[p_variant].insert(p_specialization, s);
spec = version->variants[p_variant].lookup_ptr(p_specialization);
_save_to_cache(version);
if (shader_cache_dir_valid) {
_save_to_cache(version);
}
}
} else if (spec->build_queued) {
// Still queued, wait
Expand Down
1 change: 1 addition & 0 deletions servers/rendering/renderer_rd/shader_rd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ bool ShaderRD::_load_from_cache(Version *p_version, int p_group) {
}

void ShaderRD::_save_to_cache(Version *p_version, int p_group) {
ERR_FAIL_COND(!shader_cache_dir_valid);
String sha1 = _version_get_sha1(p_version);
String path = shader_cache_dir.path_join(name).path_join(group_sha256[p_group]).path_join(sha1) + ".cache";

Expand Down

0 comments on commit a365c07

Please sign in to comment.