Skip to content

Commit

Permalink
update readme to be closer to version on main
Browse files Browse the repository at this point in the history
  • Loading branch information
Devon7925 committed Dec 9, 2024
1 parent 73e1974 commit bcaa9c9
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Development instructions
# Development Instructions

## Setup

Clone the [Slang Playground](https://github.com/shader-slang/slang-playground):

```bash
git clone https://github.com/shader-slang/slang-playground.git
```

### Prerequisites

* Install [Docker](https://www.docker.com/get-started/)
Expand All @@ -14,19 +20,28 @@
* This will create a file at `out/1/artifact/artifact.zip`
* Extracting the zip file will provide a directory from which you can host the website

### Server
### Starting the Server

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.

The Wasm loader needs a running web server in the build target directory, in order to load .wasm files.
```bash
cd slang-playground
```

**NOTE: ** You do not need a shell with the full development environment set up, you just need Python and the `TRY_SLANG_TARGET_DIRECTORY_PATH` environment variable.
2. Start a Python web server to host the files:

To start the server, run something like:
```bash
python -m http.server 8000
```

$ cd $TRY_SLANG_TARGET_DIRECTORY_PATH && python -m http.server 8000
3. Open `http://localhost:8000` in your browser to verify the server is running and the files are accessible. You should see the application loading the `.wasm` and `.js` files correctly.

If any issues arise, ensure the `.wasm` file is properly compressed (`slang-wasm.wasm.gz`) and located in the correct directory.

## Iterate

In order to avoid the expensive build process, copy the following files from the output directory to the main directory:

* `slang-wasm.js`
* `slang-wasm.d.ts`
* `slang-wasm.wasm`
Expand All @@ -38,4 +53,4 @@ Run `npm install` to install dependencies.

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.

Now load or reload `localhost:8000` in your browser to see the results.
Now load or reload `localhost:8000` in your browser to see the results.

0 comments on commit bcaa9c9

Please sign in to comment.