@@ -987,8 +987,8 @@ var LibraryWebGPU = {
987987 if ( viewFormatCount ) {
988988 var viewFormatsPtr = { { { makeGetValue ( 'descriptor' , C_STRUCTS . WGPUTextureDescriptor . viewFormats , '*' ) } } } ;
989989 // viewFormatsPtr pointer to an array of TextureFormat which is an enum of size uint32_t
990- desc [ " viewFormats " ] = Array . from ( { { { makeHEAPView ( '32' , 'viewFormatsPtr' , ` viewFormatsPtr + viewFormatCount * 4` ) } } } ,
991- function ( format ) { return WebGPU . TextureFormat [ format ] ; } ) ;
990+ desc [ ' viewFormats ' ] = Array . from ( { { { makeHEAPView ( '32' , 'viewFormatsPtr' , ' viewFormatsPtr + viewFormatCount * 4' ) } } } ,
991+ format => WebGPU . TextureFormat [ format ] ) ;
992992 }
993993
994994 var device = WebGPU . mgrDevice . get ( deviceId ) ;
@@ -2766,9 +2766,6 @@ var LibraryWebGPU = {
27662766 var context = WebGPU . mgrSurface . get ( surfaceId ) ;
27672767
27682768#if ASSERTIONS
2769- var viewFormatCount = { { { gpu . makeGetU32 ( 'config' , C_STRUCTS . WGPUSurfaceConfiguration . viewFormatCount ) } } } ;
2770- var viewFormats = { { { makeGetValue ( 'config' , C_STRUCTS . WGPUSurfaceConfiguration . viewFormats , '*' ) } } } ;
2771- assert ( viewFormatCount === 0 && viewFormats === 0 , "TODO : Support viewFormats . ") ;
27722769 assert ( { { { gpu . PresentMode . Fifo } } } ===
27732770 { { { gpu . makeGetU32 ( 'config ', C_STRUCTS . WGPUSurfaceConfiguration . presentMode ) } } } ) ;
27742771#endif
@@ -2794,6 +2791,16 @@ var LibraryWebGPU = {
27942791 "alphaMode" : WebGPU . AlphaMode [
27952792 { { { gpu . makeGetU32 ( 'config' , C_STRUCTS . WGPUSurfaceConfiguration . alphaMode ) } } } ] ,
27962793 } ;
2794+
2795+ var viewFormatCount = { { { gpu . makeGetU32 ( 'config' , C_STRUCTS . WGPUSurfaceConfiguration . viewFormatCount ) } } } ;
2796+
2797+ if ( viewFormatCount ) {
2798+ var viewFormats = { { { makeGetValue ( 'config' , C_STRUCTS . WGPUSurfaceConfiguration . viewFormats , '*' ) } } } ;
2799+ // viewFormats pointer to an array of TextureFormat which is an enum of size uint32_t
2800+ configuration [ 'viewFormats '] = Array . from ( { { { makeHEAPView ( '32' , 'viewFormats' , 'viewFormats + viewFormatCount * 4' ) } } } ,
2801+ format => WebGPU . TextureFormat [ format ] ) ;
2802+ }
2803+
27972804 context . configure ( configuration ) ;
27982805 } ,
27992806
0 commit comments