summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org/gruf/go-ffmpreg/internal/wasm.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/codeberg.org/gruf/go-ffmpreg/internal/wasm.go')
-rw-r--r--vendor/codeberg.org/gruf/go-ffmpreg/internal/wasm.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/vendor/codeberg.org/gruf/go-ffmpreg/internal/wasm.go b/vendor/codeberg.org/gruf/go-ffmpreg/internal/wasm.go
new file mode 100644
index 000000000..94fdfbdde
--- /dev/null
+++ b/vendor/codeberg.org/gruf/go-ffmpreg/internal/wasm.go
@@ -0,0 +1,25 @@
+package internal
+
+import (
+ "os"
+
+ "github.com/tetratelabs/wazero"
+)
+
+func init() {
+ var err error
+
+ if dir := os.Getenv("WAZERO_COMPILATION_CACHE"); dir != "" {
+ // Use on-filesystem compilation cache given by env.
+ Cache, err = wazero.NewCompilationCacheWithDir(dir)
+ if err != nil {
+ panic(err)
+ }
+ } else {
+ // Use in-memory compilation cache.
+ Cache = wazero.NewCompilationCache()
+ }
+}
+
+// Shared WASM compilation cache.
+var Cache wazero.CompilationCache