An open API service indexing awesome lists of open source software.

https://github.com/re-ovo/web-naga

The shader translation library for the web
https://github.com/re-ovo/web-naga

glsl wasm wasm-bindgen wgsl

Last synced: 3 months ago
JSON representation

The shader translation library for the web

Awesome Lists containing this project

README

          

# WebNaga

Provides mutual conversion between different Shader language syntaxes, implemented using naga and wasm

## Frontend and Backend
### Frontend
- GLSL
- WGSL

## Backend
- WGSL
- GLSL

## Usage
GLSL -> WGSL
```javascript
const front = GlslFrontend.new();
const module = front.parse(code, ShaderStage.Vertex);
const result = module.to_wgsl()
```

WGSL -> GLSL
```javascript
const front = WgslFrontend.new();
const module = front.parse(code);
const options = GlslBackendOptions.new();
// options.stage = ShaderStage.Vertex;
// options.version = GlslVersion.embedded(330)
// options.flags = GlslWriterFlags.None
const result = module.to_glsl("main", options)
```