mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-29 17:44:09 +01:00
* 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`
36 lines
837 B
GLSL
36 lines
837 B
GLSL
#version 310 es
|
|
#extension GL_EXT_gpu_shader5 : require
|
|
|
|
precision highp float;
|
|
precision highp int;
|
|
|
|
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
|
|
|
|
|
vec2 test_fma() {
|
|
vec2 a = vec2(2.0, 2.0);
|
|
vec2 b = vec2(0.5, 0.5);
|
|
vec2 c = vec2(0.5, 0.5);
|
|
return fma(a, b, c);
|
|
}
|
|
|
|
int test_integer_dot_product() {
|
|
ivec2 a_2_ = ivec2(1);
|
|
ivec2 b_2_ = ivec2(1);
|
|
int c_2_ = ( + a_2_.x * b_2_.x + a_2_.y * b_2_.y);
|
|
uvec3 a_3_ = uvec3(1u);
|
|
uvec3 b_3_ = uvec3(1u);
|
|
uint c_3_ = ( + a_3_.x * b_3_.x + a_3_.y * b_3_.y + a_3_.z * b_3_.z);
|
|
ivec4 _e11 = ivec4(4);
|
|
ivec4 _e13 = ivec4(2);
|
|
int c_4_ = ( + _e11.x * _e13.x + _e11.y * _e13.y + _e11.z * _e13.z + _e11.w * _e13.w);
|
|
return c_4_;
|
|
}
|
|
|
|
void main() {
|
|
vec2 _e0 = test_fma();
|
|
int _e1 = test_integer_dot_product();
|
|
return;
|
|
}
|
|
|