mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Add support for `naga::ir::MathFunction::Cross` to `naga::proc::constant_evaluator`. In the tests: - Change `naga/tests/in/wgsl/cross.wgsl` to use more interesting argument values. Rather than passing the same vector twice, which yields a cross product of zero, pass in the x and y unit vectors, whose cross product is the z unit vector. Update snapshot output. - Replace `validation::bad_cross_builtin_args` with a new test, `builtin_cross_product_args`, that is written more in the style of the other tests in this module, and does not depend on the WGSL front end. Because this PR changes the behavior of the constant evaluator, this test stopped behaving as expected. - In `wgsl_errors::check`, move a `panic!` out of a closure so that the `#[track_caller]` attribute works properly.
5 lines
188 B
WebGPU Shading Language
5 lines
188 B
WebGPU Shading Language
// NOTE: invalid combinations are tested in the `validation::bad_cross_builtin_args` test.
|
|
@compute @workgroup_size(1) fn main() {
|
|
let a = cross(vec3(1., 0., 0.), vec3(0., 1., 0.));
|
|
}
|