1 /*
2 Copyright (c) 2019-2021 Timur Gafarov.
3 
4 Boost Software License - Version 1.0 - August 17th, 2003
5 
6 Permission is hereby granted, free of charge, to any person or organization
7 obtaining a copy of the software and accompanying documentation covered by
8 this license (the "Software") to use, reproduce, display, distribute,
9 execute, and transmit the Software, and to prepare derivative works of the
10 Software, and to permit third-parties to whom the Software is furnished to
11 do so, all subject to the following:
12 
13 The copyright notices in the Software and this entire statement, including
14 the above license grant, this restriction and the following disclaimer,
15 must be included in all copies of the Software, in whole or in part, and
16 all derivative works of the Software, unless such copies or derivative
17 works are solely in the form of machine-executable object code generated by
18 a source language processor.
19 
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
23 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
24 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
25 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 DEALINGS IN THE SOFTWARE.
27 */
28 module bindbc.wgpu.types;
29 
30 import core.stdc.stdint;
31 
32 enum ulong WGPU_WHOLE_SIZE = 0xffffffffffffffffUL;
33 enum ulong WGPU_COPY_STRIDE_UNDEFINED = 0xffffffffUL;
34 enum ulong WGPU_LIMIT_U32_UNDEFINED = 0xffffffffUL;
35 enum ulong WGPU_LIMIT_U64_UNDEFINED = 0xffffffffffffffffUL;
36 enum ulong WGPU_ARRAY_LAYER_COUNT_UNDEFINED = 0xffffffffUL;
37 enum ulong WGPU_MIP_LEVEL_COUNT_UNDEFINED = 0xffffffffUL;
38 
39 alias WGPUFlags = uint;
40 
41 alias WGPUAdapter = void*;
42 alias WGPUBindGroup = void*;
43 alias WGPUBindGroupLayout = void*;
44 alias WGPUBuffer = void*;
45 alias WGPUCommandBuffer = void*;
46 alias WGPUCommandEncoder = void*;
47 alias WGPUComputePassEncoder = void*;
48 alias WGPUComputePipeline = void*;
49 alias WGPUDevice = void*;
50 alias WGPUInstance = void*;
51 alias WGPUPipelineLayout = void*;
52 alias WGPUQuerySet = void*;
53 alias WGPUQueue = void*;
54 alias WGPURenderBundle = void*;
55 alias WGPURenderBundleEncoder = void*;
56 alias WGPURenderPassEncoder = void*;
57 alias WGPURenderPipeline = void*;
58 alias WGPUSampler = void*;
59 alias WGPUShaderModule = void*;
60 alias WGPUSurface = void*;
61 alias WGPUSwapChain = void*;
62 alias WGPUTexture = void*;
63 alias WGPUTextureView = void*;
64 
65 enum WGPUAdapterType
66 {
67     DiscreteGPU = 0x00000000,
68     IntegratedGPU = 0x00000001,
69     CPU = 0x00000002,
70     Unknown = 0x00000003,
71     Force32 = 0x7FFFFFFF
72 }
73 
74 enum WGPUAddressMode
75 {
76     Repeat = 0x00000000,
77     MirrorRepeat = 0x00000001,
78     ClampToEdge = 0x00000002,
79     Force32 = 0x7FFFFFFF
80 }
81 
82 enum WGPUBackendType
83 {
84     Null = 0x00000000,
85     WebGPU = 0x00000001,
86     D3D11 = 0x00000002,
87     D3D12 = 0x00000003,
88     Metal = 0x00000004,
89     Vulkan = 0x00000005,
90     OpenGL = 0x00000006,
91     OpenGLES = 0x00000007,
92     Force32 = 0x7FFFFFFF
93 }
94 
95 enum WGPUBlendFactor
96 {
97     Zero = 0x00000000,
98     One = 0x00000001,
99     Src = 0x00000002,
100     OneMinusSrc = 0x00000003,
101     SrcAlpha = 0x00000004,
102     OneMinusSrcAlpha = 0x00000005,
103     Dst = 0x00000006,
104     OneMinusDst = 0x00000007,
105     DstAlpha = 0x00000008,
106     OneMinusDstAlpha = 0x00000009,
107     SrcAlphaSaturated = 0x0000000A,
108     Constant = 0x0000000B,
109     OneMinusConstant = 0x0000000C,
110     Force32 = 0x7FFFFFFF
111 }
112 
113 enum WGPUBlendOperation
114 {
115     Add = 0x00000000,
116     Subtract = 0x00000001,
117     ReverseSubtract = 0x00000002,
118     Min = 0x00000003,
119     Max = 0x00000004,
120     Force32 = 0x7FFFFFFF
121 }
122 
123 enum WGPUBufferBindingType
124 {
125     Undefined = 0x00000000,
126     Uniform = 0x00000001,
127     Storage = 0x00000002,
128     ReadOnlyStorage = 0x00000003,
129     Force32 = 0x7FFFFFFF
130 }
131 
132 enum WGPUBufferMapAsyncStatus
133 {
134     Success = 0x00000000,
135     Error = 0x00000001,
136     Unknown = 0x00000002,
137     DeviceLost = 0x00000003,
138     DestroyedBeforeCallback = 0x00000004,
139     UnmappedBeforeCallback = 0x00000005,
140     Force32 = 0x7FFFFFFF
141 }
142 
143 enum WGPUCompareFunction
144 {
145     Undefined = 0x00000000,
146     Never = 0x00000001,
147     Less = 0x00000002,
148     LessEqual = 0x00000003,
149     Greater = 0x00000004,
150     GreaterEqual = 0x00000005,
151     Equal = 0x00000006,
152     NotEqual = 0x00000007,
153     Always = 0x00000008,
154     Force32 = 0x7FFFFFFF
155 }
156 
157 enum WGPUCompilationMessageType
158 {
159     Error = 0x00000000,
160     Warning = 0x00000001,
161     Info = 0x00000002,
162     Force32 = 0x7FFFFFFF
163 }
164 
165 enum WGPUCreatePipelineAsyncStatus
166 {
167     Success = 0x00000000,
168     Error = 0x00000001,
169     DeviceLost = 0x00000002,
170     DeviceDestroyed = 0x00000003,
171     Unknown = 0x00000004,
172     Force32 = 0x7FFFFFFF
173 }
174 
175 enum WGPUCullMode
176 {
177     None = 0x00000000,
178     Front = 0x00000001,
179     Back = 0x00000002,
180     Force32 = 0x7FFFFFFF
181 }
182 
183 enum WGPUDeviceLostReason
184 {
185     Undefined = 0x00000000,
186     Destroyed = 0x00000001,
187     Force32 = 0x7FFFFFFF
188 }
189 
190 enum WGPUErrorFilter
191 {
192     None = 0x00000000,
193     Validation = 0x00000001,
194     OutOfMemory = 0x00000002,
195     Force32 = 0x7FFFFFFF
196 }
197 
198 enum WGPUErrorType
199 {
200     NoError = 0x00000000,
201     Validation = 0x00000001,
202     OutOfMemory = 0x00000002,
203     Unknown = 0x00000003,
204     DeviceLost = 0x00000004,
205     Force32 = 0x7FFFFFFF
206 }
207 
208 enum WGPUFeatureName
209 {
210     Undefined = 0x00000000,
211     DepthClamping = 0x00000001,
212     Depth24UnormStencil8 = 0x00000002,
213     Depth32FloatStencil8 = 0x00000003,
214     TimestampQuery = 0x00000004,
215     PipelineStatisticsQuery = 0x00000005,
216     TextureCompressionBC = 0x00000006,
217     Force32 = 0x7FFFFFFF
218 }
219 
220 enum WGPUFilterMode
221 {
222     Nearest = 0x00000000,
223     Linear = 0x00000001,
224     Force32 = 0x7FFFFFFF
225 }
226 
227 enum WGPUFrontFace
228 {
229     CCW = 0x00000000,
230     CW = 0x00000001,
231     Force32 = 0x7FFFFFFF
232 }
233 
234 enum WGPUIndexFormat
235 {
236     Undefined = 0x00000000,
237     Uint16 = 0x00000001,
238     Uint32 = 0x00000002,
239     Force32 = 0x7FFFFFFF
240 }
241 
242 enum WGPULoadOp
243 {
244     Clear = 0x00000000,
245     Load = 0x00000001,
246     Force32 = 0x7FFFFFFF
247 }
248 
249 enum WGPUPipelineStatisticName
250 {
251     VertexShaderInvocations = 0x00000000,
252     ClipperInvocations = 0x00000001,
253     ClipperPrimitivesOut = 0x00000002,
254     FragmentShaderInvocations = 0x00000003,
255     ComputeShaderInvocations = 0x00000004,
256     Force32 = 0x7FFFFFFF
257 }
258 
259 enum WGPUPowerPreference
260 {
261     LowPower = 0x00000000,
262     HighPerformance = 0x00000001,
263     Force32 = 0x7FFFFFFF
264 }
265 
266 enum WGPUPresentMode
267 {
268     Immediate = 0x00000000,
269     Mailbox = 0x00000001,
270     Fifo = 0x00000002,
271     Force32 = 0x7FFFFFFF
272 }
273 
274 enum WGPUPrimitiveTopology
275 {
276     PointList = 0x00000000,
277     LineList = 0x00000001,
278     LineStrip = 0x00000002,
279     TriangleList = 0x00000003,
280     TriangleStrip = 0x00000004,
281     Force32 = 0x7FFFFFFF
282 }
283 
284 enum WGPUQueryType
285 {
286     Occlusion = 0x00000000,
287     PipelineStatistics = 0x00000001,
288     Timestamp = 0x00000002,
289     Force32 = 0x7FFFFFFF
290 }
291 
292 enum WGPUQueueWorkDoneStatus
293 {
294     Success = 0x00000000,
295     Error = 0x00000001,
296     Unknown = 0x00000002,
297     DeviceLost = 0x00000003,
298     Force32 = 0x7FFFFFFF
299 }
300 
301 enum WGPURequestAdapterStatus
302 {
303     Success = 0x00000000,
304     Unavailable = 0x00000001,
305     Error = 0x00000002,
306     Unknown = 0x00000003,
307     Force32 = 0x7FFFFFFF
308 }
309 
310 enum WGPURequestDeviceStatus
311 {
312     Success = 0x00000000,
313     Error = 0x00000001,
314     Unknown = 0x00000002,
315     Force32 = 0x7FFFFFFF
316 }
317 
318 enum WGPUSType
319 {
320     Invalid = 0x00000000,
321     SurfaceDescriptorFromMetalLayer = 0x00000001,
322     SurfaceDescriptorFromWindowsHWND = 0x00000002,
323     SurfaceDescriptorFromXlib = 0x00000003,
324     SurfaceDescriptorFromCanvasHTMLSelector = 0x00000004,
325     ShaderModuleSPIRVDescriptor = 0x00000005,
326     ShaderModuleWGSLDescriptor = 0x00000006,
327     PrimitiveDepthClampingState = 0x00000007,
328     Force32 = 0x7FFFFFFF
329 }
330 
331 enum WGPUSamplerBindingType
332 {
333     Undefined = 0x00000000,
334     Filtering = 0x00000001,
335     NonFiltering = 0x00000002,
336     Comparison = 0x00000003,
337     Force32 = 0x7FFFFFFF
338 }
339 
340 enum WGPUStencilOperation
341 {
342     Keep = 0x00000000,
343     Zero = 0x00000001,
344     Replace = 0x00000002,
345     Invert = 0x00000003,
346     IncrementClamp = 0x00000004,
347     DecrementClamp = 0x00000005,
348     IncrementWrap = 0x00000006,
349     DecrementWrap = 0x00000007,
350     Force32 = 0x7FFFFFFF
351 }
352 
353 enum WGPUStorageTextureAccess
354 {
355     Undefined = 0x00000000,
356     WriteOnly = 0x00000001,
357     Force32 = 0x7FFFFFFF
358 }
359 
360 enum WGPUStoreOp
361 {
362     Store = 0x00000000,
363     Discard = 0x00000001,
364     Force32 = 0x7FFFFFFF
365 }
366 
367 enum WGPUTextureAspect
368 {
369     All = 0x00000000,
370     StencilOnly = 0x00000001,
371     DepthOnly = 0x00000002,
372     Force32 = 0x7FFFFFFF
373 }
374 
375 enum WGPUTextureComponentType
376 {
377     Float = 0x00000000,
378     Sint = 0x00000001,
379     Uint = 0x00000002,
380     DepthComparison = 0x00000003,
381     Force32 = 0x7FFFFFFF
382 }
383 
384 enum WGPUTextureDimension
385 {
386     D1 = 0x00000000,
387     D2 = 0x00000001,
388     D3 = 0x00000002,
389     Force32 = 0x7FFFFFFF
390 }
391 
392 enum WGPUTextureFormat
393 {
394     Undefined = 0x00000000,
395     R8Unorm = 0x00000001,
396     R8Snorm = 0x00000002,
397     R8Uint = 0x00000003,
398     R8Sint = 0x00000004,
399     R16Uint = 0x00000005,
400     R16Sint = 0x00000006,
401     R16Float = 0x00000007,
402     RG8Unorm = 0x00000008,
403     RG8Snorm = 0x00000009,
404     RG8Uint = 0x0000000A,
405     RG8Sint = 0x0000000B,
406     R32Float = 0x0000000C,
407     R32Uint = 0x0000000D,
408     R32Sint = 0x0000000E,
409     RG16Uint = 0x0000000F,
410     RG16Sint = 0x00000010,
411     RG16Float = 0x00000011,
412     RGBA8Unorm = 0x00000012,
413     RGBA8UnormSrgb = 0x00000013,
414     RGBA8Snorm = 0x00000014,
415     RGBA8Uint = 0x00000015,
416     RGBA8Sint = 0x00000016,
417     BGRA8Unorm = 0x00000017,
418     BGRA8UnormSrgb = 0x00000018,
419     RGB10A2Unorm = 0x00000019,
420     RG11B10Ufloat = 0x0000001A,
421     RGB9E5Ufloat = 0x0000001B,
422     RG32Float = 0x0000001C,
423     RG32Uint = 0x0000001D,
424     RG32Sint = 0x0000001E,
425     RGBA16Uint = 0x0000001F,
426     RGBA16Sint = 0x00000020,
427     RGBA16Float = 0x00000021,
428     RGBA32Float = 0x00000022,
429     RGBA32Uint = 0x00000023,
430     RGBA32Sint = 0x00000024,
431     Stencil8 = 0x00000025,
432     Depth16Unorm = 0x00000026,
433     Depth24Plus = 0x00000027,
434     Depth24PlusStencil8 = 0x00000028,
435     Depth32Float = 0x00000029,
436     BC1RGBAUnorm = 0x0000002A,
437     BC1RGBAUnormSrgb = 0x0000002B,
438     BC2RGBAUnorm = 0x0000002C,
439     BC2RGBAUnormSrgb = 0x0000002D,
440     BC3RGBAUnorm = 0x0000002E,
441     BC3RGBAUnormSrgb = 0x0000002F,
442     BC4RUnorm = 0x00000030,
443     BC4RSnorm = 0x00000031,
444     BC5RGUnorm = 0x00000032,
445     BC5RGSnorm = 0x00000033,
446     BC6HRGBUfloat = 0x00000034,
447     BC6HRGBFloat = 0x00000035,
448     BC7RGBAUnorm = 0x00000036,
449     BC7RGBAUnormSrgb = 0x00000037,
450     Force32 = 0x7FFFFFFF
451 }
452 
453 enum WGPUTextureSampleType
454 {
455     Undefined = 0x00000000,
456     Float = 0x00000001,
457     UnfilterableFloat = 0x00000002,
458     Depth = 0x00000003,
459     Sint = 0x00000004,
460     Uint = 0x00000005,
461     Force32 = 0x7FFFFFFF
462 }
463 
464 enum WGPUTextureViewDimension
465 {
466     Undefined = 0x00000000,
467     D1 = 0x00000001,
468     D2 = 0x00000002,
469     D2Array = 0x00000003,
470     Cube = 0x00000004,
471     CubeArray = 0x00000005,
472     D3 = 0x00000006,
473     Force32 = 0x7FFFFFFF
474 }
475 
476 enum WGPUVertexFormat
477 {
478     Undefined = 0x00000000,
479     Uint8x2 = 0x00000001,
480     Uint8x4 = 0x00000002,
481     Sint8x2 = 0x00000003,
482     Sint8x4 = 0x00000004,
483     Unorm8x2 = 0x00000005,
484     Unorm8x4 = 0x00000006,
485     Snorm8x2 = 0x00000007,
486     Snorm8x4 = 0x00000008,
487     Uint16x2 = 0x00000009,
488     Uint16x4 = 0x0000000A,
489     Sint16x2 = 0x0000000B,
490     Sint16x4 = 0x0000000C,
491     Unorm16x2 = 0x0000000D,
492     Unorm16x4 = 0x0000000E,
493     Snorm16x2 = 0x0000000F,
494     Snorm16x4 = 0x00000010,
495     Float16x2 = 0x00000011,
496     Float16x4 = 0x00000012,
497     Float32 = 0x00000013,
498     Float32x2 = 0x00000014,
499     Float32x3 = 0x00000015,
500     Float32x4 = 0x00000016,
501     Uint32 = 0x00000017,
502     Uint32x2 = 0x00000018,
503     Uint32x3 = 0x00000019,
504     Uint32x4 = 0x0000001A,
505     Sint32 = 0x0000001B,
506     Sint32x2 = 0x0000001C,
507     Sint32x3 = 0x0000001D,
508     Sint32x4 = 0x0000001E,
509     Force32 = 0x7FFFFFFF
510 }
511 
512 enum WGPUVertexStepMode
513 {
514     Vertex = 0x00000000,
515     Instance = 0x00000001,
516     Force32 = 0x7FFFFFFF
517 }
518 
519 enum WGPUBufferUsage
520 {
521     None = 0x00000000,
522     MapRead = 0x00000001,
523     MapWrite = 0x00000002,
524     CopySrc = 0x00000004,
525     CopyDst = 0x00000008,
526     Index = 0x00000010,
527     Vertex = 0x00000020,
528     Uniform = 0x00000040,
529     Storage = 0x00000080,
530     Indirect = 0x00000100,
531     QueryResolve = 0x00000200,
532     Force32 = 0x7FFFFFFF
533 }
534 
535 alias WGPUBufferUsageFlags = WGPUFlags;
536 
537 enum WGPUColorWriteMask
538 {
539     None = 0x00000000,
540     Red = 0x00000001,
541     Green = 0x00000002,
542     Blue = 0x00000004,
543     Alpha = 0x00000008,
544     All = 0x0000000F,
545     Force32 = 0x7FFFFFFF
546 }
547 
548 alias WGPUColorWriteMaskFlags = WGPUFlags;
549 
550 enum WGPUMapMode
551 {
552     None = 0x00000000,
553     Read = 0x00000001,
554     Write = 0x00000002,
555     Force32 = 0x7FFFFFFF
556 }
557 
558 alias WGPUMapModeFlags = WGPUFlags;
559 
560 enum WGPUShaderStage
561 {
562     None = 0x00000000,
563     Vertex = 0x00000001,
564     Fragment = 0x00000002,
565     Compute = 0x00000004,
566     Force32 = 0x7FFFFFFF
567 }
568 
569 alias WGPUShaderStageFlags = WGPUFlags;
570 
571 enum WGPUTextureUsage
572 {
573     None = 0x00000000,
574     CopySrc = 0x00000001,
575     CopyDst = 0x00000002,
576     TextureBinding = 0x00000004,
577     StorageBinding = 0x00000008,
578     RenderAttachment = 0x00000010,
579     Force32 = 0x7FFFFFFF
580 }
581 
582 alias WGPUTextureUsageFlags = WGPUFlags;
583 
584 struct WGPUChainedStruct
585 {
586     const(WGPUChainedStruct)* next;
587     WGPUSType sType;
588 }
589 
590 struct WGPUChainedStructOut
591 {
592     WGPUChainedStructOut* next;
593     WGPUSType sType;
594 }
595 
596 struct WGPUAdapterProperties
597 {
598     WGPUChainedStructOut* nextInChain;
599     uint vendorID;
600     uint deviceID;
601     const(char)* name;
602     const(char)* driverDescription;
603     WGPUAdapterType adapterType;
604     WGPUBackendType backendType;
605 }
606 
607 struct WGPUBindGroupEntry
608 {
609     const(WGPUChainedStruct)* nextInChain;
610     uint binding;
611     WGPUBuffer buffer;
612     ulong offset;
613     ulong size;
614     WGPUSampler sampler;
615     WGPUTextureView textureView;
616 }
617 
618 struct WGPUBlendComponent
619 {
620     WGPUBlendOperation operation;
621     WGPUBlendFactor srcFactor;
622     WGPUBlendFactor dstFactor;
623 }
624 
625 struct WGPUBufferBindingLayout
626 {
627     const(WGPUChainedStruct)* nextInChain;
628     WGPUBufferBindingType type;
629     bool hasDynamicOffset;
630     ulong minBindingSize;
631 }
632 
633 struct WGPUBufferDescriptor
634 {
635     const(WGPUChainedStruct)* nextInChain;
636     const(char)* label;
637     WGPUBufferUsageFlags usage;
638     ulong size;
639     bool mappedAtCreation;
640 }
641 
642 struct WGPUColor
643 {
644     double r;
645     double g;
646     double b;
647     double a;
648 }
649 
650 struct WGPUCommandBufferDescriptor
651 {
652     const(WGPUChainedStruct)* nextInChain;
653     const(char)* label;
654 }
655 
656 struct WGPUCommandEncoderDescriptor
657 {
658     const(WGPUChainedStruct)* nextInChain;
659     const(char)* label;
660 }
661 
662 struct WGPUCompilationMessage
663 {
664     const(WGPUChainedStruct)* nextInChain;
665     const(char)* message;
666     WGPUCompilationMessageType type;
667     ulong lineNum;
668     ulong linePos;
669     ulong offset;
670     ulong length;
671 }
672 
673 struct WGPUComputePassDescriptor
674 {
675     const(WGPUChainedStruct)* nextInChain;
676     const(char)* label;
677 }
678 
679 struct WGPUConstantEntry
680 {
681     const(WGPUChainedStruct)* nextInChain;
682     const(char)* key;
683     double value;
684 }
685 
686 struct WGPUExtent3D
687 {
688     uint width;
689     uint height;
690     uint depthOrArrayLayers;
691 }
692 
693 struct WGPUInstanceDescriptor
694 {
695     const(WGPUChainedStruct)* nextInChain;
696 }
697 
698 struct WGPULimits
699 {
700     uint maxTextureDimension1D;
701     uint maxTextureDimension2D;
702     uint maxTextureDimension3D;
703     uint maxTextureArrayLayers;
704     uint maxBindGroups;
705     uint maxDynamicUniformBuffersPerPipelineLayout;
706     uint maxDynamicStorageBuffersPerPipelineLayout;
707     uint maxSampledTexturesPerShaderStage;
708     uint maxSamplersPerShaderStage;
709     uint maxStorageBuffersPerShaderStage;
710     uint maxStorageTexturesPerShaderStage;
711     uint maxUniformBuffersPerShaderStage;
712     ulong maxUniformBufferBindingSize;
713     ulong maxStorageBufferBindingSize;
714     uint minUniformBufferOffsetAlignment;
715     uint minStorageBufferOffsetAlignment;
716     uint maxVertexBuffers;
717     uint maxVertexAttributes;
718     uint maxVertexBufferArrayStride;
719     uint maxInterStageShaderComponents;
720     uint maxComputeWorkgroupStorageSize;
721     uint maxComputeInvocationsPerWorkgroup;
722     uint maxComputeWorkgroupSizeX;
723     uint maxComputeWorkgroupSizeY;
724     uint maxComputeWorkgroupSizeZ;
725     uint maxComputeWorkgroupsPerDimension;
726 }
727 
728 struct WGPUMultisampleState
729 {
730     const(WGPUChainedStruct)* nextInChain;
731     uint count;
732     uint mask;
733     bool alphaToCoverageEnabled;
734 }
735 
736 struct WGPUOrigin3D
737 {
738     uint x;
739     uint y;
740     uint z;
741 }
742 
743 struct WGPUPipelineLayoutDescriptor
744 {
745     const(WGPUChainedStruct)* nextInChain;
746     const(char)* label;
747     uint bindGroupLayoutCount;
748     const(WGPUBindGroupLayout)* bindGroupLayouts;
749 }
750 
751 struct WGPUPrimitiveDepthClampingState
752 {
753     WGPUChainedStruct chain;
754     bool clampDepth;
755 }
756 
757 struct WGPUPrimitiveState
758 {
759     const(WGPUChainedStruct)* nextInChain;
760     WGPUPrimitiveTopology topology;
761     WGPUIndexFormat stripIndexFormat;
762     WGPUFrontFace frontFace;
763     WGPUCullMode cullMode;
764 }
765 
766 struct WGPUQuerySetDescriptor
767 {
768     const(WGPUChainedStruct)* nextInChain;
769     const(char)* label;
770     WGPUQueryType type;
771     uint count;
772     const(WGPUPipelineStatisticName)* pipelineStatistics;
773     uint pipelineStatisticsCount;
774 }
775 
776 struct WGPURenderBundleDescriptor
777 {
778     const(WGPUChainedStruct)* nextInChain;
779     const(char)* label;
780 }
781 
782 struct WGPURenderBundleEncoderDescriptor
783 {
784     const(WGPUChainedStruct)* nextInChain;
785     const(char)* label;
786     uint colorFormatsCount;
787     const(WGPUTextureFormat)* colorFormats;
788     WGPUTextureFormat depthStencilFormat;
789     uint sampleCount;
790 }
791 
792 struct WGPURenderPassDepthStencilAttachment
793 {
794     WGPUTextureView view;
795     WGPULoadOp depthLoadOp;
796     WGPUStoreOp depthStoreOp;
797     float clearDepth;
798     bool depthReadOnly;
799     WGPULoadOp stencilLoadOp;
800     WGPUStoreOp stencilStoreOp;
801     uint clearStencil;
802     bool stencilReadOnly;
803 }
804 
805 struct WGPURequestAdapterOptions
806 {
807     const(WGPUChainedStruct)* nextInChain;
808     WGPUSurface compatibleSurface;
809     WGPUPowerPreference powerPreference;
810     bool forceFallbackAdapter;
811 }
812 
813 struct WGPUSamplerBindingLayout
814 {
815     const(WGPUChainedStruct)* nextInChain;
816     WGPUSamplerBindingType type;
817 }
818 
819 struct WGPUSamplerDescriptor
820 {
821     const(WGPUChainedStruct)* nextInChain;
822     const(char)* label;
823     WGPUAddressMode addressModeU;
824     WGPUAddressMode addressModeV;
825     WGPUAddressMode addressModeW;
826     WGPUFilterMode magFilter;
827     WGPUFilterMode minFilter;
828     WGPUFilterMode mipmapFilter;
829     float lodMinClamp;
830     float lodMaxClamp;
831     WGPUCompareFunction compare;
832     ushort maxAnisotropy;
833 }
834 
835 struct WGPUShaderModuleDescriptor
836 {
837     const(WGPUChainedStruct)* nextInChain;
838     const(char)* label;
839 }
840 
841 struct WGPUShaderModuleSPIRVDescriptor
842 {
843     WGPUChainedStruct chain;
844     uint codeSize;
845     const(uint)* code;
846 }
847 
848 struct WGPUShaderModuleWGSLDescriptor
849 {
850     WGPUChainedStruct chain;
851     const(char)* source;
852 }
853 
854 struct WGPUStencilFaceState
855 {
856     WGPUCompareFunction compare;
857     WGPUStencilOperation failOp;
858     WGPUStencilOperation depthFailOp;
859     WGPUStencilOperation passOp;
860 }
861 
862 struct WGPUStorageTextureBindingLayout
863 {
864     const(WGPUChainedStruct)* nextInChain;
865     WGPUStorageTextureAccess access;
866     WGPUTextureFormat format;
867     WGPUTextureViewDimension viewDimension;
868 }
869 
870 struct WGPUSurfaceDescriptor
871 {
872     const(WGPUChainedStruct)* nextInChain;
873     const(char)* label;
874 }
875 
876 struct WGPUSurfaceDescriptorFromCanvasHTMLSelector
877 {
878     WGPUChainedStruct chain;
879     const(char)* selector;
880 }
881 
882 struct WGPUSurfaceDescriptorFromMetalLayer
883 {
884     WGPUChainedStruct chain;
885     void* layer;
886 }
887 
888 struct WGPUSurfaceDescriptorFromWindowsHWND
889 {
890     WGPUChainedStruct chain;
891     void* hinstance;
892     void* hwnd;
893 }
894 
895 struct WGPUSurfaceDescriptorFromXlib
896 {
897     WGPUChainedStruct chain;
898     void* display;
899     uint window;
900 }
901 
902 struct WGPUSwapChainDescriptor
903 {
904     const(WGPUChainedStruct)* nextInChain;
905     const(char)* label;
906     WGPUTextureUsageFlags usage;
907     WGPUTextureFormat format;
908     uint width;
909     uint height;
910     WGPUPresentMode presentMode;
911 }
912 
913 struct WGPUTextureBindingLayout
914 {
915     const(WGPUChainedStruct)* nextInChain;
916     WGPUTextureSampleType sampleType;
917     WGPUTextureViewDimension viewDimension;
918     bool multisampled;
919 }
920 
921 struct WGPUTextureDataLayout
922 {
923     const(WGPUChainedStruct)* nextInChain;
924     ulong offset;
925     uint bytesPerRow;
926     uint rowsPerImage;
927 }
928 
929 struct WGPUTextureViewDescriptor
930 {
931     const(WGPUChainedStruct)* nextInChain;
932     const(char)* label;
933     WGPUTextureFormat format;
934     WGPUTextureViewDimension dimension;
935     uint baseMipLevel;
936     uint mipLevelCount;
937     uint baseArrayLayer;
938     uint arrayLayerCount;
939     WGPUTextureAspect aspect;
940 }
941 
942 struct WGPUVertexAttribute
943 {
944     WGPUVertexFormat format;
945     ulong offset;
946     uint shaderLocation;
947 }
948 
949 struct WGPUBindGroupDescriptor
950 {
951     const(WGPUChainedStruct)* nextInChain;
952     const(char)* label;
953     WGPUBindGroupLayout layout;
954     uint entryCount;
955     const(WGPUBindGroupEntry)* entries;
956 }
957 
958 struct WGPUBindGroupLayoutEntry
959 {
960     const(WGPUChainedStruct)* nextInChain;
961     uint binding;
962     WGPUShaderStageFlags visibility;
963     WGPUBufferBindingLayout buffer;
964     WGPUSamplerBindingLayout sampler;
965     WGPUTextureBindingLayout texture;
966     WGPUStorageTextureBindingLayout storageTexture;
967 }
968 
969 struct WGPUBlendState
970 {
971     WGPUBlendComponent color;
972     WGPUBlendComponent alpha;
973 }
974 
975 struct WGPUCompilationInfo
976 {
977     const(WGPUChainedStruct)* nextInChain;
978     uint messageCount;
979     const(WGPUCompilationMessage)* messages;
980 }
981 
982 struct WGPUDepthStencilState
983 {
984     const(WGPUChainedStruct)* nextInChain;
985     WGPUTextureFormat format;
986     bool depthWriteEnabled;
987     WGPUCompareFunction depthCompare;
988     WGPUStencilFaceState stencilFront;
989     WGPUStencilFaceState stencilBack;
990     uint stencilReadMask;
991     uint stencilWriteMask;
992     int depthBias;
993     float depthBiasSlopeScale;
994     float depthBiasClamp;
995 }
996 
997 struct WGPUImageCopyBuffer
998 {
999     const(WGPUChainedStruct)* nextInChain;
1000     WGPUTextureDataLayout layout;
1001     WGPUBuffer buffer;
1002 }
1003 
1004 struct WGPUImageCopyTexture
1005 {
1006     const(WGPUChainedStruct)* nextInChain;
1007     WGPUTexture texture;
1008     uint mipLevel;
1009     WGPUOrigin3D origin;
1010     WGPUTextureAspect aspect;
1011 }
1012 
1013 struct WGPUProgrammableStageDescriptor
1014 {
1015     const(WGPUChainedStruct)* nextInChain;
1016     WGPUShaderModule modul;
1017     const(char)* entryPoint;
1018     uint constantCount;
1019     const(WGPUConstantEntry)* constants;
1020 }
1021 
1022 struct WGPURenderPassColorAttachment
1023 {
1024     WGPUTextureView view;
1025     WGPUTextureView resolveTarget;
1026     WGPULoadOp loadOp;
1027     WGPUStoreOp storeOp;
1028     WGPUColor clearColor;
1029 }
1030 
1031 struct WGPURequiredLimits
1032 {
1033     const(WGPUChainedStruct)* nextInChain;
1034     WGPULimits limits;
1035 }
1036 
1037 struct WGPUSupportedLimits
1038 {
1039     WGPUChainedStructOut* nextInChain;
1040     WGPULimits limits;
1041 }
1042 
1043 struct WGPUTextureDescriptor
1044 {
1045     const(WGPUChainedStruct)* nextInChain;
1046     const(char)* label;
1047     WGPUTextureUsageFlags usage;
1048     WGPUTextureDimension dimension;
1049     WGPUExtent3D size;
1050     WGPUTextureFormat format;
1051     uint mipLevelCount;
1052     uint sampleCount;
1053 }
1054 
1055 struct WGPUVertexBufferLayout
1056 {
1057     ulong arrayStride;
1058     WGPUVertexStepMode stepMode;
1059     uint attributeCount;
1060     const(WGPUVertexAttribute)* attributes;
1061 }
1062 
1063 struct WGPUBindGroupLayoutDescriptor
1064 {
1065     const(WGPUChainedStruct)* nextInChain;
1066     const(char)* label;
1067     uint entryCount;
1068     const(WGPUBindGroupLayoutEntry)* entries;
1069 }
1070 
1071 struct WGPUColorTargetState
1072 {
1073     const(WGPUChainedStruct)* nextInChain;
1074     WGPUTextureFormat format;
1075     const(WGPUBlendState)* blend;
1076     WGPUColorWriteMaskFlags writeMask;
1077 }
1078 
1079 struct WGPUComputePipelineDescriptor
1080 {
1081     const(WGPUChainedStruct)* nextInChain;
1082     const(char)* label;
1083     WGPUPipelineLayout layout;
1084     WGPUProgrammableStageDescriptor compute;
1085 }
1086 
1087 struct WGPUDeviceDescriptor
1088 {
1089     const(WGPUChainedStruct)* nextInChain;
1090     uint requiredFeaturesCount;
1091     const(WGPUFeatureName)* requiredFeatures;
1092     const(WGPURequiredLimits)* requiredLimits;
1093 }
1094 
1095 struct WGPURenderPassDescriptor
1096 {
1097     const(WGPUChainedStruct)* nextInChain;
1098     const(char)* label;
1099     uint colorAttachmentCount;
1100     const(WGPURenderPassColorAttachment)* colorAttachments;
1101     const(WGPURenderPassDepthStencilAttachment)* depthStencilAttachment;
1102     WGPUQuerySet occlusionQuerySet;
1103 }
1104 
1105 struct WGPUVertexState
1106 {
1107     const(WGPUChainedStruct)* nextInChain;
1108     WGPUShaderModule modul;
1109     const(char)* entryPoint;
1110     uint constantCount;
1111     const(WGPUConstantEntry)* constants;
1112     uint bufferCount;
1113     const(WGPUVertexBufferLayout)* buffers;
1114 }
1115 
1116 struct WGPUFragmentState
1117 {
1118     const(WGPUChainedStruct)* nextInChain;
1119     WGPUShaderModule modul;
1120     const(char)* entryPoint;
1121     uint constantCount;
1122     const(WGPUConstantEntry)* constants;
1123     uint targetCount;
1124     const(WGPUColorTargetState)* targets;
1125 }
1126 
1127 struct WGPURenderPipelineDescriptor
1128 {
1129     const(WGPUChainedStruct)* nextInChain;
1130     const(char)* label;
1131     WGPUPipelineLayout layout;
1132     WGPUVertexState vertex;
1133     WGPUPrimitiveState primitive;
1134     const(WGPUDepthStencilState)* depthStencil;
1135     WGPUMultisampleState multisample;
1136     const(WGPUFragmentState)* fragment;
1137 }
1138 
1139 alias WGPUBufferMapCallback = extern(C) void function(WGPUBufferMapAsyncStatus status, void* userdata);
1140 alias WGPUCreateComputePipelineAsyncCallback = extern(C) void function(WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline pipeline, const(char)* message, void* userdata);
1141 alias WGPUCreateRenderPipelineAsyncCallback = extern(C) void function(WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline pipeline, const(char)* message, void* userdata);
1142 alias WGPUDeviceLostCallback = extern(C) void function(WGPUDeviceLostReason reason, const(char)* message, void* userdata);
1143 alias WGPUErrorCallback = extern(C) void function(WGPUErrorType type, const(char)* message, void* userdata);
1144 alias WGPUQueueWorkDoneCallback = extern(C) void function(WGPUQueueWorkDoneStatus status, void* userdata);
1145 alias WGPURequestAdapterCallback = extern(C) void function(WGPURequestAdapterStatus status, WGPUAdapter adapter, const(char)* message, void* userdata);
1146 alias WGPURequestDeviceCallback = extern(C) void function(WGPURequestDeviceStatus status, WGPUDevice device, const(char)* message, void* userdata);
1147 alias WGPUProc = extern(C) void function();
1148 
1149 enum WGPUNativeSType
1150 {
1151     // Start at 6 to prevent collisions with webgpu STypes
1152     DeviceExtras = 0x60000001,
1153     AdapterExtras = 0x60000002,
1154     Force32 = 0x7FFFFFFF
1155 }
1156 
1157 enum WGPUNativeFeature
1158 {
1159     TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES = 0x10000000
1160 }
1161 
1162 enum WGPULogLevel
1163 {
1164     Off = 0x00000000,
1165     Error = 0x00000001,
1166     Warn = 0x00000002,
1167     Info = 0x00000003,
1168     Debug = 0x00000004,
1169     Trace = 0x00000005,
1170     Force32 = 0x7FFFFFFF
1171 }
1172 
1173 struct WGPUAdapterExtras
1174 {
1175     WGPUChainedStruct chain;
1176     WGPUBackendType backend;
1177 }
1178 
1179 struct WGPUDeviceExtras
1180 {
1181     WGPUChainedStruct chain;
1182     WGPUNativeFeature nativeFeatures;
1183     const(char)* label;
1184     const(char)* tracePath;
1185 }
1186 
1187 alias WGPULogCallback = extern(C) void function(WGPULogLevel level, const(char)* msg);