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";
|
out << "workgroup_id";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case Builtin::kNumWorkgroups: {
|
||||||
|
out << "num_workgroups";
|
||||||
|
break;
|
||||||
|
}
|
||||||
case Builtin::kSampleIndex: {
|
case Builtin::kSampleIndex: {
|
||||||
out << "sample_index";
|
out << "sample_index";
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -32,6 +32,7 @@ enum class Builtin {
|
||||||
kLocalInvocationIndex,
|
kLocalInvocationIndex,
|
||||||
kGlobalInvocationId,
|
kGlobalInvocationId,
|
||||||
kWorkgroupId,
|
kWorkgroupId,
|
||||||
|
kNumWorkgroups,
|
||||||
kSampleIndex,
|
kSampleIndex,
|
||||||
kSampleMask,
|
kSampleMask,
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,9 @@ ast::Builtin ident_to_builtin(const std::string& str) {
|
||||||
if (str == "workgroup_id") {
|
if (str == "workgroup_id") {
|
||||||
return ast::Builtin::kWorkgroupId;
|
return ast::Builtin::kWorkgroupId;
|
||||||
}
|
}
|
||||||
|
if (str == "num_workgroups") {
|
||||||
|
return ast::Builtin::kNumWorkgroups;
|
||||||
|
}
|
||||||
if (str == "sample_index") {
|
if (str == "sample_index") {
|
||||||
return ast::Builtin::kSampleIndex;
|
return ast::Builtin::kSampleIndex;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,6 +119,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
ast::Builtin::kLocalInvocationIndex},
|
ast::Builtin::kLocalInvocationIndex},
|
||||||
BuiltinData{"global_invocation_id", ast::Builtin::kGlobalInvocationId},
|
BuiltinData{"global_invocation_id", ast::Builtin::kGlobalInvocationId},
|
||||||
BuiltinData{"workgroup_id", ast::Builtin::kWorkgroupId},
|
BuiltinData{"workgroup_id", ast::Builtin::kWorkgroupId},
|
||||||
|
BuiltinData{"num_workgroups", ast::Builtin::kNumWorkgroups},
|
||||||
BuiltinData{"sample_index", ast::Builtin::kSampleIndex},
|
BuiltinData{"sample_index", ast::Builtin::kSampleIndex},
|
||||||
BuiltinData{"sample_mask", ast::Builtin::kSampleMask}));
|
BuiltinData{"sample_mask", ast::Builtin::kSampleMask}));
|
||||||
|
|
||||||
|
|
|
@ -1333,6 +1333,10 @@ bool Resolver::ValidateBuiltinDecoration(const ast::BuiltinDecoration* deco,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4075,6 +4075,8 @@ SpvBuiltIn Builder::ConvertBuiltin(ast::Builtin builtin,
|
||||||
return SpvBuiltInPointSize;
|
return SpvBuiltInPointSize;
|
||||||
case ast::Builtin::kWorkgroupId:
|
case ast::Builtin::kWorkgroupId:
|
||||||
return SpvBuiltInWorkgroupId;
|
return SpvBuiltInWorkgroupId;
|
||||||
|
case ast::Builtin::kNumWorkgroups:
|
||||||
|
return SpvBuiltInNumWorkgroups;
|
||||||
case ast::Builtin::kSampleIndex:
|
case ast::Builtin::kSampleIndex:
|
||||||
push_capability(SpvCapabilitySampleRateShading);
|
push_capability(SpvCapabilitySampleRateShading);
|
||||||
return SpvBuiltInSampleId;
|
return SpvBuiltInSampleId;
|
||||||
|
|
|
@ -329,6 +329,8 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
ast::StorageClass::kInput, SpvBuiltInGlobalInvocationId},
|
ast::StorageClass::kInput, SpvBuiltInGlobalInvocationId},
|
||||||
BuiltinData{ast::Builtin::kWorkgroupId, ast::StorageClass::kInput,
|
BuiltinData{ast::Builtin::kWorkgroupId, ast::StorageClass::kInput,
|
||||||
SpvBuiltInWorkgroupId},
|
SpvBuiltInWorkgroupId},
|
||||||
|
BuiltinData{ast::Builtin::kNumWorkgroups, ast::StorageClass::kInput,
|
||||||
|
SpvBuiltInNumWorkgroups},
|
||||||
BuiltinData{ast::Builtin::kSampleIndex, ast::StorageClass::kInput,
|
BuiltinData{ast::Builtin::kSampleIndex, ast::StorageClass::kInput,
|
||||||
SpvBuiltInSampleId},
|
SpvBuiltInSampleId},
|
||||||
BuiltinData{ast::Builtin::kSampleMask, ast::StorageClass::kInput,
|
BuiltinData{ast::Builtin::kSampleMask, ast::StorageClass::kInput,
|
||||||
|
|
Loading…
Reference in New Issue