From 2b5974750be7b2545d842ecec02e585022081952 Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Wed, 18 Sep 2024 14:23:47 -0700 Subject: [PATCH] Add WGPUPresentMode_Undefined defaulting to Fifo (#333) --- webgpu.h | 21 +++++++++++++-------- webgpu.yml | 5 ++++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/webgpu.h b/webgpu.h index 9e2ce733..09505fff 100644 --- a/webgpu.h +++ b/webgpu.h @@ -517,30 +517,35 @@ typedef enum WGPUPowerPreference { typedef enum WGPUPresentMode { /** * `0x00000000`. + * Present mode is not specified. Use the default. + */ + WGPUPresentMode_Undefined = 0x00000000, + /** + * `0x00000001`. * The presentation of the image to the user waits for the next vertical blanking period to update in a first-in, first-out manner. * Tearing cannot be observed and frame-loop will be limited to the display's refresh rate. * This is the only mode that's always available. */ - WGPUPresentMode_Fifo = 0x00000000, + WGPUPresentMode_Fifo = 0x00000001, /** - * `0x00000001`. + * `0x00000002`. * The presentation of the image to the user tries to wait for the next vertical blanking period but may decide to not wait if a frame is presented late. * Tearing can sometimes be observed but late-frame don't produce a full-frame stutter in the presentation. * This is still a first-in, first-out mechanism so a frame-loop will be limited to the display's refresh rate. */ - WGPUPresentMode_FifoRelaxed = 0x00000001, + WGPUPresentMode_FifoRelaxed = 0x00000002, /** - * `0x00000002`. + * `0x00000003`. * The presentation of the image to the user is updated immediately without waiting for a vertical blank. * Tearing can be observed but latency is minimized. */ - WGPUPresentMode_Immediate = 0x00000002, + WGPUPresentMode_Immediate = 0x00000003, /** - * `0x00000003`. + * `0x00000004`. * The presentation of the image to the user waits for the next vertical blanking period to update to the latest provided image. * Tearing cannot be observed and a frame-loop is not limited to the display's refresh rate. */ - WGPUPresentMode_Mailbox = 0x00000003, + WGPUPresentMode_Mailbox = 0x00000004, WGPUPresentMode_Force32 = 0x7FFFFFFF } WGPUPresentMode WGPU_ENUM_ATTRIBUTE; @@ -1425,7 +1430,7 @@ typedef struct WGPUSurfaceConfiguration { */ WGPUCompositeAlphaMode alphaMode; /** - * When and in which order the surface's frames will be shown on the screen. + * When and in which order the surface's frames will be shown on the screen. Defaults to @ref WGPUPresentMode_Fifo. */ WGPUPresentMode presentMode; } WGPUSurfaceConfiguration WGPU_STRUCTURE_ATTRIBUTE; diff --git a/webgpu.yml b/webgpu.yml index cb943211..60838183 100644 --- a/webgpu.yml +++ b/webgpu.yml @@ -598,6 +598,9 @@ enums: - name: present_mode doc: Describes when and in which order frames are presented on the screen when `::wgpuSurfacePresent` is called. entries: + - name: undefined + doc: | + Present mode is not specified. Use the default. - name: fifo doc: | The presentation of the image to the user waits for the next vertical blanking period to update in a first-in, first-out manner. @@ -2725,7 +2728,7 @@ structs: doc: How the surface's frames will be composited on the screen. type: enum.composite_alpha_mode - name: present_mode - doc: When and in which order the surface's frames will be shown on the screen. + doc: When and in which order the surface's frames will be shown on the screen. Defaults to @ref WGPUPresentMode_Fifo. type: enum.present_mode - name: surface_descriptor doc: |