tint: IntrinsicTable: Add abstract numeric types

These aren't used by anything (yet). Baby steps.

Bug: tint:1504
Change-Id: Icf0261ec9c6802f004d9f1bc4780a6376ebb8dfb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90530
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
This commit is contained in:
Ben Clayton 2022-05-19 18:30:39 +00:00 committed by Dawn LUCI CQ
parent b1fa457ab3
commit 6ac00ed0c0
4 changed files with 1132 additions and 1004 deletions

View File

@ -71,6 +71,8 @@ enum texel_format {
// https://gpuweb.github.io/gpuweb/wgsl/#plain-types-section
type bool
[[precedence(4), display("abstract-float")]] type af
[[precedence(3), display("abstract-int")]] type ai
[[precedence(2)]] type i32
[[precedence(1)]] type u32
[[precedence(0)]] type f32
@ -126,6 +128,7 @@ match fiu32: f32 | i32 | u32
match fi32: f32 | i32
match iu32: i32 | u32
match scalar: f32 | i32 | u32 | bool
match abstract_or_scalar: ai | af | f32 | i32 | u32 | bool
match scalar_no_f32: i32 | u32 | bool
match scalar_no_i32: f32 | u32 | bool
match scalar_no_u32: f32 | i32 | bool

View File

@ -326,6 +326,22 @@ bool match_bool(const sem::Type* ty) {
return ty->IsAnyOf<Any, sem::Bool>();
}
const sem::AbstractFloat* build_af(MatchState& state) {
return state.builder.create<sem::AbstractFloat>();
}
bool match_af(const sem::Type* ty) {
return ty->IsAnyOf<Any, sem::AbstractFloat>();
}
const sem::AbstractInt* build_ai(MatchState& state) {
return state.builder.create<sem::AbstractInt>();
}
bool match_ai(const sem::Type* ty) {
return ty->IsAnyOf<Any, sem::AbstractInt>();
}
const sem::Bool* build_bool(MatchState& state) {
return state.builder.create<sem::Bool>();
}

File diff suppressed because it is too large Load Diff

View File

@ -331,6 +331,8 @@ func validate(fqn sem.FullyQualifiedName, uses *sem.StageUses) bool {
strings.Contains(elTyName, "sampler"),
strings.Contains(elTyName, "texture"):
return false // Not storable
case elTyName == "af" || elTyName == "ai":
return false // Abstract types are not typeable nor supported by arrays
}
case "ptr":
// https://gpuweb.github.io/gpuweb/wgsl/#storage-class