Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extensions/khr: Add VK_KHR_line_rasterization extension #889

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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