-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
area: correctnessWe're behaving incorrectlyWe're behaving incorrectlyarea: naga front-endTranslation to Naga IRTranslation to Naga IRlang: WGSLWebGPU Shading LanguageWebGPU Shading LanguagenagaShader TranslatorShader Translator
Description
Description
Using matrix product with vectors or matrices causes WGSL shader parsing error 'Cannot apply the binary op to the arguments'.
Repro steps
In Firefox, open Matrix multiplication | Tour of WGSL. There will be a shader parsing error in the example shader. You can also take the shader
const m2x3 = mat2x3f(1, 2, 3, 4, 5, 6);
const mul_v3_by_m2x3 : vec2f = vec3(9, 8, 7) * m2x3;
const mul_m2x3_by_v2 : vec3f = m2x3 * vec2(9, 8);
const mul_m2x3_by_m4x2 : mat4x3f = m2x3 * mat4x2f(7, 8, 9, 10, 11, 12, 13, 14);and try to compile it using naga. The same error is shown.
Expected vs observed behavior
The example on Tour of WGSL should work and the local shader should compile successfully since the matrices and vectors are of correct sizes, as described in Matrix arithmetic table in WGSL specification.
Extra materials
Naga error output:
Could not parse WGSL:
error: Cannot apply the binary op to the arguments
┌─ my_shader.wgsl:2:32
│
2 │ const mul_v3_by_m2x3 : vec2f = vec3(9, 8, 7) * m2x3;
│ ^^^^^^^^^^^^^^^^^^^^ see msg
Platform
Tested using Firefox 146 (macOS 26 and Windows 11) and naga 28.0.0 (macOS 26).
Metadata
Metadata
Assignees
Labels
area: correctnessWe're behaving incorrectlyWe're behaving incorrectlyarea: naga front-endTranslation to Naga IRTranslation to Naga IRlang: WGSLWebGPU Shading LanguageWebGPU Shading LanguagenagaShader TranslatorShader Translator
Type
Projects
Status
Todo