GLSL: implement builtin kNumWorkgroups.

Bug: tint:1400
Change-Id: I5f2523d41f73abe55e57b8931833124c2ebaf00d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78260
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Stephen White 2022-01-25 22:47:05 +00:00 committed by Tint LUCI CQ
parent ca4cfb9d6f
commit 520bccf8d8
3 changed files with 5 additions and 22 deletions

View File

@ -1787,6 +1787,7 @@ sem::Type* GeneratorImpl::builtin_type(ast::Builtin builtin) {
} }
case ast::Builtin::kLocalInvocationId: case ast::Builtin::kLocalInvocationId:
case ast::Builtin::kGlobalInvocationId: case ast::Builtin::kGlobalInvocationId:
case ast::Builtin::kNumWorkgroups:
case ast::Builtin::kWorkgroupId: { case ast::Builtin::kWorkgroupId: {
auto* u32 = builder_.create<sem::U32>(); auto* u32 = builder_.create<sem::U32>();
return builder_.create<sem::Vector>(u32, 3); return builder_.create<sem::Vector>(u32, 3);
@ -1828,6 +1829,8 @@ const char* GeneratorImpl::builtin_to_string(ast::Builtin builtin,
return "gl_LocalInvocationIndex"; return "gl_LocalInvocationIndex";
case ast::Builtin::kGlobalInvocationId: case ast::Builtin::kGlobalInvocationId:
return "gl_GlobalInvocationID"; return "gl_GlobalInvocationID";
case ast::Builtin::kNumWorkgroups:
return "gl_NumWorkGroups";
case ast::Builtin::kWorkgroupId: case ast::Builtin::kWorkgroupId:
return "gl_WorkGroupID"; return "gl_WorkGroupID";
case ast::Builtin::kSampleIndex: case ast::Builtin::kSampleIndex:

View File

@ -1,5 +1,3 @@
SKIP: FAILED
#version 310 es #version 310 es
precision mediump float; precision mediump float;
@ -26,16 +24,8 @@ void main() {
inputs.local_invocation_index = uint(gl_LocalInvocationIndex); inputs.local_invocation_index = uint(gl_LocalInvocationIndex);
inputs.global_invocation_id = gl_GlobalInvocationID; inputs.global_invocation_id = gl_GlobalInvocationID;
inputs.workgroup_id = gl_WorkGroupID; inputs.workgroup_id = gl_WorkGroupID;
inputs.num_workgroups = uvec3(); inputs.num_workgroups = gl_NumWorkGroups;
tint_symbol(inputs); tint_symbol(inputs);
} }
Error parsing GLSL shader:
ERROR: 0:27: 'constructor' : not enough data provided for construction
ERROR: 0:27: 'assign' : cannot convert from ' const float' to ' global highp 3-component vector of uint'
ERROR: 0:27: '' : compilation terminated
ERROR: 3 compilation errors. No code generated.

View File

@ -1,5 +1,3 @@
SKIP: FAILED
#version 310 es #version 310 es
precision mediump float; precision mediump float;
@ -34,16 +32,8 @@ void main() {
inputs.local_invocation_index = uint(gl_LocalInvocationIndex); inputs.local_invocation_index = uint(gl_LocalInvocationIndex);
inputs.global_invocation_id = gl_GlobalInvocationID; inputs.global_invocation_id = gl_GlobalInvocationID;
inputs.workgroup_id = gl_WorkGroupID; inputs.workgroup_id = gl_WorkGroupID;
inputs.num_workgroups = uvec3(); inputs.num_workgroups = gl_NumWorkGroups;
tint_symbol(inputs); tint_symbol(inputs);
} }
Error parsing GLSL shader:
ERROR: 0:35: 'constructor' : not enough data provided for construction
ERROR: 0:35: 'assign' : cannot convert from ' const float' to ' global highp 3-component vector of uint'
ERROR: 0:35: '' : compilation terminated
ERROR: 3 compilation errors. No code generated.