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
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Bridge between [`fuel_vulkan_backend::VulkanBackend`] and
//! [`crate::Device`].
//!
//! Mirrors the [`crate::cuda_backend`] shape: a `From<VulkanBackend>
//! for Device` impl plus an `as_device(&Device) -> &VulkanBackend`
//! downcast helper. The Vulkan storage path runs on the byte-shape
//! [`fuel_vulkan_backend::VulkanStorageBytes`] substrate, so the
//! downcast returns an `Arc<VulkanBackend>` callers thread into
//! [`fuel_vulkan_backend::VulkanBackend::alloc_bytes_handle`] /
//! [`fuel_vulkan_backend::VulkanBackend::upload_bytes_handle`] /
//! [`fuel_vulkan_backend::VulkanBackend::download_bytes`].
//!
//! The full `DynBackendDevice` trait body lives on
//! [`fuel_vulkan_backend::VulkanBackendDevice`] (a wrapper around
//! `Arc<VulkanBackend>`); fuel-core knows about it only via the
//! `From` impl below.
use Arc;
use ;
use crate::;
/// Convenience constructor: pick the discrete GPU if available, fall
/// back to the first compute-capable device. Mirrors the CPU/CUDA
/// `Device::cpu()` / `cuda_backend::new_device` ergonomics.
/// Returns the underlying [`Arc<VulkanBackend>`] handle, or an error
/// if `device` is not a Vulkan device.
///
/// The returned `Arc` is a fresh clone — callers feed it into
/// [`VulkanBackend::alloc_bytes_handle`] /
/// [`VulkanBackend::upload_bytes_handle`] for byte-storage allocation
/// + binding-table-dispatch reachability.