mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-29 18:23:36 +00:00
36 lines
924 B
Plaintext
36 lines
924 B
Plaintext
// language: metal1.0
|
|
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using metal::uint;
|
|
|
|
|
|
metal::float2 test_fma(
|
|
) {
|
|
metal::float2 a = metal::float2(2.0, 2.0);
|
|
metal::float2 b = metal::float2(0.5, 0.5);
|
|
metal::float2 c = metal::float2(0.5, 0.5);
|
|
return metal::fma(a, b, c);
|
|
}
|
|
|
|
int test_integer_dot_product(
|
|
) {
|
|
metal::int2 a_2_ = metal::int2(1);
|
|
metal::int2 b_2_ = metal::int2(1);
|
|
int c_2_ = ( + a_2_.x * b_2_.x + a_2_.y * b_2_.y);
|
|
metal::uint3 a_3_ = metal::uint3(1u);
|
|
metal::uint3 b_3_ = metal::uint3(1u);
|
|
uint c_3_ = ( + a_3_.x * b_3_.x + a_3_.y * b_3_.y + a_3_.z * b_3_.z);
|
|
metal::int4 _e11 = metal::int4(4);
|
|
metal::int4 _e13 = metal::int4(2);
|
|
int c_4_ = ( + _e11.x * _e13.x + _e11.y * _e13.y + _e11.z * _e13.z + _e11.w * _e13.w);
|
|
return c_4_;
|
|
}
|
|
|
|
kernel void main_(
|
|
) {
|
|
metal::float2 _e0 = test_fma();
|
|
int _e1 = test_integer_dot_product();
|
|
return;
|
|
}
|