@@ -98,6 +98,11 @@ const {
98
98
ArrayPrototypePush,
99
99
DataViewPrototypeGetBuffer,
100
100
Error,
101
+ Number,
102
+ NumberPOSITIVE_INFINITY,
103
+ NumberMAX_SAFE_INTEGER,
104
+ NumberNEGATIVE_INFINITY,
105
+ NumberMIN_SAFE_INTEGER,
101
106
MathMax,
102
107
ObjectDefineProperty,
103
108
ObjectHasOwn,
@@ -614,6 +619,19 @@ function createGPUSupportedLimits(limits) {
614
619
return adapterFeatures ;
615
620
}
616
621
622
+ function normalizeLimit ( limit ) {
623
+ if ( typeof num === "bigint" ) {
624
+ limit = Number ( limit ) ;
625
+ if ( limit === NumberPOSITIVE_INFINITY ) {
626
+ limit = NumberMAX_SAFE_INTEGER ;
627
+ } else if ( limit === NumberNEGATIVE_INFINITY ) {
628
+ limit = NumberMIN_SAFE_INTEGER ;
629
+ }
630
+ }
631
+
632
+ return limit ;
633
+ }
634
+
617
635
/**
618
636
* @typedef InnerAdapterLimits
619
637
* @property {number } maxTextureDimension1D
@@ -653,123 +671,127 @@ class GPUSupportedLimits {
653
671
654
672
get maxTextureDimension1D ( ) {
655
673
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
656
- return this [ _limits ] . maxTextureDimension1D ;
674
+ return normalizeLimit ( this [ _limits ] . maxTextureDimension1D ) ;
657
675
}
658
676
get maxTextureDimension2D ( ) {
659
677
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
660
- return this [ _limits ] . maxTextureDimension2D ;
678
+ return normalizeLimit ( this [ _limits ] . maxTextureDimension2D ) ;
661
679
}
662
680
get maxTextureDimension3D ( ) {
663
681
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
664
- return this [ _limits ] . maxTextureDimension3D ;
682
+ return normalizeLimit ( this [ _limits ] . maxTextureDimension3D ) ;
665
683
}
666
684
get maxTextureArrayLayers ( ) {
667
685
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
668
- return this [ _limits ] . maxTextureArrayLayers ;
686
+ return normalizeLimit ( this [ _limits ] . maxTextureArrayLayers ) ;
669
687
}
670
688
get maxBindGroups ( ) {
671
689
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
672
- return this [ _limits ] . maxBindGroups ;
690
+ return normalizeLimit ( this [ _limits ] . maxBindGroups ) ;
673
691
}
674
692
get maxBindingsPerBindGroup ( ) {
675
693
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
676
- return this [ _limits ] . maxBindingsPerBindGroup ;
694
+ return normalizeLimit ( this [ _limits ] . maxBindingsPerBindGroup ) ;
677
695
}
678
696
get maxBufferSize ( ) {
679
697
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
680
- return this [ _limits ] . maxBufferSize ;
698
+ return normalizeLimit ( this [ _limits ] . maxBufferSize ) ;
681
699
}
682
700
get maxDynamicUniformBuffersPerPipelineLayout ( ) {
683
701
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
684
- return this [ _limits ] . maxDynamicUniformBuffersPerPipelineLayout ;
702
+ return normalizeLimit (
703
+ this [ _limits ] . maxDynamicUniformBuffersPerPipelineLayout ,
704
+ ) ;
685
705
}
686
706
get maxDynamicStorageBuffersPerPipelineLayout ( ) {
687
707
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
688
- return this [ _limits ] . maxDynamicStorageBuffersPerPipelineLayout ;
708
+ return normalizeLimit (
709
+ this [ _limits ] . maxDynamicStorageBuffersPerPipelineLayout ,
710
+ ) ;
689
711
}
690
712
get maxSampledTexturesPerShaderStage ( ) {
691
713
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
692
- return this [ _limits ] . maxSampledTexturesPerShaderStage ;
714
+ return normalizeLimit ( this [ _limits ] . maxSampledTexturesPerShaderStage ) ;
693
715
}
694
716
get maxSamplersPerShaderStage ( ) {
695
717
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
696
- return this [ _limits ] . maxSamplersPerShaderStage ;
718
+ return normalizeLimit ( this [ _limits ] . maxSamplersPerShaderStage ) ;
697
719
}
698
720
get maxStorageBuffersPerShaderStage ( ) {
699
721
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
700
- return this [ _limits ] . maxStorageBuffersPerShaderStage ;
722
+ return normalizeLimit ( this [ _limits ] . maxStorageBuffersPerShaderStage ) ;
701
723
}
702
724
get maxStorageTexturesPerShaderStage ( ) {
703
725
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
704
- return this [ _limits ] . maxStorageTexturesPerShaderStage ;
726
+ return normalizeLimit ( this [ _limits ] . maxStorageTexturesPerShaderStage ) ;
705
727
}
706
728
get maxUniformBuffersPerShaderStage ( ) {
707
729
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
708
- return this [ _limits ] . maxUniformBuffersPerShaderStage ;
730
+ return normalizeLimit ( this [ _limits ] . maxUniformBuffersPerShaderStage ) ;
709
731
}
710
732
get maxUniformBufferBindingSize ( ) {
711
733
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
712
- return this [ _limits ] . maxUniformBufferBindingSize ;
734
+ return normalizeLimit ( this [ _limits ] . maxUniformBufferBindingSize ) ;
713
735
}
714
736
get maxStorageBufferBindingSize ( ) {
715
737
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
716
- return this [ _limits ] . maxStorageBufferBindingSize ;
738
+ return normalizeLimit ( this [ _limits ] . maxStorageBufferBindingSize ) ;
717
739
}
718
740
get minUniformBufferOffsetAlignment ( ) {
719
741
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
720
- return this [ _limits ] . minUniformBufferOffsetAlignment ;
742
+ return normalizeLimit ( this [ _limits ] . minUniformBufferOffsetAlignment ) ;
721
743
}
722
744
get minStorageBufferOffsetAlignment ( ) {
723
745
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
724
- return this [ _limits ] . minStorageBufferOffsetAlignment ;
746
+ return normalizeLimit ( this [ _limits ] . minStorageBufferOffsetAlignment ) ;
725
747
}
726
748
get maxVertexBuffers ( ) {
727
749
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
728
- return this [ _limits ] . maxVertexBuffers ;
750
+ return normalizeLimit ( this [ _limits ] . maxVertexBuffers ) ;
729
751
}
730
752
get maxVertexAttributes ( ) {
731
753
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
732
- return this [ _limits ] . maxVertexAttributes ;
754
+ return normalizeLimit ( this [ _limits ] . maxVertexAttributes ) ;
733
755
}
734
756
get maxVertexBufferArrayStride ( ) {
735
757
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
736
- return this [ _limits ] . maxVertexBufferArrayStride ;
758
+ return normalizeLimit ( this [ _limits ] . maxVertexBufferArrayStride ) ;
737
759
}
738
760
get maxInterStageShaderComponents ( ) {
739
761
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
740
- return this [ _limits ] . maxInterStageShaderComponents ;
762
+ return normalizeLimit ( this [ _limits ] . maxInterStageShaderComponents ) ;
741
763
}
742
764
get maxColorAttachments ( ) {
743
765
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
744
- return this [ _limits ] . maxColorAttachments ;
766
+ return normalizeLimit ( this [ _limits ] . maxColorAttachments ) ;
745
767
}
746
768
get maxColorAttachmentBytesPerSample ( ) {
747
769
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
748
- return this [ _limits ] . maxColorAttachmentBytesPerSample ;
770
+ return normalizeLimit ( this [ _limits ] . maxColorAttachmentBytesPerSample ) ;
749
771
}
750
772
get maxComputeWorkgroupStorageSize ( ) {
751
773
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
752
- return this [ _limits ] . maxComputeWorkgroupStorageSize ;
774
+ return normalizeLimit ( this [ _limits ] . maxComputeWorkgroupStorageSize ) ;
753
775
}
754
776
get maxComputeInvocationsPerWorkgroup ( ) {
755
777
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
756
- return this [ _limits ] . maxComputeInvocationsPerWorkgroup ;
778
+ return normalizeLimit ( this [ _limits ] . maxComputeInvocationsPerWorkgroup ) ;
757
779
}
758
780
get maxComputeWorkgroupSizeX ( ) {
759
781
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
760
- return this [ _limits ] . maxComputeWorkgroupSizeX ;
782
+ return normalizeLimit ( this [ _limits ] . maxComputeWorkgroupSizeX ) ;
761
783
}
762
784
get maxComputeWorkgroupSizeY ( ) {
763
785
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
764
- return this [ _limits ] . maxComputeWorkgroupSizeY ;
786
+ return normalizeLimit ( this [ _limits ] . maxComputeWorkgroupSizeY ) ;
765
787
}
766
788
get maxComputeWorkgroupSizeZ ( ) {
767
789
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
768
- return this [ _limits ] . maxComputeWorkgroupSizeZ ;
790
+ return normalizeLimit ( this [ _limits ] . maxComputeWorkgroupSizeZ ) ;
769
791
}
770
792
get maxComputeWorkgroupsPerDimension ( ) {
771
793
webidl . assertBranded ( this , GPUSupportedLimitsPrototype ) ;
772
- return this [ _limits ] . maxComputeWorkgroupsPerDimension ;
794
+ return normalizeLimit ( this [ _limits ] . maxComputeWorkgroupsPerDimension ) ;
773
795
}
774
796
775
797
[ SymbolFor ( "Deno.privateCustomInspect" ) ] ( inspect , inspectOptions ) {
0 commit comments