1 module metal.metal;
2 
3 import objc.meta : selector, ObjcExtend;
4 @ObjectiveC final extern(C++):
5 @nogc nothrow:
6 
7 public import objc.runtime;
8 import metal.library;
9 import metal.vertexdescriptor;
10 import metal.pixelformat;
11 import metal.commandbuffer;
12 import metal.texture;
13 import metal.blitcommandencoder;
14 
15 
16 
17 enum MTLCPUCacheMode : NSUInteger
18 {
19     DefaultCache = 0,
20     WriteCombined = 1
21 }
22 
23 const __gshared NSUInteger MTLResourceCPUCacheModeShift = 0;
24 const __gshared NSUInteger MTLResourceCPUCacheModeMask = 0xf << MTLResourceCPUCacheModeShift;
25 const __gshared NSUInteger MTLResourceStorageModeShift = 4;
26 const __gshared NSUInteger MTLResourceStorageModeMask = 0xf << MTLResourceStorageModeShift;
27 const __gshared NSUInteger MTLResourceHazardTrackingModeShift = 8;
28 const __gshared NSUInteger MTLResourceHazardTrackingModeMask = 0x3 << MTLResourceHazardTrackingModeShift;
29 
30 enum MTLStorageMode : NSUInteger
31 {
32     ///The resource is stored in system memory and is accessible to both the CPU and the GPU.
33     Shared = 0,
34     ///The CPU and GPU may maintain separate copies of the resource, and any changes must be explicitly synchronized.
35     Managed = 1,
36     ///The resource can be accessed only by the GPU.
37     Private = 2,
38     ///The resource’s contents can be accessed only by the GPU and only exist temporarily during a render pass.
39     Memoryless
40 }
41 
42 enum MTLHazardTrackingMode : NSUInteger
43 {
44     ///An option specifying that the default tracking mode should be used.
45     Default = 0,
46     ///An option specifying that the app must prevent hazards when modifying this object's contents.
47     Untracked = 1,
48     ///An option specifying that Metal prevents hazards when modifying this object's contents.
49     Tracked = 2
50 }
51 
52 ///Optional arguments used to set the behavior of a resource.
53 enum MTLResourceOptions : NSUInteger
54 {
55     ///The default CPU cache mode for the resource, which guarantees that read and write operations are executed in the expected order.
56     DefaultCache = MTLCPUCacheMode.DefaultCache  << MTLResourceCPUCacheModeShift,
57     ///A write-combined CPU cache mode that is optimized for resources that the CPU writes into, but never reads.
58     CPUCacheModeWriteCombined = MTLCPUCacheMode.WriteCombined << MTLResourceCPUCacheModeShift,
59     ///The resource is stored in system memory and is accessible to both the CPU and the GPU.
60     StorageModeShared = MTLStorageMode.Shared << MTLResourceStorageModeShift,
61     ///The CPU and GPU may maintain separate copies of the resource, which you need to explicitly synchronize.
62     StorageModeManaged = MTLStorageMode.Managed << MTLResourceStorageModeShift,
63     ///The resource can be accessed only by the GPU.
64     StorageModePrivate = MTLStorageMode.Private << MTLResourceStorageModeShift,
65     ///The resource’s contents can be accessed only by the GPU and only exist temporarily during a render pass.
66     StorageModeMemoryless = MTLStorageMode.Memoryless << MTLResourceStorageModeShift,
67     ///An option specifying that the default tracking mode should be used.
68     HazardTrackingModeDefault = MTLHazardTrackingMode.Default << MTLResourceHazardTrackingModeShift,
69     ///An option specifying that Metal prevents hazards when modifying this object's contents.
70     HazardTrackingModeTracked = MTLHazardTrackingMode.Tracked << MTLResourceHazardTrackingModeShift,
71     ///An option specifying that the app must prevent hazards when modifying this object's contents.
72     HazardTrackingModeUntracked = MTLHazardTrackingMode.Untracked << MTLResourceHazardTrackingModeShift,
73 }
74 
75 ///The coordinates for the front upper-left corner of a region.
76 struct MTLOrigin
77 {
78     NSUInteger x, y, z;
79 }
80 ///Returns a new origin with the specified coordinates.
81 extern(C) MTLOrigin MTLOriginMake(NSUInteger x, NSUInteger y, NSUInteger z);
82 
83 struct MTLRegion
84 {
85     ///The coordinates of the front upper-left corner of the region.
86     MTLOrigin origin;
87     ///The dimensions of the region.
88     MTLSize size;
89 }
90 
91 
92 interface MTLRenderPipelineState
93 {
94 @nogc nothrow:
95     void release() @selector("release"); 
96     MTLDevice device() @selector("device");
97     NSString label() @selector("label");
98 }
99 
100 enum MTLTriangleFillMode : NSUInteger
101 {
102     ///Rasterize triangle and triangle strip primitives as filled triangles.
103     Fill = 0,
104     ///Rasterize triangle and triangle strip primitives as lines.
105     Lines = 1
106 }
107 
108 enum MTLWinding : NSUInteger
109 {
110     ///Primitives whose vertices are specified in clockwise order are front-facing.
111     Clockwise = 0,
112     ///Primitives whose vertices are specified in counter-clockwise order are front-facing.
113     CounterClockwise = 1
114 }
115 
116 struct MTLViewport
117 {
118     double originX = 0;
119     double originY = 0;
120     double width = 0;
121     double height = 0;
122     double znear = 0;
123     double zfar = 0;
124 }
125 
126 enum MTLCullMode : NSUInteger
127 {
128     ///Does not cull any primitives.
129     None = 0,
130     ///Culls front-facing primitives.
131     Front = 1,
132     ///Culls back-facing primitives.
133     Back = 2
134 }
135 
136 class MTLFunction
137 {
138 
139 }
140 
141 struct MTLClearColor
142 {
143     double red, green, blue, alpha;
144 }
145 
146 MTLClearColor MTLClearColorMake(double red = 0.0, double green = 0.0, double blue = 0.0, double alpha = 1.0);
147 
148 ///Options that modify a store action.
149 enum MTLStoreActionOptions : NSUInteger
150 {
151     ///An option that doesn't modify the intended behavior of a store action.
152     None = 0,
153     ///An option that stores data in a sample-position–agnostic representation.
154     CustomSamplePositions = 1 << 0
155 }
156 
157 ///A render target that serves as the output destination for pixels generated by a render pass.
158 class MTLRenderPassAttachmentDescriptor
159 {
160 @nogc nothrow:
161 
162     mixin ObjcExtend!NSObject;
163     
164     ///The texture object associated with this attachment.
165     @selector("texture")
166     MTLTexture texture();
167     @selector("setTexture:")
168     MTLTexture texture(MTLTexture);
169     
170     ///The mipmap level of the texture used for rendering to the attachment.
171     @selector("level")
172     NSUInteger level();
173     @selector("setLevel:")
174     NSUInteger level(NSUInteger);
175 
176     ///The slice of the texture used for rendering to the attachment.
177     @selector("slice")
178     NSUInteger slice();
179     @selector("setSlice:")
180     NSUInteger slice(NSUInteger);
181 
182     ///The action performed by this attachment at the start of a rendering pass for a render command encoder.
183     @selector("loadAction")
184     MTLLoadAction loadAction();
185     @selector("setLoadAction:")
186     MTLLoadAction loadAction(MTLLoadAction);
187 
188 
189     ///The action performed by this attachment at the end of a rendering pass for a render command encoder.
190     @selector("storeAction")
191     MTLStoreAction storeAction();
192     @selector("setStoreAction:")
193     MTLStoreAction storeAction(MTLStoreAction);
194 
195     ///The options that modify the store action performed by this attachment.
196     @selector("storeActionOptions")
197     MTLStoreActionOptions storeActionOptions();
198     @selector("setStoreActionOptions:")
199     MTLStoreActionOptions storeActionOptions(MTLStoreActionOptions);
200 
201     ///The destination texture used when resolving multisampled texture data into single sample values
202     @selector("resolveTexture")
203     MTLTexture resolveTexture();
204     @selector("setResolveTexture:")
205     MTLTexture resolveTexture(MTLTexture);
206     ///The mipmap level of the texture used for the multisample resolve action.
207     @selector("resolveLevel")
208     NSUInteger resolveLevel();
209     @selector("setResolveLevel:")
210     NSUInteger resolveLevel(NSUInteger);
211     ///The slice of the texture used for the multisample resolve action.
212     @selector("resolveSlice")
213     NSUInteger resolveSlice();
214     @selector("setResolveSlice:")
215     NSUInteger resolveSlice(NSUInteger);
216     ///The depth plane of the texture used for the multisample resolve action.
217     @selector("resolveDepthPlane")
218     NSUInteger resolveDepthPlane();
219     @selector("setResolveDepthPlane:")
220     NSUInteger resolveDepthPlane(NSUInteger);
221 
222 }
223 
224 ///Types of actions performed for an attachment at the start of a rendering pass.
225 enum MTLLoadAction: NSUInteger
226 {
227     ///The GPU has permission to discard the existing contents of the attachment at the start of the render pass, replacing them with arbitrary data.
228     DontCare = 0,
229     ///The GPU preserves the existing contents of the attachment at the start of the render pass.
230     Load = 1,
231     ///The GPU writes a value to every pixel in the attachment at the start of the render pass.
232     Clear = 2,
233 }
234 
235 ///Types of actions performed for an attachment at the end of a rendering pass.
236 enum MTLStoreAction: NSUInteger
237 {
238     ///The GPU has permission to discard the rendered contents of the attachment at the end of the render pass, replacing them with arbitrary data.
239     DontCare = 0,
240     ///The GPU stores the rendered contents to the texture.
241     Store = 1,
242     ///The GPU resolves the multisampled data to one sample per pixel and stores the data to the resolve texture, discarding the multisample data afterwards.
243     MultisampleResolve = 2,
244     ///The GPU stores the multisample data to the multisample texture, resolves the data to a sample per pixel, and stores the data to the resolve texture.
245     StoreAndMultisampleResolve = 3,
246     ///The app will specify the store action when it encodes the render pass.
247     Unknown = 4,
248     ///The GPU stores depth data in a sample-position–agnostic representation.
249     CustomSampleDepthStore,
250 }
251 
252 class MTLRenderPassColorAttachmentDescriptor
253 {
254 @nogc nothrow:
255 
256     mixin ObjcExtend!MTLRenderPassAttachmentDescriptor;
257     ///The color to use when clearing the color attachment.
258     @selector("clearColor")
259     MTLClearColor clearColor();
260     @selector("setClearColor:")
261     void clearColor(MTLClearColor);
262 }
263 
264 class MTLRenderPassColorAttachmentDescriptorArray
265 {
266 @nogc nothrow:
267 
268     mixin ObjcExtend!NSObject;
269     @selector("setObject:atIndexedSubscript:")
270     void setObjectAtIndexedSubscript(MTLRenderPassColorAttachmentDescriptor attachment, NSUInteger attachmentIndex);
271 
272     @selector("objectAtIndexedSubscript:")
273     MTLRenderPassColorAttachmentDescriptor objectAtIndexedSubscript(NSUInteger attachmentIndex);
274 
275     final extern(D) MTLRenderPassColorAttachmentDescriptor opIndex(NSUInteger index)
276     {
277         return objectAtIndexedSubscript(index);
278     }
279 
280     final extern(D) void opIndexAssign(MTLRenderPassColorAttachmentDescriptor attachment, NSUInteger index)
281     {
282         setObjectAtIndexedSubscript(attachment, index);
283     }
284 }
285 
286 enum MTLMultisampleDepthResolveFilter : NSUInteger
287 {
288     ///No filter is applied.
289     Sample0 = 0,
290     ///The GPU compares all depth samples in the pixel and selects the sample with the smallest value.
291     Min,
292     ///The GPU compares all depth samples in the pixel and selects the sample with the largest value.
293     Max
294 }
295 
296 ///A depth render target that serves as the output destination for depth pixels generated by a render pass.
297 class MTLRenderPassDepthAttachmentDescriptor
298 {
299 @nogc nothrow:
300 
301     mixin ObjcExtend!MTLRenderPassAttachmentDescriptor;
302     ///The depth to use when clearing the depth attachment.
303     @selector("clearDepth")
304     double clearDepth();
305     @selector("setClearDepth:")
306     double clearDepth(double);
307 
308     ///The filter used for an MSAA depth resolve operation.
309     @selector("depthResolveFilter")
310     MTLMultisampleDepthResolveFilter depthResolveFilter();
311     @selector("setDepthResolveFilter:")
312     MTLMultisampleDepthResolveFilter depthResolveFilter(MTLMultisampleDepthResolveFilter);
313 }
314 
315 enum MTLMultisampleStencilResolveFilter : NSUInteger
316 {
317     Sample0 = 0,
318     DepthResolvedSample = 1
319 }
320 
321 ///A stencil render target that serves as the output destination for stencil pixels generated by a render pass.
322 
323 class MTLRenderPassStencilAttachmentDescriptor
324 {
325 @nogc nothrow:
326 
327     mixin ObjcExtend!MTLRenderPassAttachmentDescriptor;
328     ///The filter used for stencil multisample resolve.
329     @selector("stencilResolveFilter")
330     MTLMultisampleStencilResolveFilter stencilResolveFilter();
331     @selector("setStencilResolveFilter:")
332     MTLMultisampleStencilResolveFilter stencilResolveFilter(MTLMultisampleStencilResolveFilter);
333 
334     ///The value to use when clearing the stencil attachment.
335     @selector("clearStencil")
336     uint clearStencil();
337     @selector("setClearStencil:")
338     uint clearStencil(uint);
339 }
340 
341 struct MTLSize
342 {
343     NSUInteger width;
344     NSUInteger height;
345     NSUInteger depth;
346 }
347 struct MTLSizeAndAlign
348 {
349     NSUInteger size;
350     NSUInteger align_;
351 }
352 
353 struct MTLSamplePosition
354 {
355     float x;
356     float y;
357 }
358 
359 enum MTLPrimitiveType : NSUInteger
360 {
361     ///Rasterize a point at each vertex. The vertex shader must provide [[point_size]], or the point size is undefined.
362     Point = 0,
363     ///Rasterize a line between each separate pair of vertices, resulting in a series of unconnected lines. If there are an odd number of vertices, the last vertex is ignored.
364     Line = 1,
365     ///Rasterize a line between each pair of adjacent vertices, resulting in a series of connected lines (also called a polyline).
366     LineStrip = 2,
367     ///For every separate set of three vertices, rasterize a triangle. If the number of vertices is not a multiple of three, either one or two vertices is ignored.
368     Triangle = 3,
369     ///For every three adjacent vertices, rasterize a triangle.
370     TriangleStrip
371 }
372 
373 enum MTLIndexType : NSUInteger
374 {
375     ///A 16-bit unsigned integer used as a primitive index.
376     UInt16 = 0,
377     ///A 32-bit unsigned integer used as a primitive index.
378     UInt32 = 1
379 }
380 
381 interface MTLCounterSampleBuffer
382 {
383 @nogc nothrow:
384 
385     ///Transforms samples of a GPU’s counter set from the driver’s internal format to a standard Metal data structure.
386     @selector("resolveCounterRange:")
387     NSData resolveCounterRange(NSRange range);
388 }
389 
390 alias MTLCoordinate2D = MTLSamplePosition;
391 
392 MTLSize MTLSizeMake(NSUInteger width, NSUInteger height, NSUInteger depth);
393 MTLCoordinate2D MTLCoordinate2DMake(float x, float y);
394 
395 interface MTLRasterizationRateMap
396 {
397 @nogc nothrow:
398 
399     ///The device object that created the rate map.
400     MTLDevice device() @selector("device");
401     ///A string that identifies the rate map.
402     NSString label() @selector("label");
403     ///The number of layers in the rate map.
404     NSUInteger layerCount() @selector("layerCount");
405     ///The logical size, in pixels, of the viewport coordinate system.
406     MTLSize screenSize() @selector("screenSize");
407 
408     ///Returns the dimensions, in pixels, of the area in the render target affected by the rasterization rate map.
409     @selector("physicalSizeForLayer:")
410     MTLSize physicalSizeForLayer(NSUInteger layerIndex);
411 
412     ///The granularity, in physical pixels, at which the rasterization rate varies.
413     MTLSize physicalGranularity() @selector("physicalGranularity");
414 
415     ///Converts a point in logical viewport coordinates to the corresponding physical coordinates in a render layer.
416     @selector("mapScreenToPhysicalCoordinates:forLayer:")
417     MTLCoordinate2D mapScreenToPhysicalCoordinates(MTLCoordinate2D screenCoordinates, NSUInteger layerIndex);
418 
419     ///Converts a point in physical coordinates inside a layer to its corresponding logical viewport coordinates.
420     @selector("mapPhysicalToScreenCoordinates:forLayer:")
421     MTLCoordinate2D mapPhysicalToScreenCoordinates(MTLCoordinate2D physicalCoordinates, NSUInteger layerIndex);
422 
423     ///The size and alignment requirements to contain the coordinate transformation information in this rate map.
424     @selector("parameterBufferSizeAndAlign")
425     MTLSizeAndAlign parameterBufferSizeAndAlign();
426     
427     ///Copies the parameter data into the provided buffer.
428     @selector("copyParameterDataToBuffer:offset:")
429     void copyParameterDataToBuffer(MTLBuffer buffer, NSUInteger offset);
430 
431 
432 }
433 
434 
435 
436 ///A description of where to store GPU counter information at the start and end of a render pass.
437 class MTLRenderPassSampleBufferAttachmentDescriptor
438 {
439 @nogc nothrow:
440 
441     mixin ObjcExtend!NSObject;
442     ///The sample buffer to write new GPU counter samples to.
443     @selector("sampleBuffer")
444     MTLCounterSampleBuffer sampleBuffer();
445     @selector("setSampleBuffer:")
446     MTLCounterSampleBuffer sampleBuffer(MTLCounterSampleBuffer sampleBuffer);
447 
448     ///The index the Metal device object should use to store GPU counters when starting the render pass’s vertex stage.
449     @selector("startOfVertexSampleIndex")
450     NSUInteger startOfVertexSampleIndex();
451     @selector("setStartOfVertexSampleIndex:")
452     NSUInteger startOfVertexSampleIndex(NSUInteger);
453 
454     ///The index the Metal device object should use to store GPU counters when ending the render pass’s vertex stage.
455     @selector("endOfVertexSampleIndex")
456     NSUInteger endOfVertexSampleIndex();
457     @selector("setEndOfVertexSampleIndex:")
458     NSUInteger endOfVertexSampleIndex(NSUInteger);
459 
460     ///The index the Metal device object should use to store GPU counters when starting the render pass’s fragment stage.
461     @selector("startOfFragmentSampleIndex")
462     NSUInteger startOfFragmentSampleIndex();
463     @selector("setStartOfFragmentSampleIndex:")
464     NSUInteger startOfFragmentSampleIndex(NSUInteger);
465 
466     ///The index the Metal device object should use to store GPU counters when ending the render pass’s fragment stage.
467     @selector("endOfFragmentSampleIndex")
468     NSUInteger endOfFragmentSampleIndex();
469     @selector("setEndOfFragmentSampleIndex:")
470     NSUInteger endOfFragmentSampleIndex(NSUInteger);
471 
472     
473 }
474 
475 class MTLRenderPassSampleBufferAttachmentDescriptorArray
476 {
477 @nogc nothrow:
478 
479     mixin ObjcExtend!NSObject;
480     ///Returns the descriptor object for the specified sample buffer attachment.
481     @selector("objectAtIndexedSubscript:")
482     MTLRenderPassSampleBufferAttachmentDescriptor objectAtIndexedSubscript(NSUInteger attachmentIndex);
483 
484     ///Sets the descriptor object for the specified sample buffer attachment.
485     @selector("setObject:atIndexedSubscript:")
486     void setObjectAtIndexedSubscript(MTLRenderPassSampleBufferAttachmentDescriptor attachment, NSUInteger attachmentIndex);
487 }
488 
489 ///A depth and stencil state object that specifies the depth and stencil configuration and operations used in a render pass.
490 interface MTLDepthStencilState
491 {
492 @nogc nothrow:
493 
494     ///The device from which this state object was created.
495     @selector("device")
496     MTLDevice device();
497 
498     ///A string that identifies this object.
499     @selector("label")
500     NSString label();
501 }
502 
503 ///An object that configures new MTLDepthStencilState objects.
504 class MTLDepthStencilDescriptor
505 {
506 @nogc nothrow:
507 
508     mixin ObjcExtend!NSObject;
509     @selector("alloc")
510     static MTLDepthStencilDescriptor alloc();
511 
512     @selector("init")
513     MTLDepthStencilDescriptor initialize(); 
514     alias ini = initialize;
515 
516     ///The comparison that is performed between a fragment’s depth value and the depth value in the attachment, which determines whether to discard the fragment.
517     @selector("depthCompareFunction")
518     MTLCompareFunction depthCompareFunction();
519     @selector("setDepthCompareFunction:")
520     MTLCompareFunction depthCompareFunction(MTLCompareFunction);
521 
522     ///A Boolean value that indicates whether depth values can be written to the depth attachment.
523     @selector("depthWriteEnabled")
524     BOOL depthWriteEnabled();
525     @selector("setDepthWriteEnabled:")
526     BOOL depthWriteEnabled(BOOL);
527     alias isDepthWriteEnabled = depthWriteEnabled;
528 
529     // ///The stencil descriptor for back-facing primitives.
530     // @selector("backFaceStencil")
531     // MTLStencilDescriptor backFaceStencil();
532     // @selector("setBackFaceStencil:")
533     // MTLStencilDescriptor backFaceStencil(MTLStencilDescriptor);
534 
535     // ///The stencil descriptor for front-facing primitives.
536     // @selector("frontFaceStencil")
537     // MTLStencilDescriptor frontFaceStencil();
538     // @selector("setFrontFaceStencil:")
539     // MTLStencilDescriptor frontFaceStencil(MTLStencilDescriptor);
540 
541     ///A string that identifies this object.
542     @selector("label")
543     NSString label();
544     @selector("setLabel:")
545     NSString label(NSString);
546 
547 
548 }
549 
550 
551 
552 ///A group of render targets that hold the results of a render pass.
553 class MTLRenderPassDescriptor
554 {
555 @nogc nothrow:
556 
557     mixin ObjcExtend!NSObject;
558 
559     @selector("new")
560     static MTLRenderPassDescriptor new_();
561     
562     ///Creates a default render pass descriptor.
563     @selector("renderPassDescriptor")
564     static MTLRenderPassDescriptor renderPassDescriptor();
565 
566     ///An array of state information for attachments that store color data.
567     @selector("colorAttachments")
568     MTLRenderPassColorAttachmentDescriptorArray colorAttachments();
569 
570     ///State information for an attachment that stores depth data.
571     @selector("depthAttachment")
572     MTLRenderPassDepthAttachmentDescriptor depthAttachment();
573     @selector("setDepthAttachment:")
574     MTLRenderPassDepthAttachmentDescriptor depthAttachment(MTLRenderPassDepthAttachmentDescriptor);
575     
576     ///State information for an attachment that stores stencil data.
577     @selector("stencilAttachment")
578     MTLRenderPassStencilAttachmentDescriptor stencilAttachment();
579     @selector("setStencilAttachment:")
580     MTLRenderPassStencilAttachmentDescriptor stencilAttachment(MTLRenderPassStencilAttachmentDescriptor);
581 
582     ///A buffer where the GPU writes visibility test results when fragments pass depth and stencil tests.
583     @selector("visibilityResultBuffer")
584     MTLBuffer visibilityResultBuffer();
585     @selector("setVisibilityResultBuffer:")
586     MTLBuffer visibilityResultBuffer(MTLBuffer);
587 
588     ///The number of active layers that all attachments must have for layered rendering.
589     @selector("renderTargetArrayLength")
590     NSUInteger renderTargetArrayLength();
591     @selector("setRenderTargetArrayLength:")
592     NSUInteger renderTargetArrayLength(NSUInteger);
593 
594     /// The width, in pixels, to constrain the render target to.
595     @selector("renderTargetWidth")
596     NSUInteger renderTargetWidth();
597     @selector("setRenderTargetWidth:")
598     NSUInteger renderTargetWidth(NSUInteger);
599 
600     ///The height, in pixels, to constrain the render target to.
601     @selector("renderTargetHeight")
602     NSUInteger renderTargetHeight();
603     @selector("setRenderTargetHeight:")
604     NSUInteger renderTargetHeight(NSUInteger);
605 
606 
607     ///Sets the programmable sample positions for a render pass.
608     @selector("setSamplePositions:count:")
609     void setSamplePositions(const MTLSamplePosition positions, NSUInteger count);
610 
611     @selector("getSamplePositions:count:")
612     NSUInteger getSamplePositions(MTLSamplePosition positions, NSUInteger count);
613 
614     ///The per-sample size, in bytes, of the largest explicit imageblock layout in the render pass.
615     @selector("imageBlockSampleLength")
616     NSUInteger imageBlockSampleLength();
617     @selector("setImageBlockSampleLength:")
618     NSUInteger imageBlockSampleLength(NSUInteger);
619 
620     ///The per-tile size, in bytes, of the persistent threadgroup memory allocation.
621     @selector("threadgroupMemoryLength")
622     NSUInteger threadgroupMemoryLength();
623     @selector("setThreadgroupMemoryLength:")
624     NSUInteger threadgroupMemoryLength(NSUInteger);
625 
626     ///The tile width, in pixels.
627     @selector("tileWidth")
628     NSUInteger tileWidth();
629     @selector("setTileWidth:")
630     NSUInteger tileWidth(NSUInteger);
631 
632 
633     ///The tile height, in pixels.
634     @selector("tileHeight")
635     NSUInteger tileHeight();
636     @selector("setTileHeight:")
637     NSUInteger tileHeight(NSUInteger);
638 
639     ///The raster sample count for the render pass when the render pass doesn’t have explicit attachments.
640     @selector("defaultRasterSampleCount")
641     NSUInteger defaultRasterSampleCount();
642     @selector("setDefaultRasterSampleCount:")
643     NSUInteger defaultRasterSampleCount(NSUInteger);
644 
645     ///The rasterization rate map to use when executing the render pass.
646     @selector("rasterizationRateMap")
647     MTLRasterizationRateMap rasterizationRateMap();
648     @selector("setRasterizationRateMap:")
649     MTLRasterizationRateMap rasterizationRateMap(MTLRasterizationRateMap);
650 
651     ///The array of sample buffers that the render pass can access.
652     @selector("sampleBufferAttachments")
653     MTLRenderPassSampleBufferAttachmentDescriptorArray sampleBufferAttachments();
654 
655 }
656 
657 
658 
659 enum MTLColorWriteMask : NSUInteger
660 {
661     None = 0,
662     Red = 0x1 << 3,
663     Green = 0x1 << 2,
664     Blue = 0x1 << 1,
665     Alpha = 0x1 << 0,
666     All = 0xf
667 }
668 
669 enum MTLBlendOperation : NSUInteger
670 {
671     ///Add portions of both source and destination pixel values.
672     Add = 0,
673     ///Subtract a portion of the destination pixel values from a portion of the source.
674     Subtract = 1,
675     ///Subtract a portion of the source values from a portion of the destination pixel values.
676     ReverseSubtract = 2,
677     ///Minimum of the source and destination pixel values.
678     Min = 3,
679     ///Maximum of the source and destination pixel values.
680     Max = 4
681 }
682 
683 enum MTLBlendFactor : NSUInteger
684 {
685     Zero = 0,
686     One = 1,
687     ///Blend factor of source values.
688     SourceColor = 2,
689     ///Blend factor of one minus source values.
690     OneMinusSourceColor = 3,
691     ///Blend factor of source alpha.
692     SourceAlpha = 4,
693     ///Blend factor of one minus source alpha.
694     OneMinusSourceAlpha = 5,
695     ///Blend factor of destination values.
696     DestinationColor = 6,
697     ///Blend factor of one minus destination values.
698     OneMinusDestinationColor = 7,
699     ///Blend factor of one minus destination values.
700     DestinationAlpha = 8,
701     ///Blend factor of one minus destination alpha.
702     OneMinusDestinationAlpha = 9,
703     ///Blend factor of the minimum of either source alpha or one minus destination alpha.
704     SourceAlphaSaturated = 10,
705     ///Blend factor of RGB values.
706     BlendColor = 11,
707     ///Blend factor of one minus RGB values.
708     OneMinusBlendColor = 12,
709     ///Blend factor of alpha value.
710     BlendAlpha = 13,
711     ///Blend factor of one minus alpha value.
712     OneMinusBlendAlpha = 14,
713     ///Blend factor of source values. This option supports dual-source blending and reads from the second color output of the fragment function.
714     Source1Color = 15,
715     ///Blend factor of one minus source values. This option supports dual-source blending and reads from the second color output of the fragment function.
716     OneMinusSource1Color = 16,
717     ///Blend factor of source alpha. This option supports dual-source blending and reads from the second color output of the fragment function.
718     Source1Alpha = 17,
719     ///Blend factor of one minus source alpha. This option supports dual-source blending and reads from the second color output of the fragment function.
720     OneMinusSource1Alpha = 18
721 
722 }
723 
724 class MTLRenderPipelineColorAttachmentDescriptor
725 {
726 @nogc nothrow:
727 
728     mixin ObjcExtend!NSObject;
729 
730     ///The pixel format of the color attachment’s texture.
731     @selector("pixelFormat")
732     MTLPixelFormat pixelFormat();
733     @selector("setPixelFormat:")
734     MTLPixelFormat pixelFormat(MTLPixelFormat);
735 
736     ///A bitmask that restricts which color channels are written into the texture.
737     @selector("writeMask")
738     MTLColorWriteMask writeMask();
739     @selector("setWriteMask:")
740     MTLColorWriteMask writeMask(MTLColorWriteMask);
741 
742     ///A Boolean value that determines whether blending is enabled.
743     @selector("blendingEnabled")
744     BOOL isBlendingEnabled();
745     @selector("setBlendingEnabled:")
746     BOOL blendingEnabled(BOOL);
747 
748     ///The blend operation assigned for the alpha data.
749     @selector("alphaBlendOperation")
750     MTLBlendOperation alphaBlendOperation();
751     @selector("setAlphaBlendOperation:")
752     MTLBlendOperation alphaBlendOperation(MTLBlendOperation);
753 
754     ///The blend operation assigned for the RGB data.
755     @selector("rgbBlendOperation")
756     MTLBlendOperation rgbBlendOperation();
757     @selector("setRgbBlendOperation:")
758     MTLBlendOperation rgbBlendOperation(MTLBlendOperation);
759 
760     ///The destination blend factor (DBF) used by the alpha blend operation.
761     @selector("destinationAlphaBlendFactor")
762     MTLBlendFactor destinationAlphaBlendFactor();
763     @selector("setDestinationAlphaBlendFactor:")
764     MTLBlendFactor destinationAlphaBlendFactor(MTLBlendFactor);
765 
766     ///The destination blend factor (DBF) used by the RGB blend operation.
767     @selector("destinationRGBBlendFactor")
768     MTLBlendFactor destinationRGBBlendFactor();
769     @selector("setDestinationRGBBlendFactor:")
770     MTLBlendFactor destinationRGBBlendFactor(MTLBlendFactor);
771 
772     ///The source blend factor (SBF) used by the alpha blend operation.
773     @selector("sourceAlphaBlendFactor")
774     MTLBlendFactor sourceAlphaBlendFactor();
775     @selector("setSourceAlphaBlendFactor:")
776     MTLBlendFactor sourceAlphaBlendFactor(MTLBlendFactor);
777 
778     ///The source blend factor (SBF) used by the RGB blend operation.
779     @selector("sourceRGBBlendFactor")
780     MTLBlendFactor sourceRGBBlendFactor();
781     @selector("setSourceRGBBlendFactor:")
782     MTLBlendFactor sourceRGBBlendFactor(MTLBlendFactor);
783 
784 
785 
786 
787 }
788 
789 class MTLRenderPipelineColorAttachmentDescriptorArray
790 {
791 @nogc nothrow:
792 
793     mixin ObjcExtend!NSObject;
794 
795     static MTLRenderPipelineColorAttachmentDescriptorArray alloc() @selector("alloc");
796     // alias ini = initialize;
797 
798     @selector("setObject:atIndexedSubscript:")
799     void setObjectAtIndexedSubscript(MTLRenderPipelineColorAttachmentDescriptor attachment, NSUInteger attachmentIndex);
800 
801     @selector("objectAtIndexedSubscript:")
802     MTLRenderPipelineColorAttachmentDescriptor objectAtIndexedSubscript(NSUInteger attachmentIndex);
803 
804     extern(D) final MTLRenderPipelineColorAttachmentDescriptor opIndex(NSUInteger index)
805     {
806         return objectAtIndexedSubscript(index);
807     }
808     extern(D) final void opIndexAssign(NSUInteger index, MTLRenderPipelineColorAttachmentDescriptor v)
809     {
810         setObjectAtIndexedSubscript(v, index);
811     }
812 }
813 
814 class MTLRenderPipelineDescriptor
815 {
816 @nogc nothrow:
817 
818     mixin ObjcExtend!NSObject;
819     alias ini = initialize;
820 
821     ///A string that identifies the render pipeline descriptor.
822     NSString label() @selector("label");
823     NSString label(NSString) @selector("setLabel:");
824 
825     ///The vertex function the pipeline calls to process vertices.
826     MTLFunction vertexFunction() @selector("vertexFunction");
827     MTLFunction vertexFunction(MTLFunction) @selector("setVertexFunction:");
828 
829     ///The fragment function the pipeline calls to process fragments.
830     MTLFunction fragmentFunction() @selector("fragmentFunction");
831     MTLFunction fragmentFunction(MTLFunction) @selector("setFragmentFunction:");
832 
833     ///The organization of vertex data in an attribute’s argument table.
834     MTLVertexDescriptor vertexDescriptor() @selector("vertexDescriptor");
835     MTLVertexDescriptor vertexDescriptor(MTLVertexDescriptor) @selector("setVertexDescriptor:");
836 
837 
838     ///An array of attachments that store color data.
839     MTLRenderPipelineColorAttachmentDescriptorArray colorAttachments() @selector("colorAttachments");
840 
841     ///The pixel format of the attachment that stores depth data.
842     MTLPixelFormat depthAttachmentPixelFormat() @selector("depthAttachmentPixelFormat");
843     MTLPixelFormat depthAttachmentPixelFormat(MTLPixelFormat) @selector("setDepthAttachmentPixelFormat:");
844 
845     ///The pixel format of the attachment that stores stencil data.
846     MTLPixelFormat stencilAttachmentPixelFormat() @selector("stencilAttachmentPixelFormat");
847     MTLPixelFormat stencilAttachmentPixelFormat(MTLPixelFormat) @selector("setStencilAttachmentPixelFormat:");
848 
849     
850 }
851 interface MTLIOCommandQueue
852 {
853 
854 }
855 
856 class MTLIOCommandQueueDescriptor
857 {
858 @nogc nothrow:
859     mixin ObjcExtend!NSObject;
860 }
861 
862 ///The render stages at which a synchronization command is triggered.
863 enum MTLRenderStages : NSUInteger
864 {
865     ///The vertex rendering stage.
866     Vertex = 1 << 0,
867     ///The fragment rendering stage.
868     Fragment = 1 << 1,
869     ///The tile rendering stage.
870     Tile = 1 << 2,
871     Mesh = 1 << 4,
872     Object = 1 << 3
873 }
874 
875 ///An object that can capture, track, and manage resource dependencies across command encoders.
876 interface MTLFence
877 {
878 @nogc nothrow:
879 
880     mixin ObjcExtend!NSObject;
881 
882     ///The device object that created the fence.
883     @selector("device")
884     MTLDevice device();
885 
886     ///A string that identifies the fence.
887     @selector("label")
888     NSString label();
889 
890     @selector("setLabel:")
891     NSString label(NSString);
892 }
893 
894 enum MTLGPUFamily : NSInteger
895 {
896     ///Represents the Metal 3 features.
897     Metal3 = 5001,
898     ///Represents the Apple family 8 GPU features that correspond to the Apple A15 and M2 GPUs.
899     Apple8 = 1008,
900     ///Represents the Apple family 7 GPU features that correspond to the Apple A14 and M1 GPUs.
901     Apple7 = 1007,
902     ///Represents the Apple family 6 GPU features that correspond to the Apple A13 GPUs.
903     Apple6 = 1006,
904     ///Represents the Apple family 5 GPU features that correspond to the Apple A12 GPUs.
905     Apple5 = 1005,
906     ///Represents the Apple family 4 GPU features that correspond to the Apple A11 GPUs.
907     Apple4 = 1004,
908     ///Represents the Apple family 3 GPU features that correspond to the Apple A9 and A10 GPUs.
909     Apple3 = 1003,
910     ///Represents the Apple family 2 GPU features that correspond to the Apple A8 GPUs.
911     Apple2 = 1002,
912     ///Represents the Apple family 1 GPU features that correspond to the Apple A7 GPUs.
913     Apple1 = 1001,
914     ///Represents the Common family 3 GPU features.
915     Common3 = 3003,
916     ///Represents the Common family 2 GPU features.
917     Common2 = 3002,
918     ///Represents the Common family 1 GPU features.
919     Common1 = 3001,
920     ///Represents the Mac family 2 GPU features.
921     Mac2 = 2002,
922     ///Represents the Mac family 1 GPU features. deprecated
923     Mac1 = 2001
924 }
925 
926 ///The values that determine the limits and capabilities of argument buffers.
927 enum MTLArgumentBuffersTier : NSUInteger
928 {
929     ///Tier 1 argument buffers are supported on all iOS, tvOS, and macOS GPUs.
930     Tier1 = 0,
931     ///Tier 2 argument buffers are supported on all macOS discrete GPUs.
932     Tier2 = 1
933 }
934 
935 ///The main Metal interface to a GPU that apps use to draw graphics and run computations in parallel.
936 interface MTLDevice
937 {
938 @nogc nothrow:
939 
940     mixin ObjcExtend!NSObject;
941 
942     ///The full name of the GPU device.
943     @selector("name")
944     NSString name();
945 
946     ///Returns a Boolean value that indicates whether the GPU device supports the feature set of a specific GPU family.
947     @selector("supportsFamily:")
948     BOOL supportsFamily(MTLGPUFamily);
949 
950     ///Returns the GPU device’s support tier for argument buffers.
951     @selector("argumentBuffersSupport")
952     MTLArgumentBuffersTier argumentBuffersSupport();
953 
954 
955     ///Creates a queue you use to submit rendering and computation commands to a GPU.
956     @selector("newCommandQueue")
957     MTLCommandQueue newCommandQueue();
958 
959     ///Creates a queue you use to submit rendering and computation commands to a GPU that has a fixed number of uncompleted command buffers.
960     @selector("newCommandQueueWithMaxCommandBufferCount:")
961     MTLCommandQueue newCommandQueue(NSUInteger maxCommandBufferCount);
962 
963     ///Creates a buffer the method clears with zero values, length is size in bytes.
964     @selector("newBufferWithLength:options:")
965     MTLBuffer newBuffer(NSUInteger length, MTLResourceOptions options);
966 
967     ///Allocates a new buffer of a given length and initializes its contents by copying existing data into it.
968     @selector("newBufferWithBytes:length:options:")
969     MTLBuffer newBuffer(const(void)* pointer, NSUInteger length, MTLResourceOptions options);
970 
971     ///Creates a new texture instance.
972     @selector("newTextureWithDescriptor:")
973     MTLTexture newTextureWithDescriptor(MTLTextureDescriptor descriptor);
974 
975 
976     ///Synchronously creates a Metal library instance by compiling the functions in a source string.
977     @selector("newLibraryWithSource:options:error:")
978     MTLLibrary newLibraryWithSource(NSString source, MTLCompileOptions options, NSError* error = null);
979 
980     ///Creates a Metal library instance that contains the functions from your app’s default Metal library.
981     @selector("newDefaultLibrary")
982     MTLLibrary newDefaultLibrary();
983 
984     ///Creates a new memory fence instance.
985     @selector("newFence")
986     MTLFence newFence();
987 
988 
989     ///Creates an input/output command queue you use to submit commands that load assets from the file system into GPU resources or system memory.
990     @selector("newIOCommandQueueWithDescriptor:error:")
991     MTLIOCommandQueue newIOCommandQueueWithDescriptor(MTLIOCommandQueueDescriptor descriptor, NSError* error = null);
992 
993     ///Synchronously creates a render pipeline state.
994     @selector("newRenderPipelineStateWithDescriptor:error:")
995     MTLRenderPipelineState newRenderPipelineStateWithDescriptor(MTLRenderPipelineDescriptor descriptor, NSError* error = null);
996 
997     ///Creates a depth-stencil state instance.
998     @selector("newDepthStencilStateWithDescriptor:")
999     MTLDepthStencilState newDepthStencilStateWithDescriptor(MTLDepthStencilDescriptor);
1000 
1001     ///Returns a Boolean value that indicates whether the GPU can sample a texture with a specific number of sample points.
1002     @selector("supportsTextureSampleCount:")
1003     BOOL supportsTextureSampleCount(NSUInteger sampleCount);
1004 
1005     ///Creates a sampler state instance.
1006     @selector("newSamplerStateWithDescriptor:")
1007     MTLSamplerState newSamplerStateWithDescriptor(MTLSamplerDescriptor descriptor);
1008 
1009     ///Returns the minimum alignment the GPU device requires to create a texture buffer from a buffer.
1010     @selector("minimumTextureBufferAlignmentForPixelFormat:")
1011     NSUInteger minimumTextureBufferAlignmentForPixelFormat(MTLPixelFormat);
1012 
1013 }
1014 
1015 ///A block of code invoked after a drawable is presented.
1016 alias MTLDrawablePresentedHandler = extern(C) void function(MTLDrawable);
1017 
1018 
1019 
1020 ///A displayable resource that can be rendered or written to.
1021 interface MTLDrawable
1022 {
1023 @nogc nothrow:
1024 
1025     mixin ObjcExtend!NSObject;
1026 
1027     ///A positive integer that identifies the drawable.
1028     @selector("drawableID")
1029     NSUInteger drawableID();
1030 
1031     ///Presents the drawable onscreen as soon as possible.
1032     @selector("present")
1033     void present();
1034 
1035     ///Presents the drawable onscreen at a specific host time.
1036     @selector("presentAtTime:")
1037     void present(CFTimeInterval presentationTime);
1038 
1039     ///Presents the drawable onscreen as soon as possible after a previous drawable is visible for the specified duration.
1040     @selector("presentAfterMinimumDuration:")
1041     void presentAfterMinimumDuration(CFTimeInterval duration);
1042 
1043 
1044     ///Registers a block of code to be called immediately after the drawable is presented.
1045     @selector("addPresentedHandler:")
1046     void addPresentedHandler(MTLDrawablePresentedHandler);
1047 
1048     ///The host time, in seconds, when the drawable was displayed onscreen.
1049     @selector("presentedTime")
1050     CFTimeInterval presentedTime();
1051 }
1052 
1053 extern(C) MTLSamplePosition MTLSamplePositionMake(float x, float y);
1054 extern(C) MTLDevice MTLCreateSystemDefaultDevice();
1055 extern(C) NSArrayD!MTLDevice MTLCopyAllDevices();
1056 
1057 ///An instance you use to create, submit, and schedule command buffers to a specific GPU device to run the commands within those buffers.
1058 interface MTLCommandQueue
1059 {
1060 @nogc nothrow:
1061 
1062     mixin ObjcExtend!NSObject;
1063 
1064     ///Returns a command buffer from the command queue that you configure with a descriptor.
1065     @selector("commandBufferWithDescriptor:")
1066     MTLCommandBuffer commandBuffer(MTLCommandBufferDescriptor descriptor);
1067 
1068     ///Returns a command buffer from the command queue that maintains strong references to resources.
1069     @selector("commandBuffer")
1070     MTLCommandBuffer commandBuffer();
1071 
1072     ///Returns a command buffer from the command queue that doesn’t maintain strong references to resources.
1073     @selector("commandBufferWithUnretainedReferences")
1074     MTLCommandBuffer commandBufferWithUnretainedReferences();
1075 
1076     ///The GPU device that creates the command queue.
1077     @selector("device")
1078     MTLDevice device();
1079 
1080     ///An optional name that can help you identify the command queue.
1081     @selector("label")
1082     NSString label();
1083     @selector("setLabel:")
1084     NSString label(NSString);
1085     
1086 }
1087 
1088 ///A Metal drawable associated with a Core Animation layer.
1089 interface CAMetalDrawable : MTLDrawable
1090 {
1091 @nogc nothrow:
1092 
1093     mixin ObjcExtend!NSObject;
1094 
1095     ///A Metal texture object that contains the drawable’s contents.
1096     @selector("texture")
1097     MTLTexture texture();
1098     ///The layer that owns this drawable object.
1099     // @selector("layer")
1100     // CAMetalLayer layer();
1101 }
1102 
1103 ///An allocation of memory that is accessible to a GPU.
1104 interface MTLResource
1105 {
1106 @nogc nothrow:
1107 
1108     mixin ObjcExtend!NSObject;
1109 
1110     ///The device object that created the resource.
1111     @selector("device")
1112     MTLDevice device();
1113 
1114     ///A string that identifies the resource.
1115     @selector("label")
1116     NSString label();
1117     @selector("setLabel:")
1118     NSString label(NSString);
1119 }
1120 
1121 ///An encoder that writes GPU commands into a command buffer.
1122 interface MTLCommandEncoder
1123 {
1124 @nogc nothrow:
1125 
1126     mixin ObjcExtend!NSObject;
1127 
1128     ///Declares that all command generation from the encoder is completed.
1129     @selector("endEncoding")
1130     void endEncoding();
1131 
1132     ///Inserts a debug string into the captured frame data.
1133     @selector("insertDebugSignpost:")
1134     void insertDebugSignpost(NSString);
1135 
1136     ///Pushes a specific string onto a stack of debug group strings for the command encoder.
1137     @selector("pushDebugGroup:")
1138     void pushDebugGroup(NSString);
1139 
1140     ///Pops the latest string off of a stack of debug group strings for the command encoder.
1141     @selector("popDebugGroup")
1142     void popDebugGroup();
1143 
1144     ///The Metal device from which the command encoder was created.
1145     @selector("device")
1146     MTLDevice device();
1147 
1148     ///A string that labels the command encoder.
1149     @selector("label")
1150     NSString label();
1151 
1152     @selector("setLabel:")
1153     NSString label(NSString);
1154 }
1155 
1156 
1157 interface MTLBuffer
1158 {
1159 @nogc nothrow:
1160 
1161     mixin ObjcExtend!NSObject;
1162 
1163     ///Creates a texture that shares its storage with the buffer.
1164     @selector("newTextureWithDescriptor:offset:bytesPerRow:")
1165     MTLTexture newTextureWithDescriptor(
1166         MTLTextureDescriptor,
1167         NSUInteger offset,
1168         NSUInteger bytesPerRow
1169     );
1170 
1171 
1172     ///Gets the system address of the buffer’s storage allocation.
1173     void* contents() @selector("contents");
1174     ///Informs the GPU that the CPU has modified a section of the buffer.
1175     void didModifyRange(NSRange) @selector("didModifyRange:");
1176 
1177     ///Adds a debug marker string to a specific buffer range.
1178     @selector("addDebugMarker:range:")
1179     void addDebugMarker(NSString marker, NSRange range);
1180 
1181     ///Removes all debug marker strings from the buffer.
1182     @selector("removeAllDebugMarkers")
1183     void removeAllDebugMarkers();
1184 
1185     ///The logical size of the buffer, in bytes.
1186     @selector("length")
1187     NSUInteger length();
1188 }
1189 
1190 ///An object you use to synchronize access to Metal resources.
1191 interface MTLEvent
1192 {
1193 @nogc nothrow:
1194 
1195     ///The device object that created the event.
1196     @selector("device")
1197     MTLDevice device();
1198 
1199     ///A string that identifies the event.
1200     @selector("label")
1201     NSString label();
1202 }
1203 
1204 class CALayer
1205 {
1206 @nogc nothrow:
1207 
1208     mixin ObjcExtend!NSObject;
1209 }
1210 
1211 class CAMetalLayer
1212 {
1213 @nogc nothrow:
1214 
1215     mixin ObjcExtend!CALayer;
1216     @selector("pixelFormat")
1217     MTLPixelFormat pixelFormat();
1218     @selector("setPixelFormat:")
1219     MTLPixelFormat pixelFormat(MTLPixelFormat);
1220 
1221     @selector("device")
1222     MTLDevice device();
1223     @selector("setDevice:")
1224     MTLDevice device(MTLDevice);
1225 
1226     @selector("drawableSize")
1227     CGSize drawableSize();
1228     @selector("setDrawableSize:")
1229     CGSize drawableSize(CGSize);
1230 
1231     @selector("framebufferOnly")
1232     BOOL framebufferOnly();
1233     @selector("setFramebufferOnly:")
1234     BOOL framebufferOnly(BOOL);
1235 
1236     @selector("wantsExtendedDynamicRangeContent")
1237     BOOL wantsExtendedDynamicRangeContent();
1238     @selector("setWantsExtendedDynamicRangeContent:")
1239     BOOL wantsExtendedDynamicRangeContent(BOOL);
1240 
1241     @selector("presentsWithTransaction")
1242     BOOL presentsWithTransaction();
1243     @selector("setPresentsWithTransaction:")
1244     BOOL presentsWithTransaction(BOOL);
1245 
1246     @selector("displaySyncEnabled")
1247     BOOL displaySyncEnabled();
1248     @selector("setDisplaySyncEnabled:")
1249     BOOL displaySyncEnabled(BOOL);
1250 
1251     @selector("allowsNextDrawableTimeout")
1252     BOOL allowsNextDrawableTimeout();
1253     @selector("setAllowsNextDrawableTimeout:")
1254     BOOL allowsNextDrawableTimeout(BOOL);
1255     
1256     @selector("nextDrawable")
1257     CAMetalDrawable nextDrawable();
1258 }
1259 ///The basic type for all floating-point values.
1260 version(watchOS)
1261     alias CGFloat = float;
1262 else
1263     alias CGFloat = double;
1264 
1265 ///A structure that contains a point in a two-dimensional coordinate system.
1266 struct CGPoint
1267 {
1268     CGFloat x = 0, y = 0;
1269     enum zero = CGPoint(0,0);
1270 }    
1271 ///A structure that contains width and height values.
1272 struct CGSize
1273 {
1274     double width = 0;
1275     double height = 0;
1276     /// The size whose width and height are both zero.
1277     enum zero = CGSize(0, 0);
1278 }
1279 ///A structure that contains the location and dimensions of a rectangle.
1280 struct CGRect
1281 {
1282     CGPoint origin;
1283     CGSize size;
1284 }
1285 
1286 /**
1287 Returns a size with the specified dimension values.
1288 
1289 Params:
1290     width = A width value.
1291     height = A height value.
1292 Returns: Returns a CGSize structure with the specified width and height.
1293 */
1294 extern(C) CGSize CGSizeMake(float width, float height);