-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extensions/ext: Add VK_EXT_vertex_input_dynamic_state
- Loading branch information
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |