pub struct VulkanDevice {Show 15 fields
pub device: Device,
pub physical_device: PhysicalDevice,
pub queue: Mutex<Queue>,
pub queue_family_index: u32,
pub memory_properties: PhysicalDeviceMemoryProperties,
pub non_coherent_atom_size: u64,
pub bindless_heap: Option<VulkanBindlessHeap>,
pub swapchain_loader: Option<Device>,
pub command_recorder_cache: Mutex<Vec<(CommandPool, CommandBuffer)>>,
pub fence_cache: Mutex<Vec<Fence>>,
pub internal_frame_semaphore: Semaphore,
pub internal_frame_counter: AtomicU64,
pub pending_async_recorders: Mutex<Vec<(u64, Vec<VulkanCommandRecorder>)>>,
pub allocator: Mutex<VulkanSuballocator>,
pub pipeline_cache: PipelineCache,
}Fields§
§device: Device§physical_device: PhysicalDevice§queue: Mutex<Queue>§queue_family_index: u32§memory_properties: PhysicalDeviceMemoryProperties§non_coherent_atom_size: u64§bindless_heap: Option<VulkanBindlessHeap>§swapchain_loader: Option<Device>§command_recorder_cache: Mutex<Vec<(CommandPool, CommandBuffer)>>§fence_cache: Mutex<Vec<Fence>>§internal_frame_semaphore: Semaphore§internal_frame_counter: AtomicU64§pending_async_recorders: Mutex<Vec<(u64, Vec<VulkanCommandRecorder>)>>§allocator: Mutex<VulkanSuballocator>§pipeline_cache: PipelineCacheImplementations§
Source§impl VulkanDevice
impl VulkanDevice
pub fn create_buffer( &self, desc: &BufferDesc<'_>, ) -> Result<VulkanBuffer, HalError>
pub fn write_buffer( &self, buffer: &VulkanBuffer, offset: u64, data: &[u8], ) -> Result<(), HalError>
pub fn read_buffer( &self, buffer: &VulkanBuffer, offset: u64, data: &mut [u8], ) -> Result<(), HalError>
pub fn destroy_buffer(&self, buffer: VulkanBuffer)
pub fn register_bindless_buffer( &self, buffer: &VulkanBuffer, ) -> Result<u32, HalError>
pub fn unregister_bindless_buffer(&self, slot: u32)
pub fn write_buffer_descriptors_batch( &self, writes: &[(u32, &VulkanBuffer)], ) -> Result<(), HalError>
Source§impl VulkanDevice
impl VulkanDevice
pub fn create_command_recorder(&self) -> Result<VulkanCommandRecorder, HalError>
pub fn recycle_command_recorder(&self, recorder: VulkanCommandRecorder)
pub fn bind_buffers_to_compute_pipeline( &self, pipeline: &VulkanComputePipeline, buffers: &[&VulkanBuffer], )
pub fn dispatch( &self, recorder: &VulkanCommandRecorder, pipeline: &VulkanComputePipeline, x: u32, y: u32, z: u32, )
pub fn dispatch_bindless( &self, recorder: &VulkanCommandRecorder, pipeline: Pipeline, push_constants: &[u8], x: u32, y: u32, z: u32, ) -> Result<(), HalError>
pub fn cmd_clear_and_render( &self, recorder: &VulkanCommandRecorder, texture: &VulkanTexture, clear_color: [f32; 4], ) -> Result<(), HalError>
pub fn cmd_clear_and_render_with_depth( &self, recorder: &VulkanCommandRecorder, color_texture: &VulkanTexture, depth_texture: &VulkanTexture, clear_color: [f32; 4], clear_depth: f32, ) -> Result<(), HalError>
pub fn cmd_draw( &self, recorder: &VulkanCommandRecorder, texture: &VulkanTexture, pipeline: Pipeline, vertex_count: u32, push_constants: &[u8], clear_color: [f32; 4], ) -> Result<(), HalError>
pub fn cmd_draw_instanced( &self, recorder: &VulkanCommandRecorder, texture: &VulkanTexture, pipeline: Pipeline, vertex_count: u32, instance_count: u32, first_vertex: u32, first_instance: u32, push_constants: &[u8], clear_color: [f32; 4], ) -> Result<(), HalError>
pub fn cmd_draw_triangle( &self, recorder: &VulkanCommandRecorder, texture: &VulkanTexture, pipeline: Pipeline, clear_color: [f32; 4], ) -> Result<(), HalError>
pub fn cmd_draw_with_depth( &self, recorder: &VulkanCommandRecorder, color_texture: &VulkanTexture, depth_texture: &VulkanTexture, pipeline: Pipeline, vertex_count: u32, push_constants: &[u8], clear_color: [f32; 4], clear_depth: f32, ) -> Result<(), HalError>
pub fn cmd_draw_mrt( &self, recorder: &VulkanCommandRecorder, color_textures: &[&VulkanTexture], depth_texture: Option<&VulkanTexture>, pipeline: Pipeline, vertex_count: u32, instance_count: u32, first_vertex: u32, first_instance: u32, push_constants: &[u8], clear_color: [f32; 4], clear_depth: Option<f32>, ) -> Result<(), HalError>
pub fn cmd_draw_indexed( &self, recorder: &VulkanCommandRecorder, texture: &VulkanTexture, pipeline: Pipeline, index_buffer: &VulkanBuffer, index_count: u32, instance_count: u32, first_index: u32, vertex_offset: i32, first_instance: u32, index_type: IndexType, push_constants: &[u8], clear_color: [f32; 4], ) -> Result<(), HalError>
pub fn cmd_draw_indexed_with_depth( &self, recorder: &VulkanCommandRecorder, color_texture: &VulkanTexture, depth_texture: &VulkanTexture, pipeline: Pipeline, index_buffer: &VulkanBuffer, index_count: u32, instance_count: u32, first_index: u32, vertex_offset: i32, first_instance: u32, index_type: IndexType, push_constants: &[u8], clear_color: [f32; 4], clear_depth: f32, ) -> Result<(), HalError>
pub fn cmd_draw_indirect( &self, recorder: &VulkanCommandRecorder, texture: &VulkanTexture, pipeline: Pipeline, indirect_buffer: &VulkanBuffer, offset: u64, draw_count: u32, stride: u32, push_constants: &[u8], clear_color: [f32; 4], ) -> Result<(), HalError>
pub fn cmd_draw_indirect_with_depth( &self, recorder: &VulkanCommandRecorder, color_texture: &VulkanTexture, depth_texture: &VulkanTexture, pipeline: Pipeline, indirect_buffer: &VulkanBuffer, offset: u64, draw_count: u32, stride: u32, push_constants: &[u8], clear_color: [f32; 4], clear_depth: f32, ) -> Result<(), HalError>
pub fn cmd_draw_with_ops( &self, recorder: &VulkanCommandRecorder, color_texture: &VulkanTexture, depth: Option<(&VulkanTexture, DepthLoadOp)>, pipeline: Pipeline, draw_cmd: DrawCommand<'_>, push_constants: &[u8], color_load_op: ColorLoadOp, ) -> Result<(), HalError>
pub fn cmd_dispatch_indirect( &self, recorder: &VulkanCommandRecorder, pipeline: Pipeline, indirect_buffer: &VulkanBuffer, offset: u64, push_constants: &[u8], ) -> Result<(), HalError>
pub fn cmd_copy_buffer_to_buffer( &self, recorder: &VulkanCommandRecorder, src: &VulkanBuffer, dst: &VulkanBuffer, size: u64, src_offset: u64, dst_offset: u64, )
pub fn cmd_copy_buffer_to_image( &self, recorder: &VulkanCommandRecorder, buffer: &VulkanBuffer, texture: &VulkanTexture, )
pub fn write_texture( &self, texture: &VulkanTexture, data: &[u8], ) -> Result<(), HalError>
pub fn cmd_copy_image_to_buffer( &self, recorder: &VulkanCommandRecorder, texture: &VulkanTexture, buffer: &VulkanBuffer, )
pub fn submit_and_wait( &self, recorder: VulkanCommandRecorder, ) -> Result<(), HalError>
pub fn submit_batches_and_wait( &self, recorders: Vec<VulkanCommandRecorder>, ) -> Result<(), HalError>
pub fn submit_batches_async( &self, recorders: Vec<VulkanCommandRecorder>, wait_semaphores: &[(&VulkanTimelineSemaphore, u64)], signal_semaphores: &[(&VulkanTimelineSemaphore, u64)], ) -> Result<(), HalError>
pub fn cmd_memory_barrier(&self, recorder: &VulkanCommandRecorder)
pub fn cmd_buffer_barrier( &self, recorder: &VulkanCommandRecorder, buffer: &VulkanBuffer, )
Source§impl VulkanDevice
impl VulkanDevice
pub fn create_shader_from_spirv( &self, spirv_words: &[u32], ) -> Result<VulkanShader, HalError>
pub fn create_compute_pipeline( &self, shader: &VulkanShader, buffer_count: u32, ) -> Result<VulkanComputePipeline, HalError>
pub fn create_bindless_compute_pipeline( &self, shader: &VulkanShader, ) -> Result<Pipeline, HalError>
pub fn destroy_raw_pipeline(&self, pipeline: Pipeline)
pub fn create_graphics_pipeline( &self, shader: &VulkanShader, vs_entry: &str, fs_entry: &str, color_format: TextureFormat, ) -> Result<Pipeline, HalError>
pub fn create_graphics_pipeline_with_depth( &self, shader: &VulkanShader, vs_entry: &str, fs_entry: &str, color_format: TextureFormat, depth_format: Option<TextureFormat>, depth_test: bool, depth_write: bool, ) -> Result<Pipeline, HalError>
pub fn create_graphics_pipeline_with_depth_and_samples( &self, shader: &VulkanShader, vs_entry: &str, fs_entry: &str, color_format: TextureFormat, depth_format: Option<TextureFormat>, depth_test: bool, depth_write: bool, sample_count: u32, ) -> Result<Pipeline, HalError>
pub fn create_graphics_pipeline_with_desc( &self, shader: &VulkanShader, desc: &GraphicsPipelineDesc<'_>, ) -> Result<Pipeline, HalError>
pub fn destroy_shader(&self, shader: VulkanShader)
pub fn destroy_compute_pipeline(&self, pipeline: VulkanComputePipeline)
Source§impl VulkanDevice
impl VulkanDevice
pub fn create_swapchain( &self, surface: SurfaceKHR, surface_loader: &Instance, width: u32, height: u32, old_swapchain: SwapchainKHR, preferred_format: Option<Format>, preferred_present_mode: Option<PresentModeKHR>, ) -> Result<VulkanSwapchain, HalError>
pub fn destroy_swapchain(&self, swapchain: VulkanSwapchain)
pub fn acquire_next_image( &self, swapchain: &VulkanSwapchain, semaphore: Semaphore, timeout_nanos: u64, ) -> Result<(u32, bool), HalError>
pub fn queue_present( &self, swapchain: &VulkanSwapchain, image_index: u32, wait_semaphores: &[Semaphore], ) -> Result<bool, HalError>
pub fn queue_present_raw( &self, swapchain: SwapchainKHR, image_index: u32, wait_semaphores: &[Semaphore], ) -> Result<bool, HalError>
pub fn cmd_transition_to_present( &self, recorder: &VulkanCommandRecorder, texture: &VulkanTexture, )
pub fn submit_for_surface( &self, recorder: VulkanCommandRecorder, wait_semaphore: Semaphore, signal_semaphore: Semaphore, fence: Option<Fence>, ) -> Result<(), HalError>
Source§impl VulkanDevice
impl VulkanDevice
pub fn create_timeline_semaphore( &self, initial_value: u64, ) -> Result<VulkanTimelineSemaphore, HalError>
pub fn wait_timeline_semaphore( &self, semaphore: &VulkanTimelineSemaphore, value: u64, timeout_nanos: u64, ) -> Result<(), HalError>
pub fn get_timeline_semaphore_value( &self, semaphore: &VulkanTimelineSemaphore, ) -> Result<u64, HalError>
pub fn signal_timeline_semaphore( &self, semaphore: &VulkanTimelineSemaphore, value: u64, ) -> Result<(), HalError>
pub fn destroy_timeline_semaphore(&self, semaphore: VulkanTimelineSemaphore)
Source§impl VulkanDevice
impl VulkanDevice
pub fn create_texture( &self, desc: &TextureDesc<'_>, ) -> Result<VulkanTexture, HalError>
pub fn destroy_texture(&self, texture: VulkanTexture)
pub fn register_bindless_texture( &self, texture: &VulkanTexture, ) -> Result<u32, HalError>
pub fn unregister_bindless_texture(&self, slot: u32)
pub fn register_bindless_storage_image( &self, texture: &VulkanTexture, ) -> Result<u32, HalError>
pub fn unregister_bindless_storage_image(&self, slot: u32)
pub fn write_texture_descriptors_batch( &self, writes: &[(u32, &VulkanTexture)], ) -> Result<(), HalError>
pub fn create_sampler( &self, desc: &SamplerDesc<'_>, ) -> Result<VulkanSampler, HalError>
pub fn destroy_sampler(&self, sampler: VulkanSampler)
pub fn register_bindless_sampler( &self, sampler: &VulkanSampler, ) -> Result<u32, HalError>
pub fn unregister_bindless_sampler(&self, slot: u32)
Trait Implementations§
Source§impl Drop for VulkanDevice
impl Drop for VulkanDevice
Source§impl HalDevice for VulkanDevice
Available on crate feature vulkan only.
impl HalDevice for VulkanDevice
Available on crate feature
vulkan only.type Buffer = VulkanBuffer
type Texture = VulkanTexture
type Sampler = VulkanSampler
type CommandRecorder = VulkanCommandRecorder
fn create_buffer(&self, desc: &BufferDesc<'_>) -> Result<Self::Buffer, HalError>
fn destroy_buffer(&self, buffer: Self::Buffer)
fn write_buffer( &self, buffer: &Self::Buffer, offset: u64, bytes: &[u8], ) -> Result<(), HalError>
fn read_buffer( &self, buffer: &Self::Buffer, offset: u64, dest: &mut [u8], ) -> Result<(), HalError>
fn create_texture( &self, desc: &TextureDesc<'_>, ) -> Result<Self::Texture, HalError>
fn destroy_texture(&self, texture: Self::Texture)
fn create_sampler( &self, desc: &SamplerDesc<'_>, ) -> Result<Self::Sampler, HalError>
fn destroy_sampler(&self, sampler: Self::Sampler)
fn create_command_recorder(&self) -> Result<Self::CommandRecorder, HalError>
fn register_bindless_buffer( &self, buffer: &Self::Buffer, ) -> Result<u32, HalError>
fn unregister_bindless_buffer(&self, slot: u32)
fn register_bindless_texture( &self, texture: &Self::Texture, ) -> Result<u32, HalError>
fn unregister_bindless_texture(&self, slot: u32)
fn register_bindless_storage_image( &self, texture: &Self::Texture, ) -> Result<u32, HalError>
fn unregister_bindless_storage_image(&self, slot: u32)
fn register_bindless_sampler( &self, sampler: &Self::Sampler, ) -> Result<u32, HalError>
fn unregister_bindless_sampler(&self, slot: u32)
impl Send for VulkanDevice
impl Sync for VulkanDevice
Auto Trait Implementations§
impl !Freeze for VulkanDevice
impl RefUnwindSafe for VulkanDevice
impl Unpin for VulkanDevice
impl UnsafeUnpin for VulkanDevice
impl UnwindSafe for VulkanDevice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more