diff --git a/Changelog.md b/Changelog.md index 44cf6d9bd..70e59cdb5 100644 --- a/Changelog.md +++ b/Changelog.md @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added `VK_KHR_device_group` device extension (#631) - Added `VK_EXT_mesh_shader` device extension (#657) - Added `VK_EXT_acquire_drm_display` instance extension (#668) +- Added `VK_EXT_extended_dynamic_state3` device extension (#671) ### Removed diff --git a/ash/src/extensions/ext/extended_dynamic_state3.rs b/ash/src/extensions/ext/extended_dynamic_state3.rs new file mode 100644 index 000000000..4ae1c849f --- /dev/null +++ b/ash/src/extensions/ext/extended_dynamic_state3.rs @@ -0,0 +1,405 @@ +use crate::vk; +use crate::{Device, Instance}; +use std::ffi::CStr; +use std::mem; + +/// +#[derive(Clone)] +pub struct ExtendedDynamicState3 { + fp: vk::ExtExtendedDynamicState3Fn, +} + +impl ExtendedDynamicState3 { + pub fn new(instance: &Instance, device: &Device) -> Self { + let fp = vk::ExtExtendedDynamicState3Fn::load(|name| unsafe { + mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) + }); + Self { fp } + } + + /// + #[inline] + pub unsafe fn cmd_set_tessellation_domain_origin( + &self, + command_buffer: vk::CommandBuffer, + domain_origin: vk::TessellationDomainOrigin, + ) { + (self.fp.cmd_set_tessellation_domain_origin_ext)(command_buffer, domain_origin) + } + + /// + #[inline] + pub unsafe fn cmd_set_depth_clamp_enable( + &self, + command_buffer: vk::CommandBuffer, + depth_clamp_enable: bool, + ) { + (self.fp.cmd_set_depth_clamp_enable_ext)(command_buffer, depth_clamp_enable.into()) + } + + /// + #[inline] + pub unsafe fn cmd_set_polygon_mode( + &self, + command_buffer: vk::CommandBuffer, + polygon_mode: vk::PolygonMode, + ) { + (self.fp.cmd_set_polygon_mode_ext)(command_buffer, polygon_mode) + } + + /// + #[inline] + pub unsafe fn cmd_set_rasterization_samples( + &self, + command_buffer: vk::CommandBuffer, + rasterization_samples: vk::SampleCountFlags, + ) { + (self.fp.cmd_set_rasterization_samples_ext)(command_buffer, rasterization_samples) + } + + /// + #[inline] + pub unsafe fn cmd_set_sample_mask( + &self, + command_buffer: vk::CommandBuffer, + samples: vk::SampleCountFlags, + sample_mask: &[vk::SampleMask], + ) { + assert_eq!((samples.as_raw() as usize + 31) / 32, sample_mask.len()); + (self.fp.cmd_set_sample_mask_ext)(command_buffer, samples, sample_mask.as_ptr()) + } + + /// + #[inline] + pub unsafe fn cmd_set_alpha_to_coverage_enable( + &self, + command_buffer: vk::CommandBuffer, + alpha_to_coverage_enable: bool, + ) { + (self.fp.cmd_set_alpha_to_coverage_enable_ext)( + command_buffer, + alpha_to_coverage_enable.into(), + ) + } + + /// + #[inline] + pub unsafe fn cmd_set_alpha_to_one_enable( + &self, + command_buffer: vk::CommandBuffer, + alpha_to_one_enable: bool, + ) { + (self.fp.cmd_set_alpha_to_one_enable_ext)(command_buffer, alpha_to_one_enable.into()) + } + + /// + #[inline] + pub unsafe fn cmd_set_logic_op_enable( + &self, + command_buffer: vk::CommandBuffer, + logic_op_enable: bool, + ) { + (self.fp.cmd_set_logic_op_enable_ext)(command_buffer, logic_op_enable.into()) + } + + /// + #[inline] + pub unsafe fn cmd_set_color_blend_enable( + &self, + command_buffer: vk::CommandBuffer, + first_attachment: u32, + color_blend_enables: &[vk::Bool32], + ) { + (self.fp.cmd_set_color_blend_enable_ext)( + command_buffer, + first_attachment, + color_blend_enables.len() as u32, + color_blend_enables.as_ptr(), + ) + } + + /// + #[inline] + pub unsafe fn cmd_set_color_blend_equation( + &self, + command_buffer: vk::CommandBuffer, + first_attachment: u32, + color_blend_equations: &[vk::ColorBlendEquationEXT], + ) { + (self.fp.cmd_set_color_blend_equation_ext)( + command_buffer, + first_attachment, + color_blend_equations.len() as u32, + color_blend_equations.as_ptr(), + ) + } + + /// + #[inline] + pub unsafe fn cmd_set_color_write_mask( + &self, + command_buffer: vk::CommandBuffer, + first_attachment: u32, + color_write_masks: &[vk::ColorComponentFlags], + ) { + (self.fp.cmd_set_color_write_mask_ext)( + command_buffer, + first_attachment, + color_write_masks.len() as u32, + color_write_masks.as_ptr(), + ) + } + + /// + #[inline] + pub unsafe fn cmd_set_rasterization_stream( + &self, + command_buffer: vk::CommandBuffer, + rasterization_stream: u32, + ) { + (self.fp.cmd_set_rasterization_stream_ext)(command_buffer, rasterization_stream) + } + + /// + #[inline] + pub unsafe fn cmd_set_conservative_rasterization_mode( + &self, + command_buffer: vk::CommandBuffer, + conservative_rasterization_mode: vk::ConservativeRasterizationModeEXT, + ) { + (self.fp.cmd_set_conservative_rasterization_mode_ext)( + command_buffer, + conservative_rasterization_mode, + ) + } + + /// + #[inline] + pub unsafe fn cmd_set_extra_primitive_overestimation_size( + &self, + command_buffer: vk::CommandBuffer, + extra_primitive_overestimation_size: f32, + ) { + (self.fp.cmd_set_extra_primitive_overestimation_size_ext)( + command_buffer, + extra_primitive_overestimation_size, + ) + } + + /// + #[inline] + pub unsafe fn cmd_set_depth_clip_enable( + &self, + command_buffer: vk::CommandBuffer, + depth_clip_enable: bool, + ) { + (self.fp.cmd_set_depth_clip_enable_ext)(command_buffer, depth_clip_enable.into()) + } + + /// + #[inline] + pub unsafe fn cmd_set_sample_locations_enable( + &self, + command_buffer: vk::CommandBuffer, + sample_locations_enable: bool, + ) { + (self.fp.cmd_set_sample_locations_enable_ext)( + command_buffer, + sample_locations_enable.into(), + ) + } + + /// + #[inline] + pub unsafe fn cmd_set_color_blend_advanced( + &self, + command_buffer: vk::CommandBuffer, + first_attachment: u32, + color_blend_advanced: &[vk::ColorBlendAdvancedEXT], + ) { + (self.fp.cmd_set_color_blend_advanced_ext)( + command_buffer, + first_attachment, + color_blend_advanced.len() as u32, + color_blend_advanced.as_ptr(), + ) + } + + /// + #[inline] + pub unsafe fn cmd_set_provoking_vertex_mode( + &self, + command_buffer: vk::CommandBuffer, + provoking_vertex_mode: vk::ProvokingVertexModeEXT, + ) { + (self.fp.cmd_set_provoking_vertex_mode_ext)(command_buffer, provoking_vertex_mode) + } + + /// + #[inline] + pub unsafe fn cmd_set_line_rasterization_mode( + &self, + command_buffer: vk::CommandBuffer, + line_rasterization_mode: vk::LineRasterizationModeEXT, + ) { + (self.fp.cmd_set_line_rasterization_mode_ext)(command_buffer, line_rasterization_mode) + } + + /// + #[inline] + pub unsafe fn cmd_set_line_stipple_enable( + &self, + command_buffer: vk::CommandBuffer, + stippled_line_enable: bool, + ) { + (self.fp.cmd_set_line_stipple_enable_ext)(command_buffer, stippled_line_enable.into()) + } + + /// + #[inline] + pub unsafe fn cmd_set_depth_clip_negative_one_to_one( + &self, + command_buffer: vk::CommandBuffer, + negative_one_to_one: bool, + ) { + (self.fp.cmd_set_depth_clip_negative_one_to_one_ext)( + command_buffer, + negative_one_to_one.into(), + ) + } + + /// + #[inline] + pub unsafe fn cmd_set_viewport_w_scaling_enable_nv( + &self, + command_buffer: vk::CommandBuffer, + viewport_w_scaling_enable: bool, + ) { + (self.fp.cmd_set_viewport_w_scaling_enable_nv)( + command_buffer, + viewport_w_scaling_enable.into(), + ) + } + + /// + #[inline] + pub unsafe fn cmd_set_viewport_swizzle_nv( + &self, + command_buffer: vk::CommandBuffer, + first_attachment: u32, + viewport_swizzles: &[vk::ViewportSwizzleNV], + ) { + (self.fp.cmd_set_viewport_swizzle_nv)( + command_buffer, + first_attachment, + viewport_swizzles.len() as u32, + viewport_swizzles.as_ptr(), + ) + } + + /// + #[inline] + pub unsafe fn cmd_set_coverage_to_color_enable_nv( + &self, + command_buffer: vk::CommandBuffer, + coverage_to_color_enable: bool, + ) { + (self.fp.cmd_set_coverage_to_color_enable_nv)( + command_buffer, + coverage_to_color_enable.into(), + ) + } + + /// + #[inline] + pub unsafe fn cmd_set_coverage_to_color_location_nv( + &self, + command_buffer: vk::CommandBuffer, + coverage_to_color_location: u32, + ) { + (self.fp.cmd_set_coverage_to_color_location_nv)(command_buffer, coverage_to_color_location) + } + + /// + #[inline] + pub unsafe fn cmd_set_coverage_modulation_mode_nv( + &self, + command_buffer: vk::CommandBuffer, + coverage_modulation_mode: vk::CoverageModulationModeNV, + ) { + (self.fp.cmd_set_coverage_modulation_mode_nv)(command_buffer, coverage_modulation_mode) + } + + /// + #[inline] + pub unsafe fn cmd_set_coverage_modulation_table_enable_nv( + &self, + command_buffer: vk::CommandBuffer, + coverage_modulation_table_enable: bool, + ) { + (self.fp.cmd_set_coverage_modulation_table_enable_nv)( + command_buffer, + coverage_modulation_table_enable.into(), + ) + } + + /// + #[inline] + pub unsafe fn cmd_set_coverage_modulation_table_nv( + &self, + command_buffer: vk::CommandBuffer, + coverage_modulation_table: &[f32], + ) { + (self.fp.cmd_set_coverage_modulation_table_nv)( + command_buffer, + coverage_modulation_table.len() as u32, + coverage_modulation_table.as_ptr(), + ) + } + + /// + #[inline] + pub unsafe fn cmd_set_shading_rate_image_enable_nv( + &self, + command_buffer: vk::CommandBuffer, + shading_rate_image_enable: bool, + ) { + (self.fp.cmd_set_shading_rate_image_enable_nv)( + command_buffer, + shading_rate_image_enable.into(), + ) + } + + /// + #[inline] + pub unsafe fn cmd_set_representative_fragment_test_enable_nv( + &self, + command_buffer: vk::CommandBuffer, + representative_fragment_test_enable: bool, + ) { + (self.fp.cmd_set_representative_fragment_test_enable_nv)( + command_buffer, + representative_fragment_test_enable.into(), + ) + } + + /// + #[inline] + pub unsafe fn cmd_set_coverage_reduction_mode_nv( + &self, + command_buffer: vk::CommandBuffer, + coverage_reduction_mode: vk::CoverageReductionModeNV, + ) { + (self.fp.cmd_set_coverage_reduction_mode_nv)(command_buffer, coverage_reduction_mode) + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtExtendedDynamicState3Fn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtExtendedDynamicState3Fn { + &self.fp + } +} diff --git a/ash/src/extensions/ext/mod.rs b/ash/src/extensions/ext/mod.rs index 5b2170b6c..4e53e9568 100644 --- a/ash/src/extensions/ext/mod.rs +++ b/ash/src/extensions/ext/mod.rs @@ -8,6 +8,7 @@ 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::extended_dynamic_state3::ExtendedDynamicState3; pub use self::full_screen_exclusive::FullScreenExclusive; pub use self::headless_surface::HeadlessSurface; pub use self::image_compression_control::ImageCompressionControl; @@ -29,6 +30,7 @@ mod debug_report; mod debug_utils; mod extended_dynamic_state; mod extended_dynamic_state2; +mod extended_dynamic_state3; mod full_screen_exclusive; mod headless_surface; mod image_compression_control;