You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fix spelling of "formated"
fixesshader-slang/slang#5714
* Initial work on typescript conversion
* Revert "Initial work on typescript conversion"
This reverts commit 2adca03.
* initial work on typescript conversion
* remove old files
* fix types for dependencies
* import across files and other fixes
* Set up slang wasm types
* Changes for working js code, at the cost of my sanity, a million type errors, and reflection not working
* typing improvements and reflection fix
* fix remaining element errors
* Improve types
* fix incorrect language setting
* fix floating variable types + ui code improvements
* build improvements
* reenable deployment
* update readme to be closer to version on main
* fix order of typescript build
* download artifact so it can be used for deploy
Ensure the following tools are installed and properly configured on your system:
14
-
-**CMake** (Version 3.25 or greater is preferred, if you're on a lower version please see [build with older cmake](https://github.com/shader-slang/slang/blob/master/docs/building.md#building-with-an-older-cmake))
15
-
- A **C++ compiler** with C++17 support (GCC, Clang, or MSVC)
16
-
- A **CMake-compatible build backend** (e.g., Ninja or Visual Studio)
17
-
-**Python 3** (Required for building and running the server)
We need to build `slang-wasm` because we need `slang-wasm.js` and `slang-wasm.wasm` files.
27
-
The reason they're not included in this repo is that they are big binary files, and the result of building top of tree slang, so making this part of the CI build process makes the most sense.
28
-
29
-
### Building `slang-wasm`
30
-
31
-
1. Clone the [Slang repository](https://github.com/shader-slang/slang) and fetch its submodules:
* install [Github Act](https://github.com/nektos/gh-act) as an extension using `gh extension install https://github.com/nektos/gh-act`
34
16
35
-
cd slang
36
-
```
37
-
38
-
2. Follow the instructions in the [WebAssembly build section](https://github.com/shader-slang/slang/blob/master/docs/building.md#webassembly-build) of the Slang documentation to:
39
-
- Set up the [Emscripten SDK](https://github.com/emscripten-core/emsdk) by installing and activating it.
40
-
- Build the WebAssembly target (`slang-wasm.js` and `slang-wasm.wasm`) using the documented cross-compilation steps.
41
-
42
-
3. Once the build completes, locate `slang-wasm.js` and `slang-wasm.wasm` in the `build.em/Release/bin` directory
43
-
44
-
4. Copy `slang-wasm.js` and `slang-wasm.wasm` to the **root of the playground directory**.
45
-
46
-
5. Compress the `slang-wasm.wasm` file using gzip:
47
-
```bash
48
-
gzip -k slang-wasm.wasm
49
-
```
17
+
### Building
50
18
51
-
### Building `spirv-tool`
52
-
53
-
To enable SPIR-V disassembly in the playground (alongside the SPIR-V binary compilation supported by `slang-wasm.js`), you need to build the WebAssembly version of `spirv-tool`. This is necessary because `slang-wasm.js` does not include the SPIR-V disassembler.
54
-
55
-
1. Refer to the build process outlined in the CI configuration:
2. Use the provided [`spirv-tool-wasm-build.sh`](https://github.com/shader-slang/slang-playground/blob/main/spirv-tool-wasm-build.sh) script to compile the WebAssembly build of `spirv-tool`.
60
-
61
-
3. Once built, place the resulting files (`spirv-tools.wasm` and `spirv-tools.js`) in the **root of the playground directory** alongside `slang-wasm.js` and `slang-wasm.wasm`.
62
-
63
-
By completing this step, the playground will support SPIR-V disassembly features.
19
+
* Run `gh act -P ubuntu-latest=catthehacker/ubuntu:full-latest -j 'build' --artifact-server-path ./out`
20
+
* This will create a file at `out/1/artifact/artifact.zip`
21
+
* Extracting the zip file will provide a directory from which you can host the website
64
22
65
23
### Starting the Server
66
24
67
-
1. Navigate to the root of your playground directory (where `slang-wasm.js` and `slang-wasm.wasm.gz` are located).
25
+
1. Navigate to the root of your webfiles (where `slang-wasm.js` and `slang-wasm.wasm.gz` are located) either in the artifact folder or the root of your playground directory.
26
+
68
27
```bash
69
28
cd slang-playground
70
29
```
71
30
72
31
2. Start a Python web server to host the files:
32
+
73
33
```bash
74
34
python -m http.server 8000
75
35
```
@@ -78,26 +38,19 @@ By completing this step, the playground will support SPIR-V disassembly features
78
38
79
39
If any issues arise, ensure the `.wasm` file is properly compressed (`slang-wasm.wasm.gz`) and located in the correct directory.
80
40
81
-
This process of: build -> run, should work alone.
41
+
## Iterate
82
42
83
-
## Iterating on Development Using build.mk
43
+
In order to avoid the expensive build process, copy the following files from the output directory to the main directory:
84
44
85
-
Alternatively you can build using the `build.mk` file.
45
+
*`slang-wasm.js`
46
+
*`slang-wasm.d.ts`
47
+
*`slang-wasm.wasm`
48
+
*`slang-wasm.wasm.gz`
49
+
*`spirv-tools.js`
50
+
*`spirv-tools.d.ts`
86
51
87
-
Set up the environment as follows:
52
+
Run `npm install` to install dependencies.
88
53
89
-
```bash
90
-
## The output directory where to output target (non-source) files
You can then run `npx tsc` and host the webserver from the main directory. You will either need to run `npx tsc` whenever you make a code change, or you can run `npx tsc --watch` to continuously compile.
97
55
98
-
1. Make the necessary changes to your source code.
99
-
2. Build the updated runtime by running:
100
-
```bash
101
-
make -f ./build.mk website_runtime
102
-
```
103
-
3. Refresh `http://localhost:8000` in your browser to view the changes.
56
+
Now load or reload `localhost:8000` in your browser to see the results.
0 commit comments