Shader source code is avalible for users
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## What problem does this solve or what need does it fill?
Not GPU / wgsl / WebGPU expert.
Using wgsl causes source code exposure. When RenderDoc is used it's trivial to read functions and variables NAMES. Why they even included in fist place, if GPU executes machine code? Not even talking about plain text format of .wgsl files.
Example from RenderDoc resource view:
------------
GSLS (SPIRV-Cross)
```
vec3 my_functionX_naga_oil_mod_.....(vec3 some_direction, vec3 some_normal)
{
return some_direction - (some_normal * (2.0 * dot(some_direction, some_normal)));
}
```
------------
SPIR-V
```
float3 my_functionX_naga_oil_mod_.....(float3 some_direction, float3 some_normal) {
float _202 = Dot(some_direction, some_normal);
float _203 = 2.0000 * _202;
float3 _204 = some_normal * _203;
float3 _205 = some_direction - _204;
return _205;
}
```
## What solution would you like?
Option to convert .wgsl file to byte code. Or optionally compress (minify) for release export.
Add example that shows how to pack all shades to single compact .shaderbundle file.
So RenderDoc user will see something like:
```
....
v_mul_f32 v35, 30, v7
v_add_f32 v4, s81, v4
v_mac_f32 v26, s18, v3
....
```
Contributor guide
Assessment
This issue has not been assessed yet.