1fd4e5da5Sopenharmony_ci# SVA 2fd4e5da5Sopenharmony_ci 3fd4e5da5Sopenharmony_ciSPIR-V Assembler for WebGPU. The SPIR-V Assembler is a JavaScript library to 4fd4e5da5Sopenharmony_ciconvert SPIR-V assembly (as produced by spirv-dis in SPIR-V Tools) into a 5fd4e5da5Sopenharmony_ciSPIR-V binary. The assembler assumes it is generating WebGPU SPIR-V and thus has 6fd4e5da5Sopenharmony_cithe following limitations. 7fd4e5da5Sopenharmony_ci 8fd4e5da5Sopenharmony_ci * Only 32 bit integers and floats supported 9fd4e5da5Sopenharmony_ci * Only GLSL accepted as an extended instruction set 10fd4e5da5Sopenharmony_ci * Doesn't support ! syntax for integers 11fd4e5da5Sopenharmony_ci * Doesn't support hex encoding for float 12fd4e5da5Sopenharmony_ci 13fd4e5da5Sopenharmony_ci```shell 14fd4e5da5Sopenharmony_ciyarn install 15fd4e5da5Sopenharmony_ciyarn test 16fd4e5da5Sopenharmony_ci``` 17fd4e5da5Sopenharmony_ci 18fd4e5da5Sopenharmony_ciYou can also use `yarn watch` to watch all of the files and re-run tests as 19fd4e5da5Sopenharmony_cineeded. 20fd4e5da5Sopenharmony_ci 21fd4e5da5Sopenharmony_ci## Webserver 22fd4e5da5Sopenharmony_ciUsing `yarn serve` will start a webserver on localhost:5000. If you load the 23fd4e5da5Sopenharmony_ci`tests/index.html` file this will load the SVA files into browser. 24fd4e5da5Sopenharmony_ci 25fd4e5da5Sopenharmony_ci## Command Line 26fd4e5da5Sopenharmony_ciThere is a simple assembler binary with can be executed from the command line. 27fd4e5da5Sopenharmony_ci 28fd4e5da5Sopenharmony_ci```shell 29fd4e5da5Sopenharmony_ciyarn sva tests/simple.spv_asm 30fd4e5da5Sopenharmony_ci``` 31fd4e5da5Sopenharmony_ci 32fd4e5da5Sopenharmony_ciThe above will generate a `o.sva` file in the current directory. 33fd4e5da5Sopenharmony_ci 34fd4e5da5Sopenharmony_ci## Update spirv.data.json 35fd4e5da5Sopenharmony_ci 36fd4e5da5Sopenharmony_ciIf there is a new spirv-headers release update the externals folder checkout 37fd4e5da5Sopenharmony_ciand then: 38fd4e5da5Sopenharmony_ci 39fd4e5da5Sopenharmony_ci```shell 40fd4e5da5Sopenharmony_ci./tools/process_grammar.rb > src/spirv.data.json 41fd4e5da5Sopenharmony_ci``` 42