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

Implement const-expressions (phase 2) #2309

Merged
merged 37 commits into from
Oct 12, 2023
Merged

Implement const-expressions (phase 2) #2309

merged 37 commits into from
Oct 12, 2023

Commits on Oct 12, 2023

  1. [wgsl-in] eagerly evaluate const-expressions

    [wgsl-in] support const-expressions in attributes
    
    allow `Splat` as an evaluated const-expression type
    teoxoy authored and jimblandy committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    92c30dc View commit details
    Browse the repository at this point in the history
  2. use LocalVariable init

    teoxoy authored and jimblandy committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    345360e View commit details
    Browse the repository at this point in the history
  3. [glsl-in] const eval as soon as possible

    teoxoy authored and jimblandy committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    f190b48 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6bae046 View commit details
    Browse the repository at this point in the history
  5. Move front::Emitter to proc.

    With the addition of the constant evaluator to the `proc` module, it
    is now concerned with constructing expressions. Any code that
    constructs expressions will generally also need to deal with `Emit`
    statements, which are handled by the `Emitter` type. However,
    `Emitter` is private to the `front` module. This patch moves it to
    `proc` and makes it accessible to both the constant evaluator and the
    front ends.
    jimblandy committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    6feb138 View commit details
    Browse the repository at this point in the history
  6. Replace ConstantEvaluator's closure with optional emitter data.

    Instead of letting the user supply an arbitrary closure for appending
    expressions, instead give `ConstantEvaluator` an `Option` that holds
    an `Emitter` to interrupt, and a `block` to add any new `Emit`
    statements to.
    jimblandy committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    8fcadcb View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    a53de15 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    908d74e View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    946c5f2 View commit details
    Browse the repository at this point in the history
  10. ConstantEvaluator::swizzle: Handle vector concatenation and indexing (#…

    …2485)
    
    * ConstantEvaluator::swizzle: Handle vector concatenation, indexing.
    
    * Handle vector Compose expressions nested two deep.
    
    * Move `flatten_compose` to `proc`, and make it a free function.
    
    * [spv-out] Ensure that we flatten Compose for OpConstantCompose.
    jimblandy committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    2e5a244 View commit details
    Browse the repository at this point in the history
  11. Split const-exprs.rs test into separate functions.

    Also, just use a single out variable for each type. rather than
    introducing a new output variable for every test we add.
    jimblandy committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    938ce3d View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    85b578a View commit details
    Browse the repository at this point in the history
  13. add an expression constness tracker

    teoxoy authored and jimblandy committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    a2a917c View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    170fd8c View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    b151a2a View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    f733ac1 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    f72d5c1 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    4b4b0d3 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    9d87d9e View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    f06eee9 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    303a3cd View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    82a3613 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    b46ea49 View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    d87231b View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    c24ab86 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    f219e93 View commit details
    Browse the repository at this point in the history
  27. [const-eval] allow bitcast, select and relational functions for GLSL …

    …since they should be supported
    teoxoy authored and jimblandy committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    da17650 View commit details
    Browse the repository at this point in the history
  28. [const-eval] evaluate BinaryOperator::Modulo correctly (use the tru…

    …ncated version instead of floored)
    teoxoy authored and jimblandy committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    18f4de7 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    b737d3e View commit details
    Browse the repository at this point in the history
  30. Properly recognize Literal expressions as non-dynamic indices. (#2537)

    Restore `negative_index` test in `tests/wgsl-errors.rs`, as part of
    the `invalid_arrays` test function.
    jimblandy committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    233c6c6 View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    c216a13 View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    9171884 View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    260effb View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    ca46c6d View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    a0e0242 View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    61d91eb View commit details
    Browse the repository at this point in the history
  37. Configuration menu
    Copy the full SHA
    f53151d View commit details
    Browse the repository at this point in the history