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
This implementation successfully adds WebGPU native support to NCNN by reusing existing Vulkan compute shader infrastructure with automatic transformations for WebGPU compatibility.
6
+
7
+
## Problem Solved
8
+
9
+
The original issue identified two critical problems when trying to compile Vulkan shaders for WebGPU:
10
+
11
+
1.**SPIR-V Storage Class Error**: `unknown SPIR-V storage class: 9`
12
+
-**Cause**: WebGPU doesn't support push constants the same way Vulkan does
This implementation adds WebGPU native support to NCNN, allowing the reuse of existing Vulkan compute shaders with automatic conversion to WebGPU-compatible format.
4
+
5
+
## Key Features
6
+
7
+
1.**Push Constant to Uniform Binding Conversion**: Automatically transforms Vulkan push constants to WebGPU uniform bindings
8
+
2.**Modified psc Macro**: Updated to use `float(x)==0` for WebGPU compatibility instead of `x==0`
9
+
3.**Seamless Integration**: Reuses existing Vulkan shader infrastructure with minimal changes
10
+
11
+
## Usage
12
+
13
+
Enable WebGPU support by adding `-DNCNN_WEBGPU=ON` to your CMake configuration:
14
+
15
+
```bash
16
+
cmake .. -DNCNN_WEBGPU=ON
17
+
```
18
+
19
+
This will automatically:
20
+
- Enable Vulkan infrastructure for shader compilation
21
+
- Transform all ~300+ compute shaders for WebGPU compatibility
0 commit comments