aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2026-09-10 00:30:25 +0530
committerAkshay Nair <phenax5@gmail.com>2026-09-10 00:30:25 +0530
commit41246c0567f4c48ec5788a291386e377241e0eed (patch)
tree09eb3140b51b3cb8b105e77b9711f65e5702d4df /src
parent80fd0d3c61f315b83c1eeda40daef31af01ad798 (diff)
downloadart-playground-openrndr-41246c0567f4c48ec5788a291386e377241e0eed.tar.gz
art-playground-openrndr-41246c0567f4c48ec5788a291386e377241e0eed.zip
Restore old shader if theres an error loading changes
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/phenax/utils/program.kt2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main/kotlin/phenax/utils/program.kt b/src/main/kotlin/phenax/utils/program.kt
index 6ff5379..a05307c 100644
--- a/src/main/kotlin/phenax/utils/program.kt
+++ b/src/main/kotlin/phenax/utils/program.kt
@@ -55,6 +55,8 @@ fun Program.liveComputeShader(name: String): ReadOnlyProperty<Any?, ComputeShade
try {
cs = ComputeShader.fromCode(shaderCode, name)
} catch (e: Exception) {
+ // Restore old shader if new code has error
+ cs = ComputeShader.fromCode(lastCompiledCode, name)
println("Shader compile failed: ${e.message}")
}
lastCompiledCode = shaderCode