summaryrefslogtreecommitdiffstats
path: root/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/README.md')
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/README.md57
1 files changed, 57 insertions, 0 deletions
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/README.md
new file mode 100644
index 000000000..466cd8759
--- /dev/null
+++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/workload/meshoptimizer/README.md
@@ -0,0 +1,57 @@
+"codecbench of meshoptimizer" sample introduction
+==============
+
+This sample demonstrates how to build [codecbench of messoptimizer](https://github.com/zeux/meshoptimizer) into
+WebAssembly with simd support and run it with iwasm.
+
+## Preparation
+
+please refer to [installation instructions](../README.md).
+
+## Build with wasi-sdk
+
+``` shell
+$ mkdir build && cd build
+$ cmake ..
+$ make
+# to verify
+$ ls codecbench.wasm
+```
+
+## Or build with EMSDK
+
+EMSDK is another toolchain to compile C/C++ code to WASM. In this case, the output wasm file
+might have a higher performance than the file generated by wasi-sdk.
+
+``` shell
+$ git clone https://github.com/zeux/meshoptimizer.git
+$ cd messoptimizer
+$ em++ tools/codecbench.cpp src/vertexcodec.cpp src/vertexfilter.cpp \
+ src/overdrawanalyzer.cpp src/indexgenerator.cpp src/vcacheoptimizer.cpp \
+ src/clusterizer.cpp src/indexcodec.cpp src/vfetchanalyzer.cpp \
+ src/spatialorder.cpp src/allocator.cpp src/vcacheanalyzer.cpp \
+ src/vfetchoptimizer.cpp src/overdrawoptimizer.cpp src/simplifier.cpp \
+ src/stripifier.cpp -O3 -msimd128 \
+ -s TOTAL_MEMORY=268435456 \
+ -o codecbench.wasm
+$ ls -l codecbench.wasm
+```
+
+## Run workload
+
+Firstly please build iwasm with simd support:
+
+``` shell
+$ cd <wamr dir>/product-mini/platforms/linux/
+$ mkdir build && cd build
+$ cmake ..
+$ make
+```
+
+Then compile wasm file to aot file and run:
+
+``` shell
+$ <wamr dir>/wamr-compiler/build/wamrc -o codecbench.aot codecbench.wasm
+$ <wamr dir>/product-mini/platforms/linux/build/iwasm codecbench.aot
+```
+