Parse num_workgroups builtin and reject it
We have chosen not to implement this for origin trial, so just parse it and produce an error in the validator. Bug: tint:752 Change-Id: I40ebf0b4051fb0b8bab9d4c733e555b836320cd4 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58780 Auto-Submit: James Price <jrprice@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: James Price <jrprice@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
94a5fd476e
commit
c41d940650
|
@ -59,6 +59,10 @@ std::ostream& operator<<(std::ostream& out, Builtin builtin) {
|
|||
out << "workgroup_id";
|
||||
break;
|
||||
}
|
||||
case Builtin::kNumWorkgroups: {
|
||||
out << "num_workgroups";
|
||||
break;
|
||||
}
|
||||
case Builtin::kSampleIndex: {
|
||||
out << "sample_index";
|
||||
break;
|
||||
|
|
|
@ -32,6 +32,7 @@ enum class Builtin {
|
|||
kLocalInvocationIndex,
|
||||
kGlobalInvocationId,
|
||||
kWorkgroupId,
|
||||
kNumWorkgroups,
|
||||
kSampleIndex,
|
||||
kSampleMask,
|
||||
|
||||
|
|
|
@ -98,6 +98,9 @@ ast::Builtin ident_to_builtin(const std::string& str) {
|
|||
if (str == "workgroup_id") {
|
||||
return ast::Builtin::kWorkgroupId;
|
||||
}
|
||||
if (str == "num_workgroups") {
|
||||
return ast::Builtin::kNumWorkgroups;
|
||||
}
|
||||
if (str == "sample_index") {
|
||||
return ast::Builtin::kSampleIndex;
|
||||
}
|
||||
|
|
|
@ -119,6 +119,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
ast::Builtin::kLocalInvocationIndex},
|
||||
BuiltinData{"global_invocation_id", ast::Builtin::kGlobalInvocationId},
|
||||
BuiltinData{"workgroup_id", ast::Builtin::kWorkgroupId},
|
||||
BuiltinData{"num_workgroups", ast::Builtin::kNumWorkgroups},
|
||||
BuiltinData{"sample_index", ast::Builtin::kSampleIndex},
|
||||
BuiltinData{"sample_mask", ast::Builtin::kSampleMask}));
|
||||
|
||||
|
|
|
@ -1333,6 +1333,10 @@ bool Resolver::ValidateBuiltinDecoration(const ast::BuiltinDecoration* deco,
|
|||
return false;
|
||||
}
|
||||
break;
|
||||
case ast::Builtin::kNumWorkgroups:
|
||||
// TODO(crbug.com/tint/752): Backend support (needs extra work for HLSL).
|
||||
AddError("num_workgroups builtin is not yet implemented", deco->source());
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -4075,6 +4075,8 @@ SpvBuiltIn Builder::ConvertBuiltin(ast::Builtin builtin,
|
|||
return SpvBuiltInPointSize;
|
||||
case ast::Builtin::kWorkgroupId:
|
||||
return SpvBuiltInWorkgroupId;
|
||||
case ast::Builtin::kNumWorkgroups:
|
||||
return SpvBuiltInNumWorkgroups;
|
||||
case ast::Builtin::kSampleIndex:
|
||||
push_capability(SpvCapabilitySampleRateShading);
|
||||
return SpvBuiltInSampleId;
|
||||
|
|
|
@ -329,6 +329,8 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
ast::StorageClass::kInput, SpvBuiltInGlobalInvocationId},
|
||||
BuiltinData{ast::Builtin::kWorkgroupId, ast::StorageClass::kInput,
|
||||
SpvBuiltInWorkgroupId},
|
||||
BuiltinData{ast::Builtin::kNumWorkgroups, ast::StorageClass::kInput,
|
||||
SpvBuiltInNumWorkgroups},
|
||||
BuiltinData{ast::Builtin::kSampleIndex, ast::StorageClass::kInput,
|
||||
SpvBuiltInSampleId},
|
||||
BuiltinData{ast::Builtin::kSampleMask, ast::StorageClass::kInput,
|
||||
|
|
Loading…
Reference in New Issue