-
Notifications
You must be signed in to change notification settings - Fork 0
/
device.c3i
201 lines (155 loc) · 6.14 KB
/
device.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
module webgpu;
distinct Device = void*;
fault DeviceError {
REQUEST_FAILED
}
fn void* getProcAddress(Device device, ZString name) @extern("wgpuGetProcAddress");
fn BindGroup Device.createBindGroup(Device device, BindGroupDescriptor* descriptor)
@extern("wgpuDeviceCreateBindGroup");
fn BindGroupLayout Device.createBindGroupLayout(Device device, BindGroupLayoutDescriptor* descriptor)
@extern("wgpuDeviceCreateBindGroupLayout");
fn Buffer Device.createBuffer(Device device, BufferDescriptor* descriptor)
@extern("wgpuDeviceCreateBuffer");
fn CommandEncoder Device.createCommandEncoder(Device device, CommandEncoderDescriptor* descriptor = null)
@extern("wgpuDeviceCreateCommandEncoder");
fn ComputePipeline Device.createComputePipeline(Device device, ComputePipelineDescriptor* descriptor)
@extern("wgpuDeviceCreateComputePipeline");
fn void Device.createComputePipelineAsync(Device device, ComputePipelineDescriptor* descriptor,
CreateComputePipelineAsyncCallback callback) @extern("wgpuDeviceCreateComputePipelineAsync");
fn PipelineLayout Device.createPipelineLayout(Device device, PipelineLayoutDescriptor* descriptor)
@extern("wgpuDeviceCreatePipelineLayout");
fn QuerySet Device.createQuerySet(Device device, QuerySetDescriptor* descriptor)
@extern("wgpuDeviceCreateQuerySet");
fn RenderBundleEncoder Device.createRenderBundleEncoder(Device device, RenderBundleEncoderDescriptor* descriptor)
@extern("wgpuDeviceCreateRenderBundleEncoder");
fn RenderPipeline Device.createRenderPipeline(Device device, RenderPipelineDescriptor* descriptor)
@extern("wgpuDeviceCreateRenderPipeline");
fn void Device.createRenderPipelineAsync(Device device, RenderPipelineDescriptor* descriptor,
CreateRenderPipelineAsyncCallback callback) @extern("wgpuDeviceCreateRenderPipelineAsync");
fn Sampler Device.createSampler(Device device, SamplerDescriptor* descriptor) @extern("wgpuDeviceCreateSampler");
fn ShaderModule Device.createShaderModule(Device device, ShaderModuleDescriptor* descriptor)
@extern("wgpuDeviceCreateShaderModule");
fn Texture Device.createTexture(Device device, TextureDescriptor* descriptor)
@extern("wgpuDeviceCreateTexture");
fn void Device.destroy(Device device) @extern("wgpuDeviceDestroy");
fn usz Device.enumerateFeatures(Device device, FeatureName* features) @extern("wgpuDeviceEnumerateFeatures");
fn CBool Device.getLimits(Device device, SupportedLimits* limits) @extern("wgpuDeviceGetLimits");
fn Queue Device.getQueue(Device device) @extern("wgpuDeviceGetQueue");
fn CBool Device.hasFeature(Device device, FeatureName feature) @extern("wgpuDeviceHasFeature");
fn void Device.popErrorScope(Device device, ErrorCallback callback) @extern("wgpuDevicePopErrorScope");
fn void Device.pushErrorScope(Device device, ErrorFilter filter) @extern("wgpuDevicePushErrorScope");
fn void Device.setLabel(Device device, ZString label) @extern("wgpuDeviceSetLabel");
fn void Device.setUncapturedErrorCallback(Device device, ErrorCallback callback)
@extern("wgpuDeviceSetUncapturedErrorCallback");
fn void Device.reference(Device device) @extern("wgpuDeviceReference");
fn void Device.release(Device device) @extern("wgpuDeviceRelease");
def DeviceLostCallback = fn void (DeviceLostReason reason, ZString message, UserData data);
def ErrorCallback = fn void(ErrorType type, ZString message, UserData data);
def CreateDeviceAsyncCallback = fn void(CreatePipelineAsyncStatus status,
Device device, ZString message, UserData data);
def CreateRenderPipelineAsyncCallback = fn void(CreatePipelineAsyncStatus status,
RenderPipeline pipeline, ZString message, UserData data);
def CreateComputePipelineAsyncCallback = fn void(CreatePipelineAsyncStatus status,
ComputePipeline pipeline, ZString message, UserData data);
struct DeviceDescriptor {
ChainedStruct* next;
ZString label;
usz requiredFeatureCount;
FeatureName* requiredFeatures;
RequiredLimits* requiredLimits;
QueueDescriptor defaultQueue;
DeviceLostCallback deviceLostCallback;
UserData deviceLostUserdata;
UncapturedErrorCallbackInfo uncapturedErrorCallbackInfo;
}
struct RequiredLimits {
ChainedStruct* next;
Limits limits;
}
struct SupportedLimits {
ChainedStruct* next;
Limits limits;
}
struct Limits {
CUInt maxTextureDimension1D;
CUInt maxTextureDimension2D;
CUInt maxTextureDimension3D;
CUInt maxTextureArrayLayers;
CUInt maxBindGroups;
CUInt maxBindGroupsPlusVertexBuffers;
CUInt maxBindingsPerBindGroup;
CUInt maxDynamicUniformBuffersPerPipelineLayout;
CUInt maxDynamicStorageBuffersPerPipelineLayout;
CUInt maxSampledTexturesPerShaderStage;
CUInt maxSamplersPerShaderStage;
CUInt maxStorageBuffersPerShaderStage;
CUInt maxStorageTexturesPerShaderStage;
CUInt maxUniformBuffersPerShaderStage;
CULong maxUniformBufferBindingSize;
CULong maxStorageBufferBindingSize;
CUInt minUniformBufferOffsetAlignment;
CUInt minStorageBufferOffsetAlignment;
CUInt maxVertexBuffers;
CULong maxBufferSize;
CUInt maxVertexAttributes;
CUInt maxVertexBufferArrayStride;
CUInt maxInterStageShaderComponents;
CUInt maxInterStageShaderVariables;
CUInt maxColorAttachments;
CUInt maxColorAttachmentBytesPerSample;
CUInt maxComputeWorkgroupStorageSize;
CUInt maxComputeInvocationsPerWorkgroup;
CUInt maxComputeWorkgroupSizeX;
CUInt maxComputeWorkgroupSizeY;
CUInt maxComputeWorkgroupSizeZ;
CUInt maxComputeWorkgroupsPerDimension;
}
struct UncapturedErrorCallbackInfo {
ChainedStruct* next;
ErrorCallback callback;
UserData userData;
}
enum FeatureName {
UNDEFINED,
DEPTH_CLIP_CONTROL,
DEPTH_32FLOAT_STENCIL_8,
TIMESTAMP_QUERY,
TEXTURE_COMPRESSION_BC,
TEXTURE_COMPRESSION_ETC2,
TEXTURE_COMPRESSION_ASTC,
INDIRECT_FIRST_INSTANCE,
SHADER_F16,
RG11_B10_UFLOAT_RENDERABLE,
BGRA_8UNORM_STORAGE,
FLOAT32_FILTERABLE
}
enum CreatePipelineAsyncStatus {
SUCCESS,
VALIDATION_ERROR,
INTERNAL_ERROR,
DEVICE_LOST,
DEVICE_DESTROYED,
UNKNOWN
}
enum RequestDeviceStatus {
SUCCESS,
ERROR,
UNKNOWN
}
enum DeviceLostReason {
UNDEFINED,
DESTROYED
}
enum ErrorFilter {
VALIDATION,
OUT_OF_MEMORY,
INTERNAL
}
enum ErrorType {
NO_ERROR,
VALIDATION,
OUT_OF_MEMORY,
INTERNAL,
UNKNOWN,
DEVICE_LOST
}