Files
wgpu/tests/out/hlsl/functions.hlsl
T
francesco-cattoglio b235973d2e Add support for vecN<i32> and vecN<u32> to dot() function (#1689)
* Allow vecN<i32> and vecN<u32> in `dot()`, first changes

* Added a test case

* Fix the test

* Changes to baking of expressions, incl args of integer dot product

* Implemented requested changes for glsl backend

* Added support for integer dot product on MSL backend

* Removed outdated code for hlsl and wgls writers

* Implement in spv backend

* Commit modified outputs from running the tests

* cargo fmt

* Applied requested changes for both MSL and GLSL back

* Changes to spv back

* Committed all test output changes

* Cargo fmt

* Added a comment w.r.t. VK_KHR_shader_integer_dot_product

* Implemented requested svp change

* Minor change to test case

This is because I wanted to highlight the fact that the correct
id is used in the last sum of the integer dot product expression

* Changed function signature

since it could not fail, changed it to simply return `void`
2022-02-03 14:03:43 -05:00

29 lines
567 B
HLSL

float2 test_fma()
{
float2 a = float2(2.0, 2.0);
float2 b = float2(0.5, 0.5);
float2 c = float2(0.5, 0.5);
return mad(a, b, c);
}
int test_integer_dot_product()
{
int2 a_2_ = int2(1.xx);
int2 b_2_ = int2(1.xx);
int c_2_ = dot(a_2_, b_2_);
uint3 a_3_ = uint3(1u.xxx);
uint3 b_3_ = uint3(1u.xxx);
uint c_3_ = dot(a_3_, b_3_);
int c_4_ = dot(int4(4.xxxx), int4(2.xxxx));
return c_4_;
}
[numthreads(1, 1, 1)]
void main()
{
const float2 _e0 = test_fma();
const int _e1 = test_integer_dot_product();
return;
}