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
Copy file name to clipboardexpand all lines: docs/user-guide/09-targets.md
+41
Original file line number
Diff line number
Diff line change
@@ -412,6 +412,47 @@ Slang's CPU compute target supports only a compute pipeline.
412
412
413
413
Because CPU target support flexible pointer-based addressing and large low-latency caches, a compute kernel can simply be passed a small fixed number of pointers and be relied upon to load parameter values of any types via indirection through those pointers.
414
414
415
+
## WebGPU
416
+
417
+
> #### Note
418
+
>
419
+
> Slang support for WebGPU is work in progress.
420
+
421
+
WebGPU is a graphics and compute API.
422
+
It is similar in spirit to modern APIs, like Metal, Direct3D 12 and Vulkan, but with concessions to portability and privacy.
423
+
424
+
WebGPU is available both in browsers as a JavaScript API, and natively as a C/C++ API.
425
+
[Dawn](https://github.com/google/dawn), is a native WebGPU implementation used by the Chrome browser.
426
+
427
+
By combining Slang, [Dawn](https://github.com/google/dawn) and [Emscripten](https://emscripten.org/),
428
+
an application can easily target any native API, and the web, with a single codebase consisting of C++ and Slang code.
429
+
430
+
WebGPU shader modules are created from WGSL (WebGPU Shading Language) source files.
431
+
WebGPU does not use an intermediate representation - WGSL code is compiled to backend-specific code by
432
+
compilers provided by the WebGPU implementation.
433
+
434
+
### Pipelines
435
+
436
+
WebGPU supports render and compute pipelines.
437
+
438
+
The WebGPU render pipeline includes the following programmable stages:
439
+
440
+
- The vertex stage outputs vertex data
441
+
442
+
- The fragment stage outputs fragments
443
+
444
+
### Parameter Passing
445
+
446
+
WebGPU uses groups of bindings called bind groups to bind things like textures, buffers and samplers.
447
+
Bind group objects are passed as arguments when encoding bind group setting commands.
448
+
449
+
There is a notion of equivalence for bind groups, and a notion of equivalence for pipelines defined in
450
+
terms of bind group equivalence.
451
+
This equivalence allows an application to save some bind group setting commands, when switching between
452
+
pipelines, if bindings are grouped together appropriately.
453
+
454
+
Which bindings are grouped together can be controlled using Slang's `ParameterBlock` generic type.
455
+
415
456
## Summary
416
457
417
458
This chapter has reviewed the main target platforms supported by the Slang compiler and runtime system.
0 commit comments