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 return false // Builtin, untypeable return type
} }
switch fqn.Target.GetName() { isStorable := func(elTy sem.FullyQualifiedName) bool {
case "array":
elTy := fqn.TemplateArguments[0].(sem.FullyQualifiedName)
elTyName := elTy.Target.GetName() elTyName := elTy.Target.GetName()
switch { switch {
case elTyName == "bool" || case elTyName == "bool",
strings.Contains(elTyName, "sampler"), strings.Contains(elTyName, "sampler"),
strings.Contains(elTyName, "texture"): strings.Contains(elTyName, "texture"),
return false // Not storable IsAbstract(DeepestElementType(elTy)):
case IsAbstract(DeepestElementType(elTy)): return false
return false // Abstract types are not typeable }
return true
}
switch fqn.Target.GetName() {
case "array":
if !isStorable(fqn.TemplateArguments[0].(sem.FullyQualifiedName)) {
return false
} }
case "ptr": case "ptr":
// https://gpuweb.github.io/gpuweb/wgsl/#address-space // 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" { if access != "read_write" {
return false return false
} }
if !isStorable(fqn.TemplateArguments[1].(sem.FullyQualifiedName)) {
return false
}
case "uniform": case "uniform":
if access != "read" { if access != "read" {
return false return false