@@ -405,7 +405,9 @@ function __WebGPUReconstruct_GPUAdapter_requestDevice(originalMethod, descriptor
405405
406406 if ( descriptor != undefined ) {
407407 overrideDescriptor . label = descriptor . label ;
408- overrideDescriptor . requiredLimits = descriptor . requiredLimits ;
408+ if ( ! __webGPUReconstruct . configuration . adapterDefaultLimits ) {
409+ overrideDescriptor . requiredLimits = descriptor . requiredLimits ;
410+ }
409411 overrideDescriptor . defaultQueue = descriptor . defaultQueue ;
410412
411413 if ( descriptor . requiredFeatures != undefined ) {
@@ -442,6 +444,48 @@ $STRUCT_SAVE_FUNCTIONS
442444// Generated code will be inserted here.
443445$CAPTURE_COMMANDS
444446
447+ function __WebGPUReconstruct_getDefaultLimits ( compatibility ) {
448+ let limits = {
449+ maxTextureDimension1D : compatibility ? 4096 : 8192 ,
450+ maxTextureDimension2D : compatibility ? 4096 : 8192 ,
451+ maxTextureDimension3D : 2048 ,
452+ maxTextureArrayLayers : 256 ,
453+ maxBindGroups : 4 ,
454+ maxBindGroupsPlusVertexBuffers : 24 ,
455+ maxBindingsPerBindGroup : 1000 ,
456+ maxDynamicUniformBuffersPerPipelineLayout : 8 ,
457+ maxDynamicStorageBuffersPerPipelineLayout : 4 ,
458+ maxSampledTexturesPerShaderStage : 16 ,
459+ maxSamplersPerShaderStage : 16 ,
460+ maxStorageBuffersPerShaderStage : 8 ,
461+ maxStorageBuffersInVertexStage : compatibility ? 0 : 8 ,
462+ maxStorageBuffersInFragmentStage : compatibility ? 4 : 8 ,
463+ maxStorageTexturesPerShaderStage : 4 ,
464+ maxStorageTexturesInVertexStage : compatibility ? 0 : 8 ,
465+ maxStorageTexturesInFragmentStage : compatibility ? 4 : 8 ,
466+ maxUniformBuffersPerShaderStage : 12 ,
467+ maxUniformBufferBindingSize : compatibility ? 16384 : 65536 ,
468+ maxStorageBufferBindingSize : 134217728 ,
469+ minUniformBufferOffsetAlignment : 256 ,
470+ minStorageBufferOffsetAlignment : 256 ,
471+ maxVertexBuffers : 8 ,
472+ maxBufferSize : 268435456 ,
473+ maxVertexAttributes : 16 ,
474+ maxVertexBufferArrayStride : 2048 ,
475+ maxInterStageShaderVariables : compatibility ? 15 : 16 ,
476+ maxColorAttachments : compatibility ? 4 : 8 ,
477+ maxColorAttachmentBytesPerSample : 32 ,
478+ maxComputeWorkgroupStorageSize : 16384 ,
479+ maxComputeInvocationsPerWorkgroup : compatibility ? 128 : 256 ,
480+ maxComputeWorkgroupSizeX : compatibility ? 128 : 256 ,
481+ maxComputeWorkgroupSizeY : compatibility ? 128 : 256 ,
482+ maxComputeWorkgroupSizeZ : 64 ,
483+ maxComputeWorkgroupsPerDimension : 65535
484+ } ;
485+ limits [ Symbol . toStringTag ] = "GPUSupportedLimits" ;
486+ return limits ;
487+ }
488+
445489function __WebGPUReconstruct_GPU_requestAdapter ( originalMethod , options ) {
446490 __WebGPUReconstruct_DebugOutput ( "requestAdapter" ) ;
447491
@@ -454,6 +498,12 @@ function __WebGPUReconstruct_GPU_requestAdapter(originalMethod, options) {
454498 }
455499 }
456500 adapter . __defineGetter__ ( "features" , function ( ) { return features ; } ) ;
501+
502+ if ( __webGPUReconstruct . configuration . adapterDefaultLimits ) {
503+ let limits = __WebGPUReconstruct_getDefaultLimits ( options . featureLevel === "compatibility" ) ;
504+ adapter . __defineGetter__ ( "limits" , function ( ) { return limits ; } ) ;
505+ }
506+
457507 return adapter ;
458508 } ) ;
459509 } ) ;
@@ -666,6 +716,12 @@ $WRAP_COMMANDS
666716 this . configuration . captureMaxFrames = Number ( this . configuration . captureMaxFrames ) ;
667717 }
668718
719+ if ( this . configuration . adapterDefaultLimits === undefined ) {
720+ this . configuration . adapterDefaultLimits = false ;
721+ } else {
722+ this . configuration . adapterDefaultLimits = ( this . configuration . adapterDefaultLimits === true ) || ( this . configuration . adapterDefaultLimits === "true" ) ;
723+ }
724+
669725 if ( this . configuration . externalTextureScale === undefined ) {
670726 this . configuration . externalTextureScale = 100 ;
671727 } else {
0 commit comments