Update arg names for GPUComputePassEncoder.dispatch()

Slightly silly, since it has no effect on API use, but it is nice to
keep the arg names in sync with the spec.

Bug: dawn:1270
Change-Id: I1f8cfabefb3a721691c092815cbb66c959980b5e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/78245
Auto-Submit: Brandon Jones <bajones@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Brandon Jones 2022-01-27 09:40:02 +00:00 committed by Dawn LUCI CQ
parent 153d1cfece
commit 913e158429
5 changed files with 33 additions and 28 deletions

View File

@ -799,9 +799,9 @@
{
"name": "dispatch",
"args": [
{"name": "x", "type": "uint32_t"},
{"name": "y", "type": "uint32_t", "default": "1"},
{"name": "z", "type": "uint32_t", "default": "1"}
{"name": "workgroupCountX", "type": "uint32_t"},
{"name": "workgroupCountY", "type": "uint32_t", "default": "1"},
{"name": "workgroupCountZ", "type": "uint32_t", "default": "1"}
]
},
{

View File

@ -159,7 +159,9 @@ namespace dawn::native {
}
}
void ComputePassEncoder::APIDispatch(uint32_t x, uint32_t y, uint32_t z) {
void ComputePassEncoder::APIDispatch(uint32_t workgroupCountX,
uint32_t workgroupCountY,
uint32_t workgroupCountZ) {
mEncodingContext->TryEncode(
this,
[&](CommandAllocator* allocator) -> MaybeError {
@ -169,20 +171,20 @@ namespace dawn::native {
uint32_t workgroupsPerDimension =
GetDevice()->GetLimits().v1.maxComputeWorkgroupsPerDimension;
DAWN_INVALID_IF(
x > workgroupsPerDimension,
"Dispatch size X (%u) exceeds max compute workgroups per dimension (%u).",
x, workgroupsPerDimension);
DAWN_INVALID_IF(workgroupCountX > workgroupsPerDimension,
"Dispatch workgroup count X (%u) exceeds max compute "
"workgroups per dimension (%u).",
workgroupCountX, workgroupsPerDimension);
DAWN_INVALID_IF(
y > workgroupsPerDimension,
"Dispatch size Y (%u) exceeds max compute workgroups per dimension (%u).",
y, workgroupsPerDimension);
DAWN_INVALID_IF(workgroupCountY > workgroupsPerDimension,
"Dispatch workgroup count Y (%u) exceeds max compute "
"workgroups per dimension (%u).",
workgroupCountY, workgroupsPerDimension);
DAWN_INVALID_IF(
z > workgroupsPerDimension,
"Dispatch size Z (%u) exceeds max compute workgroups per dimension (%u).",
z, workgroupsPerDimension);
DAWN_INVALID_IF(workgroupCountZ > workgroupsPerDimension,
"Dispatch workgroup count Z (%u) exceeds max compute "
"workgroups per dimension (%u).",
workgroupCountZ, workgroupsPerDimension);
}
// Record the synchronization scope for Dispatch, which is just the current
@ -190,13 +192,14 @@ namespace dawn::native {
AddDispatchSyncScope();
DispatchCmd* dispatch = allocator->Allocate<DispatchCmd>(Command::Dispatch);
dispatch->x = x;
dispatch->y = y;
dispatch->z = z;
dispatch->x = workgroupCountX;
dispatch->y = workgroupCountY;
dispatch->z = workgroupCountZ;
return {};
},
"encoding %s.Dispatch(%u, %u, %u).", this, x, y, z);
"encoding %s.Dispatch(%u, %u, %u).", this, workgroupCountX, workgroupCountY,
workgroupCountZ);
}
ResultOrError<std::pair<Ref<BufferBase>, uint64_t>>

View File

@ -40,7 +40,9 @@ namespace dawn::native {
void APIEndPass();
void APIDispatch(uint32_t x, uint32_t y = 1, uint32_t z = 1);
void APIDispatch(uint32_t workgroupCountX,
uint32_t workgroupCountY = 1,
uint32_t workgroupCountZ = 1);
void APIDispatchIndirect(BufferBase* indirectBuffer, uint64_t indirectOffset);
void APISetPipeline(ComputePipelineBase* pipeline);

View File

@ -37,10 +37,10 @@ namespace wgpu::binding {
}
void GPUComputePassEncoder::dispatch(Napi::Env,
interop::GPUSize32 x,
interop::GPUSize32 y,
interop::GPUSize32 z) {
enc_.Dispatch(x, y, z);
interop::GPUSize32 workgroupCountX,
interop::GPUSize32 workgroupCountY,
interop::GPUSize32 workgroupCountZ) {
enc_.Dispatch(workgroupCountX, workgroupCountY, workgroupCountZ);
}
void GPUComputePassEncoder::dispatchIndirect(

View File

@ -37,9 +37,9 @@ namespace wgpu::binding {
void setPipeline(Napi::Env,
interop::Interface<interop::GPUComputePipeline> pipeline) override;
void dispatch(Napi::Env,
interop::GPUSize32 x,
interop::GPUSize32 y,
interop::GPUSize32 z) override;
interop::GPUSize32 workgroupCountX,
interop::GPUSize32 workgroupCountY,
interop::GPUSize32 workgroupCountZ) override;
void dispatchIndirect(Napi::Env,
interop::Interface<interop::GPUBuffer> indirectBuffer,
interop::GPUSize64 indirectOffset) override;