WebGPU shaders are executed by the compute units inside GPU hardware. In native APIs, some of the shader instructions may result in undefined behavior on the GPU. In order to address that, the shader instruction set and its defined behaviors are strictly defined by WebGPU. When a shader is provided to createShaderModule(), the WebGPU implementation has to validate it before doing any translation (to platform-specific shaders) or transformation passes.
WebGPU着色器由GPU硬件内的计算单元执行。在本机API中,某些着色器指令可能会导致GPU上出现未定义的行为。为了解决这个问题,着色器指令集及其定义的行为由WebGPU严格定义。当为createShaderModule()提供着色器时,WebGPU实现必须在执行任何转换(到特定于平台的着色器)或转换过程之前对其进行验证。