File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -763,7 +763,30 @@ class WebGPUBackend extends Backend {
763763
764764 }
765765
766- passEncoderGPU . dispatchWorkgroups ( computeNode . dispatchCount ) ;
766+ const maxComputeWorkgroupsPerDimension = this . device . limits . maxComputeWorkgroupsPerDimension ;
767+
768+ const computeNodeData = this . get ( computeNode ) ;
769+
770+ if ( computeNodeData . dispatchSize === undefined ) computeNodeData . dispatchSize = { x : 0 , y : 1 , z : 1 } ;
771+
772+ const { dispatchSize } = computeNodeData ;
773+
774+ if ( computeNode . dispatchCount > maxComputeWorkgroupsPerDimension ) {
775+
776+ dispatchSize . x = Math . min ( computeNode . dispatchCount , maxComputeWorkgroupsPerDimension ) ;
777+ dispatchSize . y = Math . ceil ( computeNode . dispatchCount / maxComputeWorkgroupsPerDimension ) ;
778+
779+ } else {
780+
781+ dispatchSize . x = computeNode . dispatchCount ;
782+
783+ }
784+
785+ passEncoderGPU . dispatchWorkgroups (
786+ dispatchSize . x ,
787+ dispatchSize . y ,
788+ dispatchSize . z
789+ ) ;
767790
768791 }
769792
You can’t perform that action at this time.
0 commit comments