From d09e3c7fd4ffe2f83bdbe4845f12ade38ed24bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaufort?= Date: Tue, 17 Dec 2024 00:19:58 -0800 Subject: [PATCH] Expand error message if validating DispatchWorkgroups 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 Commit-Queue: Fr --- src/dawn/native/ComputePassEncoder.cpp | 36 ++++++++++++++++---------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/dawn/native/ComputePassEncoder.cpp b/src/dawn/native/ComputePassEncoder.cpp index 7fb214dba8..8f5e8541e6 100644 --- a/src/dawn/native/ComputePassEncoder.cpp +++ b/src/dawn/native/ComputePassEncoder.cpp @@ -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" @@ -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());