I am trying out WebGPU for the first time and have come across a problem. Normally in other rendering frameworks I would multiply a vec4 my a matrix of all 1s and the output would be the same.
Here is what I expect with this code:
@vertex
fn vs_main(in: VertexInput) -> VertexOutput {
var out: VertexOutput;
let world_position: vec4f = vec4f(in.position, 0.0, 1.0);
out.position = world_position;
out.color = in.color;
return out;
}
However when I try this:
@vertex
fn vs_main(in: VertexInput) -> VertexOutput {
var out: VertexOutput;
let world_position: vec4f = mat4x4f(
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0
) * vec4f(in.position, 0.0, 1.0);
out.position = world_position;
out.color = in.color;
return out;
}