@@ -987,8 +987,8 @@ var LibraryWebGPU = {
987
987
if ( viewFormatCount ) {
988
988
var viewFormatsPtr = { { { makeGetValue ( 'descriptor' , C_STRUCTS . WGPUTextureDescriptor . viewFormats , '*' ) } } } ;
989
989
// 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 ] ) ;
992
992
}
993
993
994
994
var device = WebGPU . mgrDevice . get ( deviceId ) ;
@@ -2766,9 +2766,6 @@ var LibraryWebGPU = {
2766
2766
var context = WebGPU . mgrSurface . get ( surfaceId ) ;
2767
2767
2768
2768
#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 . ") ;
2772
2769
assert ( { { { gpu . PresentMode . Fifo } } } ===
2773
2770
{ { { gpu . makeGetU32 ( 'config ', C_STRUCTS . WGPUSurfaceConfiguration . presentMode ) } } } ) ;
2774
2771
#endif
@@ -2794,6 +2791,16 @@ var LibraryWebGPU = {
2794
2791
"alphaMode" : WebGPU . AlphaMode [
2795
2792
{ { { gpu . makeGetU32 ( 'config' , C_STRUCTS . WGPUSurfaceConfiguration . alphaMode ) } } } ] ,
2796
2793
} ;
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
+
2797
2804
context . configure ( configuration ) ;
2798
2805
} ,
2799
2806
0 commit comments