@@ -1728,8 +1728,8 @@ var LibraryWebGPU = {
17281728 if ( viewFormatCount ) {
17291729 var viewFormatsPtr = { { { makeGetValue ( 'descriptor' , C_STRUCTS . WGPUTextureDescriptor . viewFormats , '*' ) } } } ;
17301730 // viewFormatsPtr pointer to an array of TextureFormat which is an enum of size uint32_t
1731- desc [ " viewFormats" ] = Array. from ( { { { makeHEAPView ( '32' , 'viewFormatsPtr' , ` viewFormatsPtr + viewFormatCount * 4` ) } } } ,
1732- function ( format ) { return WebGPU . TextureFormat [ format ] ; } ) ;
1731+ desc [ ' viewFormats' ] = Array. from ( { { { makeHEAPView ( '32' , 'viewFormatsPtr' , ' viewFormatsPtr + viewFormatCount * 4' ) } } } ,
1732+ format => WebGPU . TextureFormat [ format ] ) ;
17331733 }
17341734
17351735 var device = WebGPU . getJsObject ( devicePtr ) ;
@@ -2336,9 +2336,6 @@ var LibraryWebGPU = {
23362336 var context = WebGPU . getJsObject ( surfacePtr ) ;
23372337
23382338#if ASSERTIONS
2339- var viewFormatCount = { { { gpu . makeGetU32 ( 'config' , C_STRUCTS . WGPUSurfaceConfiguration . viewFormatCount ) } } } ;
2340- var viewFormats = { { { makeGetValue ( 'config' , C_STRUCTS . WGPUSurfaceConfiguration . viewFormats , '*' ) } } } ;
2341- assert ( viewFormatCount === 0 && viewFormats === 0 , "TODO: Support viewFormats." ) ;
23422339 assert ( { { { gpu . PresentMode . Fifo } } } ===
23432340 { { { gpu . makeGetU32 ( 'config' , C_STRUCTS . WGPUSurfaceConfiguration . presentMode ) } } } ) ;
23442341#endif
@@ -2364,6 +2361,15 @@ var LibraryWebGPU = {
23642361 "alphaMode" : WebGPU . CompositeAlphaMode [
23652362 { { { gpu . makeGetU32 ( 'config' , C_STRUCTS . WGPUSurfaceConfiguration . alphaMode ) } } } ] ,
23662363 } ;
2364+
2365+ var viewFormatCount = { { { gpu . makeGetU32 ( 'config' , C_STRUCTS . WGPUSurfaceConfiguration . viewFormatCount ) } } } ;
2366+ if ( viewFormatCount ) {
2367+ var viewFormatsPtr = { { { makeGetValue ( 'config' , C_STRUCTS . WGPUSurfaceConfiguration . viewFormats , '*' ) } } } ;
2368+ // viewFormatsPtr pointer to an array of TextureFormat which is an enum of size uint32_t
2369+ configuration [ 'viewFormats '] = Array . from ( { { { makeHEAPView ( '32' , 'viewFormatsPtr' , 'viewFormatsPtr + viewFormatCount * 4' ) } } } ,
2370+ format => WebGPU . TextureFormat [ format ] ) ;
2371+ }
2372+
23672373 context . configure ( configuration ) ;
23682374 } ,
23692375
0 commit comments