Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bit Operators #32

Merged
merged 7 commits into from
Dec 30, 2023
Merged

Bit Operators #32

merged 7 commits into from
Dec 30, 2023

Conversation

rodrigovieira938
Copy link
Contributor

This is an implementation of issue #8. It still doesnt have yet the multiply/division optimization, the constatant propagation nor the spir-v emission.

Copy link

codecov bot commented Dec 22, 2023

Codecov Report

Attention: 106 lines in your changes are missing coverage. Please review.

Comparison is base (4c303c2) 81.52% compared to head (8ade071) 81.03%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #32      +/-   ##
==========================================
- Coverage   81.52%   81.03%   -0.50%     
==========================================
  Files         105      105              
  Lines       16920    17025     +105     
  Branches     6107     6132      +25     
==========================================
+ Hits        13794    13796       +2     
- Misses       3063     3166     +103     
  Partials       63       63              
Files Coverage Δ
include/NZSL/Lang/TokenList.hpp 26.86% <0.00%> (-2.65%) ⬇️
src/NZSL/Ast/ConstantPropagationVisitor.cpp 71.53% <0.00%> (-1.29%) ⬇️
src/NZSL/Ast/SanitizeVisitor.cpp 82.84% <0.00%> (-0.19%) ⬇️
src/NZSL/GlslWriter.cpp 84.24% <0.00%> (-0.43%) ⬇️
src/NZSL/LangWriter.cpp 88.94% <0.00%> (-0.73%) ⬇️
src/NZSL/Parser.cpp 87.78% <20.00%> (-0.91%) ⬇️
src/NZSL/Lexer.cpp 89.42% <12.50%> (-3.14%) ⬇️
src/NZSL/SpirV/SpirvAstVisitor.cpp 81.78% <0.00%> (-1.51%) ⬇️
...t/ConstantPropagationVisitor_BinaryArithmetics.cpp 58.88% <16.12%> (-22.65%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c303c2...8ade071. Read the comment docs.

@SirLynix
Copy link
Contributor

Thanks a lot for your contribution! SPIR-V support should be pretty easy to add, and unit tests should be added too to test the generation (instead of changing the sfml example).

I'll look more deeply into your contribution once I have more time.

Copy link

sonarcloud bot commented Dec 22, 2023

Quality Gate Failed Quality Gate failed

Failed conditions

8.6% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Copy link
Contributor

@SirLynix SirLynix left a comment

Choose a reason for hiding this comment

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

This seems great overall, however two things are lacking:

  • vectors of i32/u32 support (they do support bitwise operation on a per-component basis)
  • unit tests

If you don't have time or are not willing to improve this PR I'll merge it in a branch and do it myself, but I won't have time before a few days.

Thank you for your contribution.

Copy link
Contributor

Choose a reason for hiding this comment

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

File still has diff

Copy link
Contributor

Choose a reason for hiding this comment

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

File still has diff

BinaryOr = 14, //< |
BinaryXor = 15, //< ~
LeftShift = 16, //< <<
RightShift = 17, //< >>
Copy link
Contributor

Choose a reason for hiding this comment

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

Please sort the enum by alphabetical order

@SirLynix SirLynix changed the base branch from main to bit-ops December 30, 2023 20:44
@SirLynix SirLynix merged commit 808ab46 into NazaraEngine:bit-ops Dec 30, 2023
40 of 41 checks passed
@SirLynix SirLynix mentioned this pull request Dec 30, 2023
SirLynix pushed a commit that referenced this pull request Dec 31, 2023
* Added the tokens

* Implementation of binary xor, or and and

* implementation of binary not

* revert the mandelbrot example

* Add spirv emisson

* added suport for shift operators

* Added constanted propagation for the bit operators
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants