dawn-cmake/test/intrinsics/repeated_use.wgsl
Ben Clayton b478f97975 IntrinsicTable: De-duplicate returned Intrinsics
Much like sem::Type, it greatly simplifies downstream logic if we can compare sem::Intrinsic pointers to know if they refer to the same intrinsic overload.

Change-Id: If236247cd3979bbde821d9294f304ab85ba4938e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58061
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-07-15 20:34:21 +00:00

21 lines
633 B
WebGPU Shading Language

// Check that for backends that generate intrinsic helpers, repeated use of the
// same intrinsic overload results in single helper being generated.
[[stage(compute), workgroup_size(1)]]
fn main() {
ignore(isNormal(vec4<f32>()));
ignore(isNormal(vec4<f32>(1.)));
ignore(isNormal(vec4<f32>(1., 2., 3., 4.)));
ignore(isNormal(vec3<f32>()));
ignore(isNormal(vec3<f32>(1.)));
ignore(isNormal(vec3<f32>(1., 2., 3.)));
ignore(isNormal(vec2<f32>()));
ignore(isNormal(vec2<f32>(1.)));
ignore(isNormal(vec2<f32>(1., 2.)));
ignore(isNormal(1.));
ignore(isNormal(2.));
ignore(isNormal(3.));
}