@@ -82,7 +82,6 @@ typedef struct WGPURenderPipelineImpl* WGPURenderPipeline;
82
82
typedef struct WGPUSamplerImpl * WGPUSampler ;
83
83
typedef struct WGPUShaderModuleImpl * WGPUShaderModule ;
84
84
typedef struct WGPUSurfaceImpl * WGPUSurface ;
85
- typedef struct WGPUSwapChainImpl * WGPUSwapChain ;
86
85
typedef struct WGPUTextureImpl * WGPUTexture ;
87
86
typedef struct WGPUTextureViewImpl * WGPUTextureView ;
88
87
@@ -575,6 +574,15 @@ typedef enum WGPUVertexStepMode {
575
574
WGPUVertexStepMode_Force32 = 0x7FFFFFFF
576
575
} WGPUVertexStepMode ;
577
576
577
+ typedef enum WGPUSurfaceStatus {
578
+ WGPUSurfaceStatus_Good = 0x00000000 ,
579
+ WGPUSurfaceStatus_Suboptimal = 0x00000001 ,
580
+ WGPUSurfaceStatus_Timeout = 0x00000002 ,
581
+ WGPUSurfaceStatus_Outdated = 0x00000003 ,
582
+ WGPUSurfaceStatus_Lost = 0x00000004 ,
583
+ WGPUSurfaceStatus_Force32 = 0x7FFFFFFF
584
+ } WGPUSurfaceStatus ;
585
+
578
586
typedef enum WGPUBufferUsage {
579
587
WGPUBufferUsage_None = 0x00000000 ,
580
588
WGPUBufferUsage_MapRead = 0x00000001 ,
@@ -944,15 +952,17 @@ typedef struct WGPUSurfaceDescriptorFromXlibWindow {
944
952
uint32_t window ;
945
953
} WGPUSurfaceDescriptorFromXlibWindow ;
946
954
947
- typedef struct WGPUSwapChainDescriptor {
955
+ typedef struct WGPUSurfaceConfiguration {
948
956
WGPUChainedStruct const * nextInChain ;
949
- char const * label ; // nullable
950
- WGPUTextureUsageFlags usage ;
957
+ WGPUDevice device ;
951
958
WGPUTextureFormat format ;
959
+ WGPUTextureUsageFlags usage ;
960
+ uint32_t viewFormatsCount ;
961
+ WGPUTextureFormat const * viewFormats ;
952
962
uint32_t width ;
953
963
uint32_t height ;
954
964
WGPUPresentMode presentMode ;
955
- } WGPUSwapChainDescriptor ;
965
+ } WGPUSurfaceConfiguration ;
956
966
957
967
typedef struct WGPUTextureBindingLayout {
958
968
WGPUChainedStruct const * nextInChain ;
@@ -1268,7 +1278,6 @@ typedef WGPURenderPipeline (*WGPUProcDeviceCreateRenderPipeline)(WGPUDevice devi
1268
1278
typedef void (* WGPUProcDeviceCreateRenderPipelineAsync )(WGPUDevice device , WGPURenderPipelineDescriptor const * descriptor , WGPUCreateRenderPipelineAsyncCallback callback , void * userdata );
1269
1279
typedef WGPUSampler (* WGPUProcDeviceCreateSampler )(WGPUDevice device , WGPUSamplerDescriptor const * descriptor /* nullable */ );
1270
1280
typedef WGPUShaderModule (* WGPUProcDeviceCreateShaderModule )(WGPUDevice device , WGPUShaderModuleDescriptor const * descriptor );
1271
- typedef WGPUSwapChain (* WGPUProcDeviceCreateSwapChain )(WGPUDevice device , WGPUSurface surface , WGPUSwapChainDescriptor const * descriptor );
1272
1281
typedef WGPUTexture (* WGPUProcDeviceCreateTexture )(WGPUDevice device , WGPUTextureDescriptor const * descriptor );
1273
1282
typedef void (* WGPUProcDeviceDestroy )(WGPUDevice device );
1274
1283
typedef size_t (* WGPUProcDeviceEnumerateFeatures )(WGPUDevice device , WGPUFeatureName * features );
@@ -1354,10 +1363,10 @@ typedef void (*WGPUProcShaderModuleSetLabel)(WGPUShaderModule shaderModule, char
1354
1363
1355
1364
// Procs of Surface
1356
1365
typedef WGPUTextureFormat (* WGPUProcSurfaceGetPreferredFormat )(WGPUSurface surface , WGPUAdapter adapter );
1357
-
1358
- // Procs of SwapChain
1359
- typedef WGPUTextureView (* WGPUProcSwapChainGetCurrentTextureView )( WGPUSwapChain swapChain );
1360
- typedef void (* WGPUProcSwapChainPresent )( WGPUSwapChain swapChain );
1366
+ typedef void ( * WGPUProcSurfaceConfigure )( WGPUSurface surface , WGPUSurfaceConfiguration const * configuration );
1367
+ typedef void ( * WGPUProcSurfaceUnconfigure )( WGPUSurface surface );
1368
+ typedef WGPUTexture (* WGPUProcSurfaceGetCurrentTexture )( WGPUSurface surface , uint32_t * width , uint32_t * height , WGPUSurfaceStatus * status );
1369
+ typedef void (* WGPUProcSurfacePresent )( WGPUSurface surface );
1361
1370
1362
1371
// Procs of Texture
1363
1372
typedef WGPUTextureView (* WGPUProcTextureCreateView )(WGPUTexture texture , WGPUTextureViewDescriptor const * descriptor /* nullable */ );
@@ -1455,7 +1464,6 @@ WGPU_EXPORT WGPURenderPipeline wgpuDeviceCreateRenderPipeline(WGPUDevice device,
1455
1464
WGPU_EXPORT void wgpuDeviceCreateRenderPipelineAsync (WGPUDevice device , WGPURenderPipelineDescriptor const * descriptor , WGPUCreateRenderPipelineAsyncCallback callback , void * userdata );
1456
1465
WGPU_EXPORT WGPUSampler wgpuDeviceCreateSampler (WGPUDevice device , WGPUSamplerDescriptor const * descriptor /* nullable */ );
1457
1466
WGPU_EXPORT WGPUShaderModule wgpuDeviceCreateShaderModule (WGPUDevice device , WGPUShaderModuleDescriptor const * descriptor );
1458
- WGPU_EXPORT WGPUSwapChain wgpuDeviceCreateSwapChain (WGPUDevice device , WGPUSurface surface , WGPUSwapChainDescriptor const * descriptor );
1459
1467
WGPU_EXPORT WGPUTexture wgpuDeviceCreateTexture (WGPUDevice device , WGPUTextureDescriptor const * descriptor );
1460
1468
WGPU_EXPORT void wgpuDeviceDestroy (WGPUDevice device );
1461
1469
WGPU_EXPORT size_t wgpuDeviceEnumerateFeatures (WGPUDevice device , WGPUFeatureName * features );
@@ -1541,10 +1549,10 @@ WGPU_EXPORT void wgpuShaderModuleSetLabel(WGPUShaderModule shaderModule, char co
1541
1549
1542
1550
// Methods of Surface
1543
1551
WGPU_EXPORT WGPUTextureFormat wgpuSurfaceGetPreferredFormat (WGPUSurface surface , WGPUAdapter adapter );
1544
-
1545
- // Methods of SwapChain
1546
- WGPU_EXPORT WGPUTextureView wgpuSwapChainGetCurrentTextureView ( WGPUSwapChain swapChain );
1547
- WGPU_EXPORT void wgpuSwapChainPresent ( WGPUSwapChain swapChain );
1552
+ WGPU_EXPORT void wgpuSurfaceConfigure ( WGPUSurface surface , WGPUSurfaceConfiguration const * configuration );
1553
+ WGPU_EXPORT void wgpuSurfaceUnconfigure ( WGPUSurface surface );
1554
+ WGPU_EXPORT WGPUTexture wgpuSurfaceGetCurrentTexture ( WGPUSurface surface , uint32_t * width , uint32_t * height , WGPUSurfaceStatus * status );
1555
+ WGPU_EXPORT void wgpuSurfacePresent ( WGPUSurface surface );
1548
1556
1549
1557
// Methods of Texture
1550
1558
WGPU_EXPORT WGPUTextureView wgpuTextureCreateView (WGPUTexture texture , WGPUTextureViewDescriptor const * descriptor /* nullable */ );
0 commit comments