Skip to content

Commit

Permalink
extensions/ext: Add VK_EXT_vertex_input_dynamic_state
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeagc committed Aug 6, 2023
1 parent f558761 commit c7afed0
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `VK_ANDROID_external_memory_android_hardware_buffer` device extension (#769)
- Added `VK_AMD_buffer_marker` device extension (#772)
- Added `VK_AMD_shader_info` device extension (#773)
- Added `VK_EXT_vertex_input_dynamic_state` device extension (#784)

### Changed

Expand Down
2 changes: 2 additions & 0 deletions ash/src/extensions/ext/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,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;
Expand All @@ -45,3 +46,4 @@ mod private_data;
mod sample_locations;
mod shader_object;
mod tooling_info;
mod vertex_input_dynamic_state;
43 changes: 43 additions & 0 deletions ash/src/extensions/ext/vertex_input_dynamic_state.rs
Original file line number Diff line number Diff line change
@@ -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
}
}

0 comments on commit c7afed0

Please sign in to comment.