aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/phenax/utils
diff options
context:
space:
mode:
Diffstat (limited to '')
-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