intrinsic/gen: Don't permutate impossible workgroup ptr types

Change-Id: I1e6a3436553ca886a52075315d09ff7ef04eb492
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116082
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton 2023-01-03 20:17:18 +00:00 committed by Dawn LUCI CQ
parent a42280fb66
commit 3febbd218f
1 changed files with 16 additions and 8 deletions

View File

@ -328,17 +328,22 @@ func validate(fqn sem.FullyQualifiedName, uses *sem.StageUses) bool {
return false // Builtin, untypeable return type
}
switch fqn.Target.GetName() {
case "array":
elTy := fqn.TemplateArguments[0].(sem.FullyQualifiedName)
isStorable := func(elTy sem.FullyQualifiedName) bool {
elTyName := elTy.Target.GetName()
switch {
case elTyName == "bool" ||
case elTyName == "bool",
strings.Contains(elTyName, "sampler"),
strings.Contains(elTyName, "texture"):
return false // Not storable
case IsAbstract(DeepestElementType(elTy)):
return false // Abstract types are not typeable
strings.Contains(elTyName, "texture"),
IsAbstract(DeepestElementType(elTy)):
return false
}
return true
}
switch fqn.Target.GetName() {
case "array":
if !isStorable(fqn.TemplateArguments[0].(sem.FullyQualifiedName)) {
return false
}
case "ptr":
// https://gpuweb.github.io/gpuweb/wgsl/#address-space
@ -355,6 +360,9 @@ func validate(fqn sem.FullyQualifiedName, uses *sem.StageUses) bool {
if access != "read_write" {
return false
}
if !isStorable(fqn.TemplateArguments[1].(sem.FullyQualifiedName)) {
return false
}
case "uniform":
if access != "read" {
return false