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

Add bitwise not operator support with tests #259

Closed

Conversation

dheeraxspidey
Copy link
Contributor

Summary

Adds support for bitwise NOT operator (~) and comprehensive bitwise operation testing across the shader translation pipeline.

Related Issue

No specific issue - adding core functionality for bitwise operations support.

Changes

  • Added bitwise NOT operator support in lexer and parser
  • Added comprehensive tests for bitwise operations:
    • Basic bitwise NOT operations
    • Combined bitwise expressions (AND, OR, XOR)
    • Test coverage for both lexer and parser
  • Updated parsers across different backends to handle bitwise NOT:
    • DirectX backend
    • Metal backend
    • Added proper token recognition
    • Added AST node generation for bitwise operations

Testing

  • Added new test cases:
    • test_bitwise_not() - Tests basic bitwise NOT operation
    • test_bitwise_expressions() - Tests combined bitwise operations
    • Added lexer tests to verify proper tokenization
    • Added parser tests to verify proper AST generation
  • All existing tests pass (189 passed, 81 warnings)
  • Manually tested with sample shader code

Shader Sample

crossgl
shader test {
void main() {
int a = 5;
int b = ~a; // Bitwise NOT
int c = a & b; // Combined with other bitwise ops
}
}

Checklist

  • Tests cover new or changed code
  • Everything builds and runs locally
  • Only touched files related to the feature
  • Added comprehensive test coverage

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.

1 participant