use crate::types::{DepthFormat, TextureFormat};
use ash::vk;
use super::super::{DeviceHandle, BufferHandle};
pub(crate) struct PhysicalDeviceInfo {
pub handle: vk::PhysicalDevice,
pub properties: vk::PhysicalDeviceProperties,
pub adapter_id: u32,
}
pub(crate) struct LogicalDevice {
pub device: ash::Device,
pub physical_device: vk::PhysicalDevice,
#[allow(dead_code)]
pub adapter_id: u32,
pub queue: vk::Queue,
#[allow(dead_code)]
pub queue_family: u32,
pub command_pool: vk::CommandPool,
}
pub(crate) struct BufferState {
pub device_handle: DeviceHandle,
pub buffer: vk::Buffer,
pub memory: vk::DeviceMemory,
pub size: u64,
}
pub(crate) struct ShaderState {
pub device_handle: DeviceHandle,
pub slang_source: String,
pub search_paths: Vec<String>,
pub vertex_module: Option<vk::ShaderModule>,
pub fragment_module: Option<vk::ShaderModule>,
pub compute_module: Option<vk::ShaderModule>,
}
pub(crate) struct PipelineState {
pub device_handle: DeviceHandle,
pub pipeline: vk::Pipeline,
pub layout: vk::PipelineLayout,
}
pub(crate) struct ComputePipelineState {
pub device_handle: DeviceHandle,
pub pipeline: vk::Pipeline,
pub layout: vk::PipelineLayout,
}
pub(crate) struct BindGroupLayoutState {
#[allow(dead_code)]
pub device_handle: DeviceHandle,
pub layout: vk::DescriptorSetLayout,
pub binding_types: std::collections::HashMap<u32, ash::vk::DescriptorType>,
}
pub(crate) struct BindGroupState {
pub device_handle: DeviceHandle,
pub descriptor_set: vk::DescriptorSet,
pub pool: vk::DescriptorPool,
}
pub(crate) struct RenderTargetState {
pub device_handle: DeviceHandle,
pub width: u32,
pub height: u32,
pub format: TextureFormat,
pub image: vk::Image,
pub image_memory: vk::DeviceMemory,
pub image_view: vk::ImageView,
pub depth_format: Option<DepthFormat>,
pub depth_image: Option<vk::Image>,
pub depth_memory: Option<vk::DeviceMemory>,
pub depth_view: Option<vk::ImageView>,
pub staging_buffer: Option<vk::Buffer>,
pub staging_memory: Option<vk::DeviceMemory>,
pub command_buffer: vk::CommandBuffer,
pub has_rendered: bool,
}
pub(crate) struct TextureState {
pub device_handle: DeviceHandle,
pub width: u32,
pub height: u32,
#[allow(dead_code)]
pub format: TextureFormat,
pub image: vk::Image,
pub memory: vk::DeviceMemory,
pub view: vk::ImageView,
pub staging_buffer: Option<vk::Buffer>,
pub staging_memory: Option<vk::DeviceMemory>,
}
pub(crate) struct SamplerState {
pub device_handle: DeviceHandle,
pub sampler: vk::Sampler,
}
pub const MAX_FRAMES_IN_FLIGHT: usize = 2;
pub(crate) struct FrameSync {
pub command_buffer: vk::CommandBuffer,
pub image_available_semaphore: vk::Semaphore,
pub render_finished_semaphore: vk::Semaphore,
pub in_flight_fence: vk::Fence,
}
pub(crate) struct SurfaceState {
pub device_handle: DeviceHandle,
pub surface: vk::SurfaceKHR,
pub swapchain: vk::SwapchainKHR,
pub swapchain_images: Vec<vk::Image>,
pub swapchain_image_views: Vec<vk::ImageView>,
pub width: u32,
pub height: u32,
pub format: vk::Format,
pub current_frame: usize,
pub current_image_index: Option<u32>,
pub frame_sync: Vec<FrameSync>,
}
#[derive(Clone)]
#[allow(dead_code)]
pub(crate) struct PendingBuffer {
pub buffer: BufferHandle,
pub slot: u32,
pub offset: u64,
}