注:我已经在这里回答了我自己的问题,我正在发帖,以便其他处于同样情况下的人受益。
我跟随着各种WebGPU教程,特别是关于计算机着色器的教程,特别是这些文章:https://web.dev/gpu-compute/和https://surma.dev/things/webgpu/ --很明显,自从这些文章上次更新以来,WebGPU规范已经被调整了。
我遇到的第一个错误是在WGSL中,@stage(compute)被弃用于@compute --这是一个简单的修正:)
然而,下一个错误,让我困惑:
Tint WGSL reader failure: :9:46 error: access mode 'write' is not valid for the 'storage' address space
@group(0) @binding(2) var<storage, write> resultMatrix : Matrix;
^^^^^^^^^^^^
- While validating [ShaderModuleDescriptor]
- While calling [Device].CreateShaderModule([ShaderModuleDescriptor]).还输出了另一条信息:
1 error(s) generated while compiling the shader:
:9:46 error: access mode 'write' is not valid for the 'storage' address space
@group(0) @binding(2) var<storage, write> resultMatrix : Matrix;发布于 2022-07-31 04:05:38
修补程序只是简单地替换了以下WGSL线路:
@group(0) @binding(2) var<storage, write> resultMatrix : Matrix;使用以下修复方法:
@group(0) @binding(2) var<storage, read_write> resultMatrix : Matrix;我设法根据WGSL规范的这一部分中的一个表计算出了这一点。
https://stackoverflow.com/questions/73180579
复制相似问题