141
141
SurfaceDescriptorFromCanvasHTMLSelector : 4 ,
142
142
ShaderModuleSPIRVDescriptor : 5 ,
143
143
ShaderModuleWGSLDescriptor : 6 ,
144
+ PrimitiveDepthClipControl : 7 ,
145
+ RenderPassDescriptorMaxDrawCount : 15 ,
144
146
} ,
145
147
QueueWorkDoneStatus : {
146
148
Success : 0 ,
149
151
TextureFormat : {
150
152
Undefined : 0 ,
151
153
} ,
154
+ VertexStepMode : {
155
+ Vertex : 0 ,
156
+ Instance : 1 ,
157
+ VertexBufferNotUsed : 2 ,
158
+ } ,
152
159
} ;
153
160
return null ;
154
161
} ) ( ) ; } } }
@@ -380,19 +387,17 @@ var LibraryWebGPU = {
380
387
'validation' ,
381
388
'out-of-memory' ,
382
389
] ,
383
- FeatureName : {
384
- 0 : undefined ,
385
- 1 : 'depth-clip-control' ,
386
- 2 : 'depth24unorm-stencil8' ,
387
- 3 : 'depth32float-stencil8' ,
388
- 4 : 'timestamp-query' ,
389
- 5 : 'pipeline-statistics-query' ,
390
- 6 : 'texture-compression-bc' ,
391
- 7 : 'texture-compression-etc2' ,
392
- 8 : 'texture-compression-astc' ,
393
- 9 : 'indirect-first-instance' ,
394
- 1000 : 'depth-clamping' ,
395
- } ,
390
+ FeatureName : [
391
+ undefined ,
392
+ 'depth-clip-control' ,
393
+ 'depth32float-stencil8' ,
394
+ 'timestamp-query' ,
395
+ 'pipeline-statistics-query' ,
396
+ 'texture-compression-bc' ,
397
+ 'texture-compression-etc2' ,
398
+ 'texture-compression-astc' ,
399
+ 'indirect-first-instance' ,
400
+ ] ,
396
401
FilterMode : [
397
402
'nearest' ,
398
403
'linear' ,
@@ -423,10 +428,6 @@ var LibraryWebGPU = {
423
428
'low-power' ,
424
429
'high-performance' ,
425
430
] ,
426
- PredefinedColorSpace : [
427
- undefined ,
428
- 'srgb' ,
429
- ] ,
430
431
PrimitiveTopology : [
431
432
'point-list' ,
432
433
'line-list' ,
@@ -526,7 +527,6 @@ var LibraryWebGPU = {
526
527
'depth16unorm' ,
527
528
'depth24plus' ,
528
529
'depth24plus-stencil8' ,
529
- 'depth24unorm-stencil8' ,
530
530
'depth32float' ,
531
531
'depth32float-stencil8' ,
532
532
'bc1-rgba-unorm' ,
@@ -635,6 +635,7 @@ var LibraryWebGPU = {
635
635
VertexStepMode : [
636
636
'vertex' ,
637
637
'instance' ,
638
+ undefined ,
638
639
] ,
639
640
} ,
640
641
@@ -725,6 +726,8 @@ var LibraryWebGPU = {
725
726
setLimitValueU32 ( 'maxVertexAttributes ', { { { C_STRUCTS . WGPULimits . maxVertexAttributes } } } ) ;
726
727
setLimitValueU32 ( 'maxVertexBufferArrayStride ', { { { C_STRUCTS . WGPULimits . maxVertexBufferArrayStride } } } ) ;
727
728
setLimitValueU32 ( 'maxInterStageShaderComponents ', { { { C_STRUCTS . WGPULimits . maxInterStageShaderComponents } } } ) ;
729
+ setLimitValueU32 ( 'maxInterStageShaderVariables ', { { { C_STRUCTS . WGPULimits . maxInterStageShaderVariables } } } ) ;
730
+ setLimitValueU32 ( 'maxColorAttachments ', { { { C_STRUCTS . WGPULimits . maxColorAttachments } } } ) ;
728
731
setLimitValueU32 ( 'maxComputeWorkgroupStorageSize ', { { { C_STRUCTS . WGPULimits . maxComputeWorkgroupStorageSize } } } ) ;
729
732
setLimitValueU32 ( 'maxComputeInvocationsPerWorkgroup ', { { { C_STRUCTS . WGPULimits . maxComputeInvocationsPerWorkgroup } } } ) ;
730
733
setLimitValueU32 ( 'maxComputeWorkgroupSizeX ', { { { C_STRUCTS . WGPULimits . maxComputeWorkgroupSizeX } } } ) ;
@@ -1314,11 +1317,10 @@ var LibraryWebGPU = {
1314
1317
1315
1318
function makeVertexBuffer ( vbPtr ) {
1316
1319
if ( ! vbPtr ) return undefined ;
1317
-
1318
- return {
1320
+ var stepModeInt = { { { gpu . makeGetU32 ( 'vbPtr' , C_STRUCTS . WGPUVertexBufferLayout . stepMode ) } } } ;
1321
+ return stepModeInt === { { { gpu . VertexStepMode . VertexBufferNotUsed } } } ? null : {
1319
1322
"arrayStride ": { { { gpu . makeGetU64 ( 'vbPtr ', C_STRUCTS . WGPUVertexBufferLayout . arrayStride ) } } } ,
1320
- "stepMode ": WebGPU . VertexStepMode [
1321
- { { { gpu . makeGetU32 ( 'vbPtr' , C_STRUCTS . WGPUVertexBufferLayout . stepMode ) } } } ] ,
1323
+ "stepMode ": WebGPU . VertexStepMode [ stepModeInt ] ,
1322
1324
"attributes ": makeVertexAttributes (
1323
1325
{ { { gpu . makeGetU32 ( 'vbPtr ', C_STRUCTS . WGPUVertexBufferLayout . attributeCount ) } } } ,
1324
1326
{ { { makeGetValue ( 'vbPtr ', C_STRUCTS . WGPUVertexBufferLayout . attributes , '* ') } } } ) ,
@@ -1450,6 +1452,16 @@ var LibraryWebGPU = {
1450
1452
1451
1453
// wgpuQuerySet
1452
1454
1455
+ wgpuQuerySetGetCount : function ( querySetId ) {
1456
+ var querySet = WebGPU . mgrQuerySet . get ( querySetId ) ;
1457
+ return querySet . count ;
1458
+ } ,
1459
+
1460
+ wgpuQuerySetGetType : function ( querySetId , labelPtr ) {
1461
+ var querySet = WebGPU . mgrQuerySet . get ( querySetId ) ;
1462
+ return querySet . type ;
1463
+ } ,
1464
+
1453
1465
wgpuQuerySetSetLabel : function ( querySetId , labelPtr ) {
1454
1466
var querySet = WebGPU . mgrQuerySet . get ( querySetId ) ;
1455
1467
querySet . label = UTF8ToString ( labelPtr ) ;
@@ -1639,7 +1651,21 @@ var LibraryWebGPU = {
1639
1651
}
1640
1652
1641
1653
function makeRenderPassDescriptor ( descriptor ) {
1642
- { { { gpu . makeCheckDescriptor ( 'descriptor ') } } }
1654
+ { { { gpu . makeCheck ( 'descriptor ') } } }
1655
+ var nextInChainPtr = { { { makeGetValue ( 'descriptor' , C_STRUCTS . WGPURenderPassDescriptor . nextInChain , '*' ) } } } ;
1656
+
1657
+ var maxDrawCount = undefined ;
1658
+ if ( nextInChainPtr !== 0 ) {
1659
+ var sType = { { { gpu . makeGetU32 ( 'nextInChainPtr' , C_STRUCTS . WGPUChainedStruct . sType) } } } ;
1660
+ #if ASSERTIONS
1661
+ assert ( sType === { { { gpu . SType . RenderPassDescriptorMaxDrawCount } } } ) ;
1662
+ assert ( 0 === { { { makeGetValue ( 'nextInChainPtr' , C_STRUCTS . WGPUChainedStruct . next , '*' ) } } } ) ;
1663
+ #endif
1664
+ var renderPassDescriptorMaxDrawCount = nextInChainPtr ;
1665
+ { { { gpu . makeCheckDescriptor ( 'renderPassDescriptorMaxDrawCount' ) } } }
1666
+ maxDrawCount = { { { gpu . makeGetU64 ( 'renderPassDescriptorMaxDrawCount' , C_STRUCTS . WGPURenderPassDescriptorMaxDrawCount . maxDrawCount) } } } ;
1667
+ }
1668
+
1643
1669
var desc = {
1644
1670
"label" : undefined ,
1645
1671
"colorAttachments" : makeColorAttachments (
@@ -1649,6 +1675,7 @@ var LibraryWebGPU = {
1649
1675
{ { { makeGetValue ( 'descriptor' , C_STRUCTS . WGPURenderPassDescriptor . depthStencilAttachment , '*' ) } } } ) ,
1650
1676
"occlusionQuerySet" : WebGPU . mgrQuerySet . get (
1651
1677
{ { { makeGetValue ( 'descriptor' , C_STRUCTS . WGPURenderPassDescriptor . occlusionQuerySet , '*' ) } } } ) ,
1678
+ "maxDrawCount" : maxDrawCount ,
1652
1679
} ;
1653
1680
var labelPtr = { { { makeGetValue ( 'descriptor' , C_STRUCTS . WGPURenderPassDescriptor . label , '*' ) } } } ;
1654
1681
if ( labelPtr ) desc [ "label "] = UTF8ToString ( labelPtr ) ;
@@ -1659,6 +1686,7 @@ var LibraryWebGPU = {
1659
1686
timestampWriteCount ,
1660
1687
{ { { makeGetValue ( 'descriptor' , C_STRUCTS . WGPURenderPassDescriptor . timestampWrites , '*' ) } } } ) ;
1661
1688
}
1689
+
1662
1690
return desc ;
1663
1691
}
1664
1692
@@ -1917,6 +1945,17 @@ var LibraryWebGPU = {
1917
1945
} ) ;
1918
1946
} ,
1919
1947
1948
+ wgpuBufferGetSize : function ( bufferId ) {
1949
+ var buffer = WebGPU . mgrBuffer . get ( bufferId ) ;
1950
+ // 64-bit
1951
+ return buffer . size ;
1952
+ } ,
1953
+
1954
+ wgpuBufferGetUsage : function ( bufferId ) {
1955
+ var buffer = WebGPU . mgrBuffer . get ( bufferId ) ;
1956
+ return buffer . usage ;
1957
+ } ,
1958
+
1920
1959
wgpuBufferSetLabel : function ( bufferId , labelPtr ) {
1921
1960
var buffer = WebGPU . mgrBuffer . get ( bufferId ) ;
1922
1961
buffer . label = UTF8ToString ( labelPtr ) ;
@@ -1941,6 +1980,46 @@ var LibraryWebGPU = {
1941
1980
1942
1981
// wgpuTexture
1943
1982
1983
+ wgpuTextureGetDepthOrArrayLayers : function ( textureId ) {
1984
+ var texture = WebGPU . mgrTexture . get ( textureId ) ;
1985
+ return texture . depthOrArrayLayers ;
1986
+ } ,
1987
+
1988
+ wgpuTextureGetDimension : function ( textureId ) {
1989
+ var texture = WebGPU . mgrTexture . get ( textureId ) ;
1990
+ return texture . dimension ;
1991
+ } ,
1992
+
1993
+ wgpuTextureGetFormat : function ( textureId ) {
1994
+ var texture = WebGPU . mgrTexture . get ( textureId ) ;
1995
+ return texture . format ;
1996
+ } ,
1997
+
1998
+ wgpuTextureGetHeight : function ( textureId ) {
1999
+ var texture = WebGPU . mgrTexture . get ( textureId ) ;
2000
+ return texture . height ;
2001
+ } ,
2002
+
2003
+ wgpuTextureGetMipLevelCount : function ( textureId ) {
2004
+ var texture = WebGPU . mgrTexture . get ( textureId ) ;
2005
+ return texture . mipLevelCount ;
2006
+ } ,
2007
+
2008
+ wgpuTextureGetSampleCount : function ( textureId ) {
2009
+ var texture = WebGPU . mgrTexture . get ( textureId ) ;
2010
+ return texture . sampleCount ;
2011
+ } ,
2012
+
2013
+ wgpuTextureGetUsage : function ( textureId ) {
2014
+ var texture = WebGPU . mgrTexture . get ( textureId ) ;
2015
+ return texture . usage ;
2016
+ } ,
2017
+
2018
+ wgpuTextureGetWidth : function ( textureId ) {
2019
+ var texture = WebGPU . mgrTexture . get ( textureId ) ;
2020
+ return texture . width ;
2021
+ } ,
2022
+
1944
2023
wgpuTextureSetLabel : function ( textureId , labelPtr ) {
1945
2024
var texture = WebGPU . mgrTexture . get ( textureId ) ;
1946
2025
texture . label = UTF8ToString ( labelPtr ) ;
@@ -2412,6 +2491,8 @@ var LibraryWebGPU = {
2412
2491
wgpuAdapterGetProperties : function ( adapterId , properties ) {
2413
2492
{ { { gpu . makeCheckDescriptor ( 'properties' ) } } }
2414
2493
{ { { makeSetValue ( 'properties' , C_STRUCTS . WGPUAdapterProperties . vendorID , '0' , 'i32' ) } } } ;
2494
+ { { { makeSetValue ( 'properties' , C_STRUCTS . WGPUAdapterProperties . vendorName , '0' , 'i32' ) } } } ;
2495
+ { { { makeSetValue ( 'properties' , C_STRUCTS . WGPUAdapterProperties . architecture , '0' , 'i32' ) } } } ;
2415
2496
{ { { makeSetValue ( 'properties' , C_STRUCTS . WGPUAdapterProperties . deviceID , '0' , 'i32' ) } } } ;
2416
2497
{ { { makeSetValue ( 'properties' , C_STRUCTS . WGPUAdapterProperties . name , '0' , 'i32' ) } } } ;
2417
2498
{ { { makeSetValue ( 'properties' , C_STRUCTS . WGPUAdapterProperties . driverDescription , '0' , 'i32' ) } } } ;
@@ -2483,6 +2564,8 @@ var LibraryWebGPU = {
2483
2564
setLimitU32IfDefined ( "maxVertexAttributes ", { { { C_STRUCTS . WGPULimits . maxVertexAttributes } } } ) ;
2484
2565
setLimitU32IfDefined ( "maxVertexBufferArrayStride ", { { { C_STRUCTS . WGPULimits . maxVertexBufferArrayStride } } } ) ;
2485
2566
setLimitU32IfDefined ( "maxInterStageShaderComponents ", { { { C_STRUCTS . WGPULimits . maxInterStageShaderComponents } } } ) ;
2567
+ setLimitU32IfDefined ( "maxInterStageShaderVariables ", { { { C_STRUCTS . WGPULimits . maxInterStageShaderVariables } } } ) ;
2568
+ setLimitU32IfDefined ( "maxColorAttachments ", { { { C_STRUCTS . WGPULimits . maxColorAttachments } } } ) ;
2486
2569
setLimitU32IfDefined ( "maxComputeWorkgroupStorageSize ", { { { C_STRUCTS . WGPULimits . maxComputeWorkgroupStorageSize } } } ) ;
2487
2570
setLimitU32IfDefined ( "maxComputeInvocationsPerWorkgroup ", { { { C_STRUCTS . WGPULimits . maxComputeInvocationsPerWorkgroup } } } ) ;
2488
2571
setLimitU32IfDefined ( "maxComputeWorkgroupSizeX ", { { { C_STRUCTS . WGPULimits . maxComputeWorkgroupSizeX } } } ) ;
0 commit comments