diff --git a/Changelog.md b/Changelog.md index 835fd94..3f21c8c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added `VK_KHR_maintenance5` device extension (#780) - Added `VK_NV_device_generated_commands_compute` device extension (#781) - Added `VK_KHR_cooperative_matrix` instance extension (#782) +- Added `VK_EXT_vertex_input_dynamic_state` device extension (#784) ### Changed diff --git a/ash/src/extensions/ext/mod.rs b/ash/src/extensions/ext/mod.rs index b545ed1..17b9789 100644 --- a/ash/src/extensions/ext/mod.rs +++ b/ash/src/extensions/ext/mod.rs @@ -22,6 +22,7 @@ pub use self::private_data::PrivateData; pub use self::sample_locations::SampleLocations; pub use self::shader_object::ShaderObject; pub use self::tooling_info::ToolingInfo; +pub use self::vertex_input_dynamic_state::VertexInputDynamicState; mod acquire_drm_display; mod buffer_device_address; @@ -47,3 +48,4 @@ mod private_data; mod sample_locations; mod shader_object; mod tooling_info; +mod vertex_input_dynamic_state; diff --git a/ash/src/extensions/ext/vertex_input_dynamic_state.rs b/ash/src/extensions/ext/vertex_input_dynamic_state.rs new file mode 100644 index 0000000..09c67c5 --- /dev/null +++ b/ash/src/extensions/ext/vertex_input_dynamic_state.rs @@ -0,0 +1,43 @@ +use crate::vk; +use crate::{Device, Instance}; +use std::ffi::CStr; +use std::mem; + +/// +#[derive(Clone)] +pub struct VertexInputDynamicState { + fp: vk::ExtVertexInputDynamicStateFn, +} + +impl VertexInputDynamicState { + pub fn new(instance: &Instance, device: &Device) -> Self { + let fp = vk::ExtVertexInputDynamicStateFn::load(|name| unsafe { + mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) + }); + Self { fp } + } + + /// + #[inline] + pub unsafe fn cmd_set_vertex_input( + &self, + command_buffer: vk::CommandBuffer, + vertex_binding_descriptions: &[vk::VertexInputBindingDescription2EXT], + vertex_attribute_descriptions: &[vk::VertexInputAttributeDescription2EXT], + ) { + (self.fp.cmd_set_vertex_input_ext)( + command_buffer, + vertex_binding_descriptions.len() as u32, + vertex_binding_descriptions.as_ptr(), + vertex_attribute_descriptions.len() as u32, + vertex_attribute_descriptions.as_ptr(), + ) + } + + pub const NAME: &'static CStr = vk::ExtVertexInputDynamicStateFn::NAME; + + #[inline] + pub fn fp(&self) -> &vk::ExtVertexInputDynamicStateFn { + &self.fp + } +}