|
| 1 | +# Review Checklist |
| 2 | + |
| 3 | +This is a collection of notes on things to watch out for when |
| 4 | +reviewing pull requests submitted to wgpu and Naga. |
| 5 | + |
| 6 | +Ideally, we want to keep items off this list entirely: |
| 7 | + |
| 8 | +- Using Rust effectively can turn some mistakes into compile-time |
| 9 | + errors. For example, in Naga, using exhaustive matching ensures that |
| 10 | + changes to the IR will cause compile-time errors in any code that |
| 11 | + hasn't been updated. |
| 12 | + |
| 13 | +- Refactoring can gather together all the code responsible for |
| 14 | + enforcing some invariant in one place, making it clear whether a |
| 15 | + change preserves it or not. For example, Naga localizes all handle |
| 16 | + validation to `naga::valid::Validator::validate_module_handles`, |
| 17 | + allowing the rest of the validator to assume that all handles are |
| 18 | + valid. |
| 19 | + |
| 20 | +- Offering custom abstractions can help contributors avoid |
| 21 | + implementing a weaker abstraction by themselves. For example, |
| 22 | + because `HandleSet` and `HandleVec` are used throughout Naga, |
| 23 | + contributors are less likely to write code that uses a `BitSet` or |
| 24 | + `Vec` on handle indices, which would invite bugs by erasing the |
| 25 | + handle types. |
| 26 | + |
| 27 | +This checklist gathers up the concerns that we haven't found a |
| 28 | +satisfying way to address in a more robust way. |
| 29 | + |
| 30 | +## Naga |
| 31 | + |
| 32 | +### General |
| 33 | + |
| 34 | +- [ ] If your change iterates over a collection, did you ensure the |
| 35 | + order of iteration was deterministic? Using `HashMap` and |
| 36 | + `HashSet` is fine, as long as you don't iterate over it. |
| 37 | + |
| 38 | +### WGSL Extensions |
| 39 | + |
| 40 | +- [ ] If you added a new feature to WGSL that is not covered by the |
| 41 | + WebGPU specification: |
| 42 | + - [ ] Did you add a `Capability` flag for it? |
| 43 | + - [ ] Did you document the feature fully in that flag's doc comment? |
| 44 | + - [ ] Did you ensure the validator rejects programs that use the |
| 45 | + feature unless its capability is enabled? |
| 46 | + |
| 47 | +### IR changes |
| 48 | + |
| 49 | +If your change adds or removes `Handle`s from the IR: |
| 50 | +- [ ] Did you update handle validation in `valid::handles`? |
| 51 | +- [ ] Did you update the compactor in `compact`? |
| 52 | +- [ ] Did you update `back::pipeline_constants::adjust_expr`? |
| 53 | + |
| 54 | +If your change adds a new operation: |
| 55 | +- [ ] Did you update the typifier in `proc::typifier`? |
| 56 | +- [ ] Did you update the validator in `valid::expression`? |
| 57 | +- [ ] If the operation can be used in constant expressions, did you |
| 58 | + update the constant evaluator in `proc::constant_evaluator`? |
| 59 | + |
| 60 | +### Backend changes |
| 61 | + |
| 62 | +- [ ] If your change introduces any new identifiers to generated code, |
| 63 | + how did you ensure they won't conflict with the users' |
| 64 | + identifiers? (This is usually not relevant to the SPIR-V |
| 65 | + backend.) |
| 66 | + - [ ] Did you use the `Namer` to generate a fresh identifier? |
| 67 | + - [ ] Did you register the identifier as a reserved word with the the `Namer`? |
| 68 | + - [ ] Did you use a reserved prefix registered with the `Namer`? |
0 commit comments