extensions/ext: Add VK_EXT_vertex_input_dynamic_state (#784)

This commit is contained in:
Felipe 2023-08-14 11:57:11 -03:00 committed by GitHub
parent 39dc6d607c
commit 43d4a68ab2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 0 deletions

View file

@ -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_KHR_maintenance5` device extension (#780)
- Added `VK_NV_device_generated_commands_compute` device extension (#781) - Added `VK_NV_device_generated_commands_compute` device extension (#781)
- Added `VK_KHR_cooperative_matrix` instance extension (#782) - Added `VK_KHR_cooperative_matrix` instance extension (#782)
- Added `VK_EXT_vertex_input_dynamic_state` device extension (#784)
### Changed ### Changed

View file

@ -22,6 +22,7 @@ pub use self::private_data::PrivateData;
pub use self::sample_locations::SampleLocations; pub use self::sample_locations::SampleLocations;
pub use self::shader_object::ShaderObject; pub use self::shader_object::ShaderObject;
pub use self::tooling_info::ToolingInfo; pub use self::tooling_info::ToolingInfo;
pub use self::vertex_input_dynamic_state::VertexInputDynamicState;
mod acquire_drm_display; mod acquire_drm_display;
mod buffer_device_address; mod buffer_device_address;
@ -47,3 +48,4 @@ mod private_data;
mod sample_locations; mod sample_locations;
mod shader_object; mod shader_object;
mod tooling_info; mod tooling_info;
mod vertex_input_dynamic_state;

View file

@ -0,0 +1,43 @@
use crate::vk;
use crate::{Device, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_vertex_input_dynamic_state.html>
#[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 }
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetVertexInputEXT.html>
#[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
}
}