-
Notifications
You must be signed in to change notification settings - Fork 0
/
surface.c3i
88 lines (69 loc) · 2.03 KB
/
surface.c3i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
module webgpu;
distinct Surface = void*;
fn void Surface.configure(Surface surface,
SurfaceConfiguration* configuration) @extern("wgpuSurfaceConfigure");
fn void Surface.getCapabilities(Surface surface,
Adapter adapter, SurfaceCapabilities* capabilities) @extern("wgpuSurfaceGetCapabilities");
fn Texture Surface.getCurrentTexture(Surface surface, SurfaceTexture* texture) @extern("wgpuSurfaceGetCurrentTexture");
fn TextureFormat Surface.getPreferredFormat(Surface surface,
Adapter adapter) @extern("wgpuSurfaceGetPreferredFormat");
fn void Surface.present(Surface surface) @extern("wgpuSurfacePresent");
fn void Surface.setLabel(Surface surface,
ZString label) @extern("wgpuSurfaceSetLabel");
fn void Surface.unconfigure(Surface surface) @extern("wgpuSurfaceUnconfigure");
fn void Surface.reference(Surface surface) @extern("wgpuSurfaceReference");
fn void Surface.release(Surface surface) @extern("wgpuSurfaceRelease");
fn void SurfaceCapabilities.freeMembers(SurfaceCapabilities* capabilities)
@extern("wgpuSurfaceCapabilitiesFreeMembers");
struct SurfaceDescriptor {
ChainedStruct* next;
ZString label;
}
struct SurfaceCapabilities {
ChainedStructOut* next;
TextureUsage usages;
usz formatCount;
TextureFormat* formats;
usz presentModeCount;
PresentMode* presentModes;
usz alphaModeCount;
CompositeAlphaMode* alphaModes;
}
struct SurfaceConfiguration {
ChainedStruct* next;
Device device;
TextureFormat format;
TextureUsage usage;
usz viewFormatCount;
TextureFormat* viewFormats;
CompositeAlphaMode alphaMode;
CUInt width;
CUInt height;
PresentMode presentMode;
}
struct SurfaceTexture {
Texture texture;
CBool suboptimal;
CurrentTextureStatus status;
}
enum CurrentTextureStatus {
SUCCESS,
TIMEOUT,
OUTDATED,
LOST,
OUT_OF_MEMORY,
DEVICE_LOST
}
enum CompositeAlphaMode {
AUTO,
OPAQUE,
PREMULTIPLIED,
UNPREMULTIPLIED,
INHERIT
}
enum PresentMode {
FIFO,
FIFO_RELAXED,
IMMEDIATE,
MAILBOX
}