Skip to content

Commit

Permalink
Add WGPUPresentMode_Undefined defaulting to Fifo (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
kainino0x authored Sep 18, 2024
1 parent d5cd971 commit 2b59747
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
21 changes: 13 additions & 8 deletions webgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion webgpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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: |
Expand Down

0 comments on commit 2b59747

Please sign in to comment.