Skip to content

Commit

Permalink
extensions/khr: Add VK_KHR_line_rasterization extension
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Mar 25, 2024
1 parent eba5007 commit 6cd3df3
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `load_with()` function on `Device` and `Instance` for providing custom `get_xxx_proc_addr()` implementations (#846)
- Added `Send`/`Sync` to all Vulkan structs (#869)
- Added `VK_KHR_dynamic_rendering_local_read` device extension (#888)
- Added `VK_KHR_line_rasterization` device extension (#889)

### Changed

Expand Down
39 changes: 39 additions & 0 deletions ash/src/extensions/khr/line_rasterization.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_line_rasterization.html>
use crate::vk;
use core::mem;
pub use vk::khr::line_rasterization::NAME;

#[derive(Clone)]
pub struct Device {
fp: vk::khr::line_rasterization::DeviceFn,
}

impl Device {
pub fn new(instance: &crate::Instance, device: &crate::Device) -> Self {
let fp = vk::khr::line_rasterization::DeviceFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
Self { fp }
}

/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdSetLineStippleKHR.html>
#[inline]
pub unsafe fn cmd_set_line_stipple(
&self,
command_buffer: vk::CommandBuffer,
line_stipple_factor: u32,
line_stipple_pattern: u16,
) {
(self.fp.cmd_set_line_stipple_khr)(
command_buffer,
line_stipple_factor,
line_stipple_pattern,
)
}

#[inline]
pub fn fp(&self) -> &vk::khr::line_rasterization::DeviceFn {
&self.fp
}
}
2 changes: 1 addition & 1 deletion ash/src/extensions/khr/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod acceleration_structure;
pub mod android_surface;
pub mod buffer_device_address;
pub mod cooperative_matrix;
Expand All @@ -21,6 +20,7 @@ pub mod external_semaphore_win32;
pub mod get_memory_requirements2;
pub mod get_physical_device_properties2;
pub mod get_surface_capabilities2;
pub mod line_rasterization;
pub mod maintenance1;
pub mod maintenance3;
pub mod maintenance4;
Expand Down

0 comments on commit 6cd3df3

Please sign in to comment.