Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.

Add support for vecN<i32> and vecN<u32> to dot() function #1689

Merged
merged 18 commits into from
Feb 3, 2022

Conversation

francesco-cattoglio
Copy link
Contributor

Work-in-progress pull request to fix #1667

Right now I have only implemented this for glsl-out to get an early review.
By reading the discussion at gpuweb/gpuweb#2231 and the minutes in https://docs.google.com/document/d/1o3BrMEZnE3Yat95uLiY06opF2Hmcj5XGlQmBhTT-_dQ/edit# I understand that:

  • HLSL requires no extra changes, the dot() function will just work
  • MSL and Spir-V will require changes to the code similar to the ones made for GLSL: if vectors of integers are involved we need to turn the dot() call into an arithmetic expression.

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good!
Just one more thing :)

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice!

@francesco-cattoglio
Copy link
Contributor Author

I implemented the requested changes. On MSL and GLSL back I think I did a pretty good job so far. When refactoring the sum of components into a loop I incorporated the x as well, and therefore there will be an extra "+" sign at the beginning of the produced expression. Let me know if you like it or not. If not, I will move the product of x outside of the loop.

On spv back, I tried my best to reduce repetition, but perhaps I wrote some "clever code" that is just "confusing and obscure" code for something that could have been done much easier.

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last thing!

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
since it could not fail, changed it to simply return `void`
Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[wgsl-in] dot product on integers isn't implemented
2 participants