rotex_vulkan/bridge/
mod.rs1mod init;
2mod pipeline_cache;
3mod render;
4mod resources;
5mod surface;
6mod types;
7
8use std::collections::{HashMap, HashSet};
9
10use crate::backend::vulkan::{
11 CommandBuffer, CommandPool, DescriptorPool, DescriptorSetLayout, Fence, VulkanDevice,
12 VulkanInstance,
13};
14use crate::error::{Error, ErrorKind};
15use rotex_types::resource::{MaterialId, MeshId, TextureId, VertexBufferLayout};
16
17use self::types::{
18 MaterialPipeline, MaterialPipelineKey, MaterialResource, MeshResource, SurfaceState,
19 TextureResource, VertexLayoutId,
20};
21
22pub struct VulkanBridge {
23 instance: VulkanInstance,
24 device: VulkanDevice,
25 command_pool: CommandPool,
26 command_buffer: CommandBuffer,
27 in_flight_fence: Fence,
28 graphics_queue_index: u32,
29 surface_state: Option<SurfaceState>,
30 meshes: HashMap<MeshId, MeshResource>,
31 materials: HashMap<MaterialId, MaterialResource>,
32 textures: HashMap<TextureId, TextureResource>,
33 default_texture: Option<TextureResource>,
34 texture_descriptor_pool: DescriptorPool,
35 texture_set_layout: DescriptorSetLayout,
36 material_pipelines: HashMap<MaterialPipelineKey, MaterialPipeline>,
37 pipelines_by_material: HashMap<MaterialId, HashSet<MaterialPipelineKey>>,
38 vertex_layouts: HashMap<VertexLayoutId, VertexBufferLayout>,
39 next_mesh_id: u64,
40 next_material_id: u64,
41 next_texture_id: u64,
42}
43
44fn surface_not_attached_error() -> Error {
45 Error::fatal(ErrorKind::Unsupported("Surface is not attached"))
46}