Skip to content

Commit

Permalink
Expand error message if validating DispatchWorkgroups
Browse files Browse the repository at this point in the history
This CLs expands error message when DispatchWorkgroups with
maxComputeWorkgroupsPerDimension to indicate when limits are hit that
were not provided in the device requiredLimits.

Note that DispatchWorkgroupsIndirect error message can't be expanded
because validation happens in a shader.

Bug: 42240683
Change-Id: I4026076c1ea27a78d3e64d33a5ed591063503d3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/219674
Reviewed-by: Brandon Jones <[email protected]>
Commit-Queue: Fr <[email protected]>
  • Loading branch information
beaufortfrancois authored and Dawn LUCI CQ committed Dec 17, 2024
1 parent eaeba81 commit d09e3c7
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions src/dawn/native/ComputePassEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "dawn/native/ComputePassEncoder.h"

#include "dawn/common/Range.h"
#include "dawn/native/Adapter.h"
#include "dawn/native/BindGroup.h"
#include "dawn/native/BindGroupLayout.h"
#include "dawn/native/Buffer.h"
Expand Down Expand Up @@ -212,23 +213,32 @@ void ComputePassEncoder::APIDispatchWorkgroups(uint32_t workgroupCountX,

DAWN_TRY(mCommandBufferState.ValidateCanDispatch());

uint32_t workgroupsPerDimension =
uint32_t maxComputeWorkgroupsPerDimension =
GetDevice()->GetLimits().v1.maxComputeWorkgroupsPerDimension;

DAWN_INVALID_IF(workgroupCountX > workgroupsPerDimension,
"Dispatch workgroup count X (%u) exceeds max compute "
"workgroups per dimension (%u).",
workgroupCountX, workgroupsPerDimension);
DAWN_INVALID_IF(
workgroupCountX > maxComputeWorkgroupsPerDimension,
"Dispatch workgroup count X (%u) exceeds max compute "
"workgroups per dimension (%u).%s",
workgroupCountX, maxComputeWorkgroupsPerDimension,
DAWN_INCREASE_LIMIT_MESSAGE(GetDevice()->GetAdapter(),
maxComputeWorkgroupsPerDimension, workgroupCountX));

DAWN_INVALID_IF(workgroupCountY > workgroupsPerDimension,
"Dispatch workgroup count Y (%u) exceeds max compute "
"workgroups per dimension (%u).",
workgroupCountY, workgroupsPerDimension);
DAWN_INVALID_IF(
workgroupCountY > maxComputeWorkgroupsPerDimension,
"Dispatch workgroup count Y (%u) exceeds max compute "
"workgroups per dimension (%u).%s",
workgroupCountY, maxComputeWorkgroupsPerDimension,
DAWN_INCREASE_LIMIT_MESSAGE(GetDevice()->GetAdapter(),
maxComputeWorkgroupsPerDimension, workgroupCountY));

DAWN_INVALID_IF(workgroupCountZ > workgroupsPerDimension,
"Dispatch workgroup count Z (%u) exceeds max compute "
"workgroups per dimension (%u).",
workgroupCountZ, workgroupsPerDimension);
DAWN_INVALID_IF(
workgroupCountZ > maxComputeWorkgroupsPerDimension,
"Dispatch workgroup count Z (%u) exceeds max compute "
"workgroups per dimension (%u).%s",
workgroupCountZ, maxComputeWorkgroupsPerDimension,
DAWN_INCREASE_LIMIT_MESSAGE(GetDevice()->GetAdapter(),
maxComputeWorkgroupsPerDimension, workgroupCountZ));

if (GetDevice()->IsCompatibilityMode()) {
DAWN_TRY(mCommandBufferState.ValidateNoDifferentTextureViewsOnSameTexture());
Expand Down

0 comments on commit d09e3c7

Please sign in to comment.