extensions/ext: Add VK_EXT_extended_dynamic_state2 (#572)

This commit is contained in:
Marijn Suijten 2022-01-29 21:39:48 +01:00 committed by GitHub
parent 89ca1d03f4
commit b7aff3b432
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 79 additions and 0 deletions

View file

@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Added `VK_EXT_extended_dynamic_state2` device extension (#572)
- Added `VK_KHR_copy_commands2` device extension (#571)
- Added `VK_EXT_private_data` device extension (#570)
- Added conversions from `Extent2D` to `Extent3D` and `Rect2D` (#557)

View file

@ -0,0 +1,76 @@
use crate::vk;
use crate::{Device, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_EXT_extended_dynamic_state2.html>
#[derive(Clone)]
pub struct ExtendedDynamicState2 {
fp: vk::ExtExtendedDynamicState2Fn,
}
impl ExtendedDynamicState2 {
pub fn new(instance: &Instance, device: &Device) -> Self {
let fp = vk::ExtExtendedDynamicState2Fn::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/vkCmdSetPatchControlPointsEXT.html>
pub unsafe fn cmd_set_patch_control_points(
&self,
command_buffer: vk::CommandBuffer,
patch_control_points: u32,
) {
self.fp
.cmd_set_patch_control_points_ext(command_buffer, patch_control_points)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetRasterizerDiscardEnableEXT.html>
pub unsafe fn cmd_set_rasterizer_discard_enable(
&self,
command_buffer: vk::CommandBuffer,
rasterizer_discard_enable: bool,
) {
self.fp
.cmd_set_rasterizer_discard_enable_ext(command_buffer, rasterizer_discard_enable.into())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthBiasEnableEXT.html>
pub unsafe fn cmd_set_depth_bias_enable(
&self,
command_buffer: vk::CommandBuffer,
depth_bias_enable: bool,
) {
self.fp
.cmd_set_depth_bias_enable_ext(command_buffer, depth_bias_enable.into())
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetLogicOpEXT.html>
pub unsafe fn cmd_set_logic_op(
&self,
command_buffer: vk::CommandBuffer,
logic_op: vk::LogicOp,
) {
self.fp.cmd_set_logic_op_ext(command_buffer, logic_op)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetPrimitiveRestartEnableEXT.html>
pub unsafe fn cmd_set_primitive_restart_enable(
&self,
command_buffer: vk::CommandBuffer,
primitive_restart_enable: bool,
) {
self.fp
.cmd_set_primitive_restart_enable_ext(command_buffer, primitive_restart_enable.into())
}
pub fn name() -> &'static CStr {
vk::ExtExtendedDynamicState2Fn::name()
}
pub fn fp(&self) -> &vk::ExtExtendedDynamicState2Fn {
&self.fp
}
}

View file

@ -6,6 +6,7 @@ pub use self::debug_marker::DebugMarker;
pub use self::debug_report::DebugReport;
pub use self::debug_utils::DebugUtils;
pub use self::extended_dynamic_state::ExtendedDynamicState;
pub use self::extended_dynamic_state2::ExtendedDynamicState2;
pub use self::full_screen_exclusive::FullScreenExclusive;
pub use self::metal_surface::MetalSurface;
pub use self::physical_device_drm::PhysicalDeviceDrm;
@ -20,6 +21,7 @@ mod debug_marker;
mod debug_report;
mod debug_utils;
mod extended_dynamic_state;
mod extended_dynamic_state2;
mod full_screen_exclusive;
mod metal_surface;
mod physical_device_drm;