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