oarust 0.8.6

GPU-first semantic computing engine written in Rust
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
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
//! Backend-neutral reporting for hardware video queue and codec support.

use crate::{Engine, Result};

/// Chroma sampling carried by a video codec profile.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum VideoChromaSubsampling {
	Monochrome,
	Yuv420,
	Yuv422,
	Yuv444,
}

/// Component precision carried by a video codec profile.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum VideoComponentBitDepth {
	Eight,
	Ten,
	Twelve,
}

/// H.264 profile identity used for exact decoder capability queries.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum H264Profile {
	Baseline,
	Main,
	High,
	High444Predictive,
}

/// H.264 decoded-picture layout.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum H264PictureLayout {
	Progressive,
	InterlacedInterleavedLines,
	InterlacedSeparatePlanes,
}

/// H.265 profile identity used for exact decoder capability queries.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum H265Profile {
	Main,
	Main10,
	MainStillPicture,
	FormatRangeExtensions,
	ScreenContentCodingExtensions,
}

/// AV1 profile identity used for exact decoder capability queries.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Av1Profile {
	Main,
	High,
	Professional,
}

/// VP9 profile identity used for exact decoder capability queries.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Vp9Profile {
	Profile0,
	Profile1,
	Profile2,
	Profile3,
}

/// One complete decode profile presented to the selected device.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum VideoDecodeProfile {
	H264 {
		profile: H264Profile,
		picture_layout: H264PictureLayout,
		chroma_subsampling: VideoChromaSubsampling,
		luma_bit_depth: VideoComponentBitDepth,
		chroma_bit_depth: VideoComponentBitDepth,
	},
	H265 {
		profile: H265Profile,
		chroma_subsampling: VideoChromaSubsampling,
		luma_bit_depth: VideoComponentBitDepth,
		chroma_bit_depth: VideoComponentBitDepth,
	},
	Av1 {
		profile: Av1Profile,
		film_grain_support: bool,
		chroma_subsampling: VideoChromaSubsampling,
		luma_bit_depth: VideoComponentBitDepth,
		chroma_bit_depth: VideoComponentBitDepth,
	},
	Vp9 {
		profile: Vp9Profile,
		chroma_subsampling: VideoChromaSubsampling,
		luma_bit_depth: VideoComponentBitDepth,
		chroma_bit_depth: VideoComponentBitDepth,
	},
}

impl VideoDecodeProfile {
	/// Construct the common progressive H.264 4:2:0 8-bit profile.
	pub const fn h264_420_8bit(profile: H264Profile) -> Self {
		Self::H264 {
			profile,
			picture_layout: H264PictureLayout::Progressive,
			chroma_subsampling: VideoChromaSubsampling::Yuv420,
			luma_bit_depth: VideoComponentBitDepth::Eight,
			chroma_bit_depth: VideoComponentBitDepth::Eight,
		}
	}

	/// Construct the common H.265 4:2:0 profile at one component precision.
	pub const fn h265_420(profile: H265Profile, bit_depth: VideoComponentBitDepth) -> Self {
		Self::H265 {
			profile,
			chroma_subsampling: VideoChromaSubsampling::Yuv420,
			luma_bit_depth: bit_depth,
			chroma_bit_depth: bit_depth,
		}
	}

	/// Construct the common AV1 4:2:0 profile at one component precision.
	pub const fn av1_420(
		profile: Av1Profile,
		bit_depth: VideoComponentBitDepth,
		film_grain_support: bool,
	) -> Self {
		Self::Av1 {
			profile,
			film_grain_support,
			chroma_subsampling: VideoChromaSubsampling::Yuv420,
			luma_bit_depth: bit_depth,
			chroma_bit_depth: bit_depth,
		}
	}

	/// Construct the common VP9 4:2:0 profile at one component precision.
	pub const fn vp9_420(profile: Vp9Profile, bit_depth: VideoComponentBitDepth) -> Self {
		Self::Vp9 {
			profile,
			chroma_subsampling: VideoChromaSubsampling::Yuv420,
			luma_bit_depth: bit_depth,
			chroma_bit_depth: bit_depth,
		}
	}
}

/// One exact encode profile presented to the selected device.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum VideoEncodeProfile {
	H264 {
		profile: H264Profile,
		chroma_subsampling: VideoChromaSubsampling,
		luma_bit_depth: VideoComponentBitDepth,
		chroma_bit_depth: VideoComponentBitDepth,
	},
	H265 {
		profile: H265Profile,
		chroma_subsampling: VideoChromaSubsampling,
		luma_bit_depth: VideoComponentBitDepth,
		chroma_bit_depth: VideoComponentBitDepth,
	},
}

impl VideoEncodeProfile {
	/// Construct the donor H.264 High 4:2:0 8-bit encode profile.
	pub const fn h264_high_420_8bit() -> Self {
		Self::H264 {
			profile: H264Profile::High,
			chroma_subsampling: VideoChromaSubsampling::Yuv420,
			luma_bit_depth: VideoComponentBitDepth::Eight,
			chroma_bit_depth: VideoComponentBitDepth::Eight,
		}
	}

	/// Construct the donor H.265 Main 4:2:0 8-bit encode profile.
	pub const fn h265_main_420_8bit() -> Self {
		Self::H265 {
			profile: H265Profile::Main,
			chroma_subsampling: VideoChromaSubsampling::Yuv420,
			luma_bit_depth: VideoComponentBitDepth::Eight,
			chroma_bit_depth: VideoComponentBitDepth::Eight,
		}
	}
}

/// Two-dimensional device limit expressed without Vulkan types.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct VideoExtent {
	pub width: u32,
	pub height: u32,
}

/// Multi-plane YUV image layout admitted by the Video runtime.
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum VideoPixelFormat {
	/// Three-plane 8-bit 4:2:0 (I420-style plane layout).
	Yuv420Planar8,
	/// Two-plane 8-bit 4:2:0 (NV12-style plane layout).
	Nv12,
	/// Three-plane 10-bit 4:2:0 stored in 16-bit components.
	Yuv420Planar10,
	/// Two-plane 10-bit 4:2:0 stored in 16-bit components (P010).
	P010,
	/// Two-plane 12-bit 4:2:0 stored in 16-bit components (P012).
	P012,
}

/// One Vulkan-video-compatible image representation without Vulkan types.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct VideoImageFormat {
	pub(crate) pixel_format: VideoPixelFormat,
	pub(crate) optimal_tiling: bool,
	pub(crate) sampled: bool,
	pub(crate) storage: bool,
	pub(crate) transfer_source: bool,
	pub(crate) transfer_destination: bool,
}

impl VideoImageFormat {
	/// Return the semantic plane and component layout.
	pub const fn pixel_format(self) -> VideoPixelFormat {
		self.pixel_format
	}

	/// Return whether the device requires or supports optimal image tiling here.
	pub const fn optimal_tiling(self) -> bool {
		self.optimal_tiling
	}

	/// Return whether the reported image usage includes sampling.
	pub const fn sampled(self) -> bool {
		self.sampled
	}

	/// Return whether the reported image usage includes storage access.
	pub const fn storage(self) -> bool {
		self.storage
	}

	/// Return whether the reported image usage includes transfer-source access.
	pub const fn transfer_source(self) -> bool {
		self.transfer_source
	}

	/// Return whether the reported image usage includes transfer-destination access.
	pub const fn transfer_destination(self) -> bool {
		self.transfer_destination
	}
}

/// Decode-output and decoded-picture-buffer formats for one exact profile.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct VideoDecodeFormats {
	pub(crate) profile: VideoDecodeProfile,
	pub(crate) output: Vec<VideoImageFormat>,
	pub(crate) dpb: Vec<VideoImageFormat>,
	pub(crate) unrecognized_output_formats: usize,
	pub(crate) unrecognized_dpb_formats: usize,
}

/// Encode-input and reconstructed-picture formats for one exact profile.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct VideoEncodeFormats {
	pub(crate) profile: VideoEncodeProfile,
	pub(crate) input: Vec<VideoImageFormat>,
	pub(crate) dpb: Vec<VideoImageFormat>,
	pub(crate) unrecognized_input_formats: usize,
	pub(crate) unrecognized_dpb_formats: usize,
}

impl VideoEncodeFormats {
	pub const fn profile(&self) -> VideoEncodeProfile {
		self.profile
	}
	pub fn input(&self) -> &[VideoImageFormat] {
		&self.input
	}
	pub fn dpb(&self) -> &[VideoImageFormat] {
		&self.dpb
	}
	pub const fn unrecognized_input_formats(&self) -> usize {
		self.unrecognized_input_formats
	}
	pub const fn unrecognized_dpb_formats(&self) -> usize {
		self.unrecognized_dpb_formats
	}
}

impl VideoDecodeFormats {
	/// Return the exact profile used for this query.
	pub const fn profile(&self) -> VideoDecodeProfile {
		self.profile
	}

	/// Borrow OARS-recognized decoded-output image formats.
	pub fn output(&self) -> &[VideoImageFormat] {
		&self.output
	}

	/// Borrow OARS-recognized decoded-picture-buffer image formats.
	pub fn dpb(&self) -> &[VideoImageFormat] {
		&self.dpb
	}

	/// Return how many backend output formats OARS cannot yet represent.
	pub const fn unrecognized_output_formats(&self) -> usize {
		self.unrecognized_output_formats
	}

	/// Return how many backend DPB formats OARS cannot yet represent.
	pub const fn unrecognized_dpb_formats(&self) -> usize {
		self.unrecognized_dpb_formats
	}
}

/// Codec-specific maximum level reported for a decode profile.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum VideoDecodeLevel {
	H264(u32),
	H265(u32),
	Av1(u32),
	Vp9(u32),
}

/// Exact device limits for one supported decode profile.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct VideoDecodeCapabilities {
	pub(crate) profile: VideoDecodeProfile,
	pub(crate) min_coded_extent: VideoExtent,
	pub(crate) max_coded_extent: VideoExtent,
	pub(crate) picture_access_granularity: VideoExtent,
	pub(crate) min_bitstream_offset_alignment: u64,
	pub(crate) min_bitstream_size_alignment: u64,
	pub(crate) max_dpb_slots: u32,
	pub(crate) max_active_reference_pictures: u32,
	pub(crate) level: VideoDecodeLevel,
	pub(crate) field_offset_granularity: Option<(i32, i32)>,
	pub(crate) dpb_and_output_coincide: bool,
	pub(crate) dpb_and_output_distinct: bool,
	pub(crate) protected_content: bool,
	pub(crate) separate_reference_images: bool,
}

/// Codec-specific limits returned with an exact encode capability query.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum VideoEncodeCodecCapabilities {
	H264 {
		max_level: u32,
		max_slice_count: u32,
		max_p_l0_references: u32,
		max_b_l0_references: u32,
		max_l1_references: u32,
		max_temporal_layers: u32,
		min_qp: i32,
		max_qp: i32,
	},
	H265 {
		max_level: u32,
		max_slice_segment_count: u32,
		max_tiles: VideoExtent,
		ctb_size_16: bool,
		ctb_size_32: bool,
		ctb_size_64: bool,
		transform_size_4: bool,
		transform_size_8: bool,
		transform_size_16: bool,
		transform_size_32: bool,
		max_p_l0_references: u32,
		max_b_l0_references: u32,
		max_l1_references: u32,
		max_sub_layers: u32,
		min_qp: i32,
		max_qp: i32,
	},
}

/// Backend-neutral device limits for one exact encode profile.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct VideoEncodeCapabilities {
	pub(crate) profile: VideoEncodeProfile,
	pub(crate) min_coded_extent: VideoExtent,
	pub(crate) max_coded_extent: VideoExtent,
	pub(crate) picture_access_granularity: VideoExtent,
	pub(crate) input_picture_granularity: VideoExtent,
	pub(crate) min_bitstream_offset_alignment: u64,
	pub(crate) min_bitstream_size_alignment: u64,
	pub(crate) max_dpb_slots: u32,
	pub(crate) max_active_reference_pictures: u32,
	pub(crate) max_rate_control_layers: u32,
	pub(crate) max_bitrate: u64,
	pub(crate) max_quality_levels: u32,
	pub(crate) constant_qp: bool,
	pub(crate) cbr: bool,
	pub(crate) vbr: bool,
	pub(crate) feedback_offset: bool,
	pub(crate) feedback_bytes_written: bool,
	pub(crate) feedback_overrides: bool,
	pub(crate) protected_content: bool,
	pub(crate) separate_reference_images: bool,
	pub(crate) codec: VideoEncodeCodecCapabilities,
}

impl VideoEncodeCapabilities {
	pub const fn profile(self) -> VideoEncodeProfile {
		self.profile
	}
	pub const fn min_coded_extent(self) -> VideoExtent {
		self.min_coded_extent
	}
	pub const fn max_coded_extent(self) -> VideoExtent {
		self.max_coded_extent
	}
	pub const fn picture_access_granularity(self) -> VideoExtent {
		self.picture_access_granularity
	}
	pub const fn input_picture_granularity(self) -> VideoExtent {
		self.input_picture_granularity
	}
	pub const fn min_bitstream_offset_alignment(self) -> u64 {
		self.min_bitstream_offset_alignment
	}
	pub const fn min_bitstream_size_alignment(self) -> u64 {
		self.min_bitstream_size_alignment
	}
	pub const fn max_dpb_slots(self) -> u32 {
		self.max_dpb_slots
	}
	pub const fn max_active_reference_pictures(self) -> u32 {
		self.max_active_reference_pictures
	}
	pub const fn max_rate_control_layers(self) -> u32 {
		self.max_rate_control_layers
	}
	pub const fn max_bitrate(self) -> u64 {
		self.max_bitrate
	}
	pub const fn max_quality_levels(self) -> u32 {
		self.max_quality_levels
	}
	pub const fn supports_constant_qp(self) -> bool {
		self.constant_qp
	}
	pub const fn supports_cbr(self) -> bool {
		self.cbr
	}
	pub const fn supports_vbr(self) -> bool {
		self.vbr
	}
	pub const fn supports_feedback_offset(self) -> bool {
		self.feedback_offset
	}
	pub const fn supports_feedback_bytes_written(self) -> bool {
		self.feedback_bytes_written
	}
	pub const fn supports_feedback_overrides(self) -> bool {
		self.feedback_overrides
	}
	pub const fn protected_content(self) -> bool {
		self.protected_content
	}
	pub const fn separate_reference_images(self) -> bool {
		self.separate_reference_images
	}
	pub const fn codec(self) -> VideoEncodeCodecCapabilities {
		self.codec
	}
}

impl VideoDecodeCapabilities {
	/// Return the exact profile used for this query.
	pub const fn profile(self) -> VideoDecodeProfile {
		self.profile
	}

	/// Return the smallest supported coded extent.
	pub const fn min_coded_extent(self) -> VideoExtent {
		self.min_coded_extent
	}

	/// Return the largest supported coded extent.
	pub const fn max_coded_extent(self) -> VideoExtent {
		self.max_coded_extent
	}

	/// Return the device's coded-picture access granularity.
	pub const fn picture_access_granularity(self) -> VideoExtent {
		self.picture_access_granularity
	}

	/// Return the minimum encoded-bitstream buffer offset alignment in bytes.
	pub const fn min_bitstream_offset_alignment(self) -> u64 {
		self.min_bitstream_offset_alignment
	}

	/// Return the minimum encoded-bitstream buffer size alignment in bytes.
	pub const fn min_bitstream_size_alignment(self) -> u64 {
		self.min_bitstream_size_alignment
	}

	/// Return the maximum number of decoded-picture-buffer slots.
	pub const fn max_dpb_slots(self) -> u32 {
		self.max_dpb_slots
	}

	/// Return the maximum number of simultaneously active reference pictures.
	pub const fn max_active_reference_pictures(self) -> u32 {
		self.max_active_reference_pictures
	}

	/// Return the codec-specific maximum supported level.
	pub const fn level(self) -> VideoDecodeLevel {
		self.level
	}

	/// Return H.264 field-offset granularity, or `None` for another codec.
	pub const fn field_offset_granularity(self) -> Option<(i32, i32)> {
		self.field_offset_granularity
	}

	/// Return whether decoded output may alias its DPB picture.
	pub const fn dpb_and_output_coincide(self) -> bool {
		self.dpb_and_output_coincide
	}

	/// Return whether decoded output may be distinct from its DPB picture.
	pub const fn dpb_and_output_distinct(self) -> bool {
		self.dpb_and_output_distinct
	}

	/// Return whether this profile supports protected video sessions.
	pub const fn protected_content(self) -> bool {
		self.protected_content
	}

	/// Return whether each DPB slot may use a separate reference image.
	pub const fn separate_reference_images(self) -> bool {
		self.separate_reference_images
	}
}

/// Hardware video queue and codec-extension capabilities for the Engine's device.
///
/// Hardware advertisement is distinct from OA session availability. The
/// Engine creation enables advertised video queue/codec extensions, while
/// Session availability is narrower than hardware advertisement: it becomes
/// true only when OA has enabled and qualified at least one corresponding path.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct VideoDeviceCapabilities {
	pub(crate) decode_queue_family: Option<u32>,
	pub(crate) encode_queue_family: Option<u32>,
	pub(crate) decode_result_status_queries: bool,
	pub(crate) encode_result_status_queries: bool,
	pub(crate) h264_decode: bool,
	pub(crate) h265_decode: bool,
	pub(crate) av1_decode: bool,
	pub(crate) vp9_decode: bool,
	pub(crate) h264_encode: bool,
	pub(crate) h265_encode: bool,
	pub(crate) av1_encode: bool,
	pub(crate) video_queues_enabled: bool,
	pub(crate) decoder_sessions_available: bool,
	pub(crate) encoder_sessions_available: bool,
}

impl VideoDeviceCapabilities {
	/// Return the first physical-device queue family advertising video decode.
	pub const fn decode_queue_family(self) -> Option<u32> {
		self.decode_queue_family
	}

	/// Return the first physical-device queue family advertising video encode.
	pub const fn encode_queue_family(self) -> Option<u32> {
		self.encode_queue_family
	}

	/// Return whether the selected video-decode queue supports operation-status queries.
	pub const fn supports_decode_result_status_queries(self) -> bool {
		self.decode_result_status_queries
	}

	/// Return whether the selected video-encode queue supports operation-status queries.
	pub const fn supports_encode_result_status_queries(self) -> bool {
		self.encode_result_status_queries
	}

	/// Return whether the physical device advertises H.264 decode.
	pub const fn supports_h264_decode(self) -> bool {
		self.h264_decode
	}

	/// Return whether the physical device advertises H.265 decode.
	pub const fn supports_h265_decode(self) -> bool {
		self.h265_decode
	}

	/// Return whether the physical device advertises AV1 decode.
	pub const fn supports_av1_decode(self) -> bool {
		self.av1_decode
	}

	/// Return whether the physical device advertises VP9 decode.
	pub const fn supports_vp9_decode(self) -> bool {
		self.vp9_decode
	}

	/// Return whether the physical device advertises H.264 encode.
	pub const fn supports_h264_encode(self) -> bool {
		self.h264_encode
	}

	/// Return whether the physical device advertises H.265 encode.
	pub const fn supports_h265_encode(self) -> bool {
		self.h265_encode
	}

	/// Return whether the physical device advertises AV1 encode.
	pub const fn supports_av1_encode(self) -> bool {
		self.av1_encode
	}

	/// Return whether the Engine enabled the advertised Vulkan Video queue extensions.
	pub const fn video_queues_enabled(self) -> bool {
		self.video_queues_enabled
	}

	/// Return whether this Engine currently has an enabled decoder-session path.
	pub const fn decoder_sessions_available(self) -> bool {
		self.decoder_sessions_available
	}

	/// Return whether this Engine currently has an enabled encoder-session path.
	pub const fn encoder_sessions_available(self) -> bool {
		self.encoder_sessions_available
	}
}

/// Query Vulkan Video queues and codec extensions on the Engine's selected device.
///
/// This query reports both physical-device advertisement and whether Engine
/// creation enabled video queues, and whether at least one qualified codec
/// session path exists.
///
/// # Errors
///
/// Returns an error when Vulkan device-extension or queue-family enumeration
/// fails.
pub fn query_device_capabilities(engine: &Engine) -> Result<VideoDeviceCapabilities> {
	engine.query_video_device_capabilities()
}

/// Query the selected device's exact limits for one decoder profile.
///
/// Extension advertisement alone does not prove that a particular profile,
/// chroma layout, bit depth, or codec option is usable. This query presents the
/// complete profile to Vulkan and returns `MissingCapability` when rejected.
///
/// # Errors
///
/// Returns an error when the codec extension is unavailable, the exact profile
/// is unsupported, or the Vulkan capability query fails.
pub fn query_decode_capabilities(
	engine: &Engine,
	profile: VideoDecodeProfile,
) -> Result<VideoDecodeCapabilities> {
	engine.query_video_decode_capabilities(profile)
}

/// Enumerate decoded-output and DPB image formats for one exact profile.
///
/// # Errors
///
/// Returns an error when the profile or its codec extension is unsupported, a
/// Vulkan enumeration fails, or the driver reports an unreasonable result size.
pub fn query_decode_formats(
	engine: &Engine,
	profile: VideoDecodeProfile,
) -> Result<VideoDecodeFormats> {
	engine.query_video_decode_formats(profile)
}

/// Query exact H.264 or H.265 encoder limits without creating a session.
pub fn query_encode_capabilities(
	engine: &Engine,
	profile: VideoEncodeProfile,
) -> Result<VideoEncodeCapabilities> {
	engine.query_video_encode_capabilities(profile)
}

/// Enumerate encode-input and DPB formats for one exact profile.
pub fn query_encode_formats(
	engine: &Engine,
	profile: VideoEncodeProfile,
) -> Result<VideoEncodeFormats> {
	engine.query_video_encode_formats(profile)
}