cidre 0.11.4

Apple frameworks bindings for rust
Documentation
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
mod types;
pub use types::Coordinate2d;
pub use types::Origin;
pub use types::Region;
pub use types::ResId;
pub use types::SamplePos;
pub use types::Size;

mod stage_input_output_descriptor;
pub use stage_input_output_descriptor::AttrFormat;
pub use stage_input_output_descriptor::IndexType;

mod allocation;
pub use allocation::Allocation;

mod acceleration_structure;
pub use acceleration_structure::AccelerationStruct;
pub use acceleration_structure::Desc as AccelerationStructDesc;
pub use acceleration_structure::GeometryDesc as AccelerationStructGeometryDesc;
pub use acceleration_structure::InstanceOpts as AccelerationStructInstanceOpts;
pub use acceleration_structure::MatrixLayout;
pub use acceleration_structure::MotionBorderMode;
pub use acceleration_structure::MotionBoundingBoxGeometryDesc;
pub use acceleration_structure::Usage as AccelerationStructUsage;

pub mod acceleration_structure_types;
pub use acceleration_structure_types::AxisAlignedBoundingBox;
pub use acceleration_structure_types::ComponentTransform;
pub use acceleration_structure_types::PackedF32Quaternion;
pub use acceleration_structure_types::PackedF32x3;
pub use acceleration_structure_types::PackedF32x4x3;

mod pixel_format;
pub use pixel_format::PixelFormat;

mod argument;
pub use argument::Access as ArgAccess;
pub use argument::ArrayType;
pub use argument::BaseType;
pub use argument::Binding;
pub use argument::DType;
pub use argument::PointerType;
pub use argument::StructMember;
pub use argument::StructType;
pub use argument::TextureRefType;
pub use argument::Type as ArgType;

mod tensor;
pub use tensor::TENSOR_MAX_RANK;
pub use tensor::Tensor;
pub use tensor::TensorDType;
pub use tensor::TensorDesc;
pub use tensor::TensorExtents;
pub use tensor::TensorUsage;

mod residency_set;
pub use residency_set::ResidencySet;
pub use residency_set::ResidencySetDesc;

mod resource;
pub use resource::Opts as ResOpts;
pub use resource::Res;

pub use resource::CpuCacheMode;
pub use resource::HazardTrackingMode;
pub use resource::PurgableState;
pub use resource::StorageMode;

pub use resource::CPU_CACHE_MODE_MASK;
pub use resource::CPU_CACHE_MODE_SHIFT;
pub use resource::HAZARD_TRACKING_MODE_MASK;
pub use resource::HAZARD_TRACKING_MODE_SHIFT;
pub use resource::STORAGE_MODE_MASK;
pub use resource::STORAGE_MODE_SHIFT;

mod resource_state_command_encoder;
pub use resource_state_command_encoder::SparseTextureMappingMode;

mod heap;
pub use heap::Desc as HeapDesc;
pub use heap::Heap;
pub use heap::Type as HeapType;

mod library;
pub use library::Attr;
pub use library::CompileOpts;
pub use library::CompileSymbolVisibility;
pub use library::Error as LibError;
pub use library::ErrorDomain as LibErrorDomain;
pub use library::Fn;
pub use library::FnType;
pub use library::LangVersion;
pub use library::Lib;
pub use library::MathFloatingPointFns;
pub use library::MathMode;
pub use library::OptimizationLevel as LibOptimizationLevel;
pub use library::PatchType;
pub use library::Type as LibType;
pub use library::VertexAttr;

mod command_queue;
pub use command_queue::CmdQueue;

mod texture;
pub use texture::Compression as TextureCompression;
pub use texture::Desc as TextureDesc;
pub use texture::SharedTextureHandle;
pub use texture::Swizzle as TextureSwizzle;
pub use texture::SwizzleChannels as TextureSwizzleChannels;
pub use texture::Texture;
pub use texture::Type as TextureType;
pub use texture::Usage as TextureUsage;

mod device;
pub use device::ArgBufsTier;
pub use device::Device;
pub use device::GpuFamily;
pub use device::PipelineOpt;
pub use device::ReadWriteTextureTier;
pub use device::SizeAlign;
pub use device::SparsePageSize;
pub use device::Timestamp;

mod drawable;
pub use drawable::Drawable;

mod function_constant_values;
pub use function_constant_values::FnConstValues;

mod function_handle;
pub use function_handle::AnyFnHandle;
pub use function_handle::FnHandle;

mod function_stitching;
pub use function_stitching::FnStitchedLibDesc;
pub use function_stitching::FnStitchingAttr;
pub use function_stitching::FnStitchingAttrAlwaysInline;
pub use function_stitching::FnStitchingFnNode;
pub use function_stitching::FnStitchingGraph;
pub use function_stitching::FnStitchingInputNode;
pub use function_stitching::FnStitchingNode;

mod argument_encoder;
pub use argument_encoder::ArgEncoder;

mod buffer;
pub use buffer::Buf;

mod function_descriptor;
pub use function_descriptor::FnDesc;
pub use function_descriptor::FnOpts;

mod compute_pipeline;
pub use compute_pipeline::Desc as ComputePipelineDesc;
pub use compute_pipeline::Reflection as ComputePipelineReflection;
pub use compute_pipeline::State as ComputePipelineState;

mod command_buffer;
pub use command_buffer::CmdBuf;
pub use command_buffer::CmdBufHandler;
pub use command_buffer::DispatchType;
pub use command_buffer::Error as CmdBufErr;
pub use command_buffer::Status as CmdBufStatus;

mod render_pipeline;
pub use render_pipeline::BlendFactor;
pub use render_pipeline::BlendOp;
pub use render_pipeline::ColorAttachDesc as RenderPipelineColorAttachDesc;
pub use render_pipeline::ColorAttachDescArray as RenderPipelineColorAttachDescArray;
pub use render_pipeline::ColorWriteMask;
pub use render_pipeline::Desc as RenderPipelineDesc;
pub use render_pipeline::FnsDesc as RenderPipelineFnsDesc;
pub use render_pipeline::MeshRenderPipelineDesc;
pub use render_pipeline::PrimitiveTopologyClass;
pub use render_pipeline::Reflection as RenderPipelineReflection;
pub use render_pipeline::State as RenderPipelineState;
pub use render_pipeline::TessellationControlPointIndexType;
pub use render_pipeline::TessellationFactorFormat;
pub use render_pipeline::TessellationFactorStepFn;
pub use render_pipeline::TessellationPartitionMode;
pub use render_pipeline::TileRenderPipelineColorAttachDesc;
pub use render_pipeline::TileRenderPipelineColorAttachDescArray;
pub use render_pipeline::TileRenderPipelineDesc;

pub use crate::mtl4::render_pipeline::LogicalToPhysicalColorAttachMap;
pub use crate::mtl4::render_pipeline::LogicalToPhysicalColorAttachMappingState;

mod fence;
pub use fence::Fence;

mod event;
pub use event::Event;
pub use event::SharedEvent;
pub use event::SharedEventHandle;
pub use event::SharedEventListener;
pub use event::SharedEventNotificationBlock;

mod blit_pass;
pub use blit_pass::Desc as BlitPassDesc;
pub use blit_pass::SampleBufAttachDesc as BlitPassSampleBufAttachDesc;
pub use blit_pass::SampleBufAttachDescArray as BlitPassSampleBufAttachDescArray;

mod command_encoder;
pub use command_encoder::BarrierScope;
pub use command_encoder::CmdEncoder;
pub use command_encoder::ResUsage;
pub use command_encoder::Stages;

mod blit_command_encoder;
pub use blit_command_encoder::BlitCmdEncoder;
pub use blit_command_encoder::BlitOpt;

mod render_command_encoder;
pub use render_command_encoder::CullMode;
pub use render_command_encoder::DepthClipMode;
pub use render_command_encoder::DrawIndexedPrimitivesIndirectArgs;
pub use render_command_encoder::DrawPatchIndirectArgs;
pub use render_command_encoder::DrawPrimitivesIndirectArgs;
pub use render_command_encoder::Primitive;
pub use render_command_encoder::QuadTessellationFactorsHalf;
pub use render_command_encoder::RenderCmdEncoder;
pub use render_command_encoder::RenderStages;
pub use render_command_encoder::ScissorRect;
pub use render_command_encoder::TriangleFillMode;
pub use render_command_encoder::TriangleTessellationFactorsHalf;
pub use render_command_encoder::VertexAmplificationViewMapping;
pub use render_command_encoder::Viewport;
pub use render_command_encoder::VisibilityResultMode;
pub use render_command_encoder::Winding;

mod depth_stencil;
pub use depth_stencil::CompareFn;
pub use depth_stencil::DepthStencilDesc;
pub use depth_stencil::State as DepthStencilState;
pub use depth_stencil::StencilDesc;
pub use depth_stencil::StencilOp;

mod compute_command_encoder;
pub use compute_command_encoder::ComputeCmdEncoder;

mod parallel_render_command_encoder;
pub use parallel_render_command_encoder::ParallelRenderCmdEncoder;

mod vertex_descriptor;
pub use vertex_descriptor::Desc as VertexDesc;
pub use vertex_descriptor::VertexAttrDesc;
pub use vertex_descriptor::VertexAttrDescArray;
pub use vertex_descriptor::VertexBufLayoutDesc;
pub use vertex_descriptor::VertexBufLayoutDescArray;
pub use vertex_descriptor::VertexFormat;
pub use vertex_descriptor::VertexStepFn;

mod render_pass;
pub use render_pass::AttachDesc as RenderPassAttachDesc;
pub use render_pass::ClearColor;
pub use render_pass::ColorAttachDesc as RenderPassColorAttachDesc;
pub use render_pass::ColorAttachDescArray as RenderPassColorAttachDescArray;
pub use render_pass::DepthAttachDesc as RenderPassDepthAttachDesc;
pub use render_pass::Desc as RenderPassDesc;
pub use render_pass::LoadAction;
pub use render_pass::StencilAttachDesc as RenderPassStencilAttachDesc;
pub use render_pass::StoreAction;
pub use render_pass::StoreActionOpts;
pub use render_pass::VisibilityResultType;

mod compute_pass;
pub use compute_pass::Desc as ComputePassDesc;
pub use compute_pass::SampleBufAttachDesc as ComputePassSampleBufAttachDesc;
pub use compute_pass::SampleBufAttachDescArray as ComputePassSampleBufAttachDescArray;

mod counters;
pub use counters::Counter;
pub use counters::CounterResultStageUtilization;
pub use counters::CounterResultStatistic;
pub use counters::CounterResultTimestamp;
pub use counters::CounterSampleBuf;
pub use counters::CounterSet;
pub use counters::Desc as CounterSampleBufDesc;

mod indirect_command_buffer;
pub use indirect_command_buffer::Desc as IndirectCmdBufDesc;
pub use indirect_command_buffer::ExecutionRange as IndirectCmBufExecutionRange;
pub use indirect_command_buffer::IndirectCmdBuf;
pub use indirect_command_buffer::IndirectCmdType;

mod indirect_command_encoder;
pub use indirect_command_encoder::IndirectComputeCmd;
pub use indirect_command_encoder::IndirectRenderCmd;

mod sampler;
pub use sampler::AddrMode as SamplerAddrMode;
pub use sampler::BorderColor as SamplerBorderColor;
pub use sampler::Desc as SamplerDesc;
pub use sampler::MinMagFilter as SamplerMinMagFilter;
pub use sampler::MipFilter as SamplerMipFilter;
pub use sampler::State as SamplerState;

mod visible_function_table;
pub use visible_function_table::Desc as VisibleFnTableDesc;
pub use visible_function_table::VisibleFnTable;

mod intersection_function_table;
pub use intersection_function_table::Desc as IntersectionFnTableDesc;
pub use intersection_function_table::IntersectionFnSignature;
pub use intersection_function_table::IntersectionFnTable;

mod pipeline;
pub use pipeline::Mutability;
pub use pipeline::PipelineBufDesc;
pub use pipeline::PipelineBufDescArray;
pub use pipeline::ShaderValidation;

mod capture_manager;
pub use capture_manager::CaptureDesc;
pub use capture_manager::CaptureDst;
pub use capture_manager::CaptureManager;

mod capture_scope;
pub use capture_scope::CaptureScope;

#[macro_export]
macro_rules! define_mtl {
    (set_label) => {
        #[$crate::objc::msg_send(setLabel:)]
        pub fn set_label(&mut self, val: Option<&crate::ns::String>);
    };

    (width) => {
        #[$crate::objc::msg_send(width)]
        pub fn width(&self) -> usize;
    };

    (set_width) => {
        #[$crate::objc::msg_send(setWidth:)]
        pub fn set_width(&mut self, val: usize);
    };

    (height) => {
        #[$crate::objc::msg_send(height)]
        pub fn height(&self) -> usize;
    };

    (set_height) => {
        #[$crate::objc::msg_send(setHeight:)]
        pub fn set_height(&mut self, val: usize);
    };

    (depth) => {
        #[$crate::objc::msg_send(depth)]
        pub fn depth(&self) -> usize;
    };

    (set_depth) => {
        #[$crate::objc::msg_send(setDepth:)]
        pub fn set_depth(&mut self, val: usize);
    };

    (gpu_res_id) => {
        #[$crate::objc::msg_send(gpuResourceID)]
        pub fn gpu_res_id(&self) -> crate::mtl::ResId;
    };

    (update_fence) => {
        #[$crate::objc::msg_send(updateFence:)]
        pub fn update_fence(&self, fence: &crate::mtl::Fence);
    };

    (wait_for_fence) => {
        #[$crate::objc::msg_send(waitForFence:)]
        pub fn wait_for_fence(&self, fence: &crate::mtl::Fence);
    };

    (use_resource) => {
        #[$crate::objc::msg_send(useResource:usage:)]
        pub fn use_resource(&mut self, resource: &crate::mtl::Res, usage: crate::mtl::ResUsage);
    };

    (use_resources) => {
        #[$crate::objc::msg_send(useResources:count:usage:)]
        pub fn use_resources_count(&mut self, resources: *const &crate::mtl::Res, count: usize, usage: crate::mtl::ResUsage);

        #[inline]
        pub fn use_resources(&mut self, resources: &[&crate::mtl::Res], usage: crate::mtl::ResUsage) {
            self.use_resources_count(resources.as_ptr(), resources.len(), usage);
        }
    };

    (use_heap) => {
        #[$crate::objc::msg_send(useHeap:)]
        pub fn use_heap(&mut self, heap: &crate::mtl::Heap);
    };

    (push_debug_group) => {
        #[$crate::objc::msg_send(pushDebugGroup:)]
        pub fn push_debug_group(&mut self, debug_group: &crate::ns::String);
    };

    (pop_debug_group) => {
        #[$crate::objc::msg_send(popDebugGroup)]
        pub fn pop_debug_group(&mut self);
    };

    (storage_mode) => {
        #[$crate::objc::msg_send(storageMode)]
        pub fn storage_mode(&self) -> crate::mtl::StorageMode;
    };

    (set_storage_mode) => {
        #[$crate::objc::msg_send(setStorageMode:)]
        pub fn set_storage_mode(&mut self, val: crate::mtl::StorageMode);
    };

    (cpu_cache_mode) => {
        #[$crate::objc::msg_send(cpuCacheMode)]
        pub fn cpu_cache_mode(&self) -> crate::mtl::CpuCacheMode;
    };

    (set_cpu_cache_mode) => {
        #[$crate::objc::msg_send(setCpuCacheMode:)]
        pub fn set_cpu_cache_mode(&mut self, val: crate::mtl::CpuCacheMode);
    };

    (hazard_tracking_mode) => {
        #[$crate::objc::msg_send(hazardTrackingMode)]
        pub fn hazard_tracking_mode(&self) -> crate::mtl::HazardTrackingMode;
    };

    (set_hazard_tracking_mode) => {
        #[$crate::objc::msg_send(setHazardTrackingMode:)]
        pub fn set_hazard_tracking_mode(&mut self, val: crate::mtl::HazardTrackingMode);
    };

    (res_opts) => {
        #[$crate::objc::msg_send(resourceOptions)]
        pub fn res_opts(&self) -> crate::mtl::ResOpts;
    };

    (set_res_opts) => {
        #[$crate::objc::msg_send(setResourceOptions:)]
        pub fn set_res_opts(&mut self, val: crate::mtl::ResOpts);
    };

    (reset) => {
        #[$crate::objc::msg_send(reset)]
        pub fn reset(&mut self);
    };

    ($first:ident, $($tail:ident),*) => {
        define_mtl!($first);
        define_mtl!($($tail),+);
    };
}