-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[naga] Builtin function database, for automatic conversions #6833
Draft
jimblandy
wants to merge
7
commits into
gfx-rs:trunk
Choose a base branch
from
jimblandy:naga-function-database
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,848
−1,006
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70f557d
to
6ed3edb
Compare
acd6a5c
to
fa9f489
Compare
e17f45e
to
6f2345c
Compare
669b817
to
107b177
Compare
89e3ef9
to
acb245f
Compare
acb245f
to
4b0303d
Compare
Rebased on #7344. |
4b0303d
to
0218277
Compare
8c4fb22
to
7e8e60c
Compare
Add a `special_types` field to `naga::proc::GlobalCtx`, since the special types table is reasonable to see as part of a module's global context, and it is needed to construct result types for calls to `MathFunction::Frexp` and `MathFunction::Modf`.
Make the associated function `TypeInner::automatically_converts_to` available outside the WGSL front end by moving it into the `proc::type_methods` module.
0e3a549
to
c64be95
Compare
Add a new module, `naga::common::predeclared`, which implements a new `struct_name` method on `naga::ir::PredeclaredType`, to produce the name of the struct type corresponding to that `PredeclaredType` value. Use this new method in `naga::front::type_gen`.
In the implementation of `TryToWgsl` for `Scalar`, order types within each representation from smallest to largest. This is just a cleanup; the change has no effect on behavior.
6113f82
to
a7b5a89
Compare
Define a new trait, `proc::builtins::OverloadSet`, for types that represent a Naga IR builtin function's set of overloads. The `OverloadSet` trait includes operations needed to validate calls, choose automatic type conversions, and generate diagnostics. Add a new function, `ir::MathFunction::overloads`, which returns the given `MathFunction`'s set of overloads as an `impl OverloadSet` value. Use this in the WGSL front end, the validator, and the typifier. To support `MathFunction::overloads`, provide several implementations of `OverloadSet`, some that are very flexible but verbose, and others that are concise but more restrictive.
a7b5a89
to
da9c925
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Work in progress for #6443.