From 1dee9164bfa6bdecb20ca3146cc8ae548af31ad7 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Tue, 19 Jan 2021 18:09:31 +0000 Subject: [PATCH] Use Tint to extract local workgroup size BUG=dawn:578 Change-Id: I7526fdcc3ee96099d1487cd159a7bea9210f2b4e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38143 Auto-Submit: Ryan Harrison Commit-Queue: Austin Eng Reviewed-by: Corentin Wallez Reviewed-by: Austin Eng --- src/dawn_native/ShaderModule.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp index 90670af6c7..a001569980 100644 --- a/src/dawn_native/ShaderModule.cpp +++ b/src/dawn_native/ShaderModule.cpp @@ -711,6 +711,10 @@ namespace dawn_native { auto metadata = std::make_unique(); metadata->stage = PipelineStateToShaderStage(entryPoint.stage); + metadata->localWorkgroupSize.x = entryPoint.workgroup_size_x; + metadata->localWorkgroupSize.y = entryPoint.workgroup_size_y; + metadata->localWorkgroupSize.z = entryPoint.workgroup_size_z; + result[entryPoint.name] = std::move(metadata); } return std::move(result); @@ -770,13 +774,19 @@ namespace dawn_native { "Tint and SPIRV-Cross returned different stages for entry point"); } + if (tintEntry->localWorkgroupSize.x != tintEntry->localWorkgroupSize.x || + tintEntry->localWorkgroupSize.y != tintEntry->localWorkgroupSize.y || + tintEntry->localWorkgroupSize.z != tintEntry->localWorkgroupSize.z) { + return DAWN_VALIDATION_ERROR( + "Tint and SPIRV-Cross returned different values for local workgroup size"); + } + // TODO(rharrison): Use the Inspector to get this data. tintEntry->bindings = crossEntry->bindings; tintEntry->usedVertexAttributes = crossEntry->usedVertexAttributes; tintEntry->fragmentOutputFormatBaseTypes = crossEntry->fragmentOutputFormatBaseTypes; tintEntry->fragmentOutputsWritten = crossEntry->fragmentOutputsWritten; - tintEntry->localWorkgroupSize = crossEntry->localWorkgroupSize; } return {}; }