diff options
| author | Uneven Prankster <unevenprankster@protonmail.com> | 2023-07-25 09:50:15 -0300 |
|---|---|---|
| committer | Uneven Prankster <unevenprankster@protonmail.com> | 2023-07-25 09:50:15 -0300 |
| commit | 027673211d9b0d78fc7aad54fa4321dbe0242e5c (patch) | |
| tree | 782cb9de827844d146b6a5bd23f03be30c75bce0 | |
| parent | 7dffe7df840bc0081767fafde90af78ce96bf300 (diff) | |
Check if new shader is actually ok before replacing.
| -rw-r--r-- | src/shader_sys.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/shader_sys.c b/src/shader_sys.c index 0fcc6ce..65c8bd4 100644 --- a/src/shader_sys.c +++ b/src/shader_sys.c @@ -127,10 +127,15 @@ void update_shaders(void) i32 current_mod = GetFileModTime(shader_paths[i]); if(current_mod != shader_modtimes[i]){ - shader_modtimes[i] = current_mod; - - UnloadShader(shader_slots[i]); - shader_slots[i] = load_joined_shader(shader_paths[i]); + shader_modtimes[i] = current_mod; + + Shader attempt = load_joined_shader(shader_paths[i]); + + if(IsShaderReady(attempt)){ + UnloadShader(shader_slots[i]); + + shader_slots[i] = attempt; + } } } } |
