Skip to content

Commit

Permalink
extensions/ext: Add VK_EXT_pipeline_properties device extension
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Apr 2, 2023
1 parent f98cab4 commit 2022b4f
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Update Vulkan-Headers to 1.3.244 (#697)
- Added `VK_EXT_pipeline_properties` device extension (#622)

### Changed

Expand Down
2 changes: 2 additions & 0 deletions ash/src/extensions/ext/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub use self::image_compression_control::ImageCompressionControl;
pub use self::image_drm_format_modifier::ImageDrmFormatModifier;
pub use self::mesh_shader::MeshShader;
pub use self::metal_surface::MetalSurface;
pub use self::pipeline_properties::PipelineProperties;
pub use self::private_data::PrivateData;
pub use self::sample_locations::SampleLocations;
pub use self::tooling_info::ToolingInfo;
Expand All @@ -38,6 +39,7 @@ mod image_compression_control;
mod image_drm_format_modifier;
mod mesh_shader;
mod metal_surface;
mod pipeline_properties;
mod private_data;
mod sample_locations;
mod tooling_info;
47 changes: 47 additions & 0 deletions ash/src/extensions/ext/pipeline_properties.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
use crate::prelude::*;
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_pipeline_properties.html>
#[derive(Clone)]
pub struct PipelineProperties {
handle: vk::Device,
fp: vk::ExtPipelinePropertiesFn,
}

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

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPipelinePropertiesEXT.html>
///
/// Currently only accepts [`vk::PipelinePropertiesIdentifierEXT`].
#[inline]
pub unsafe fn get_pipeline_properties(
&self,
pipeline_info: &vk::PipelineInfoEXT,
pipeline_properties: *mut vk::BaseOutStructure,
) -> VkResult<()> {
(self.fp.get_pipeline_properties_ext)(self.handle, pipeline_info, pipeline_properties)
.result()
}

pub const NAME: &'static CStr = vk::ExtPipelinePropertiesFn::NAME;

#[inline]
pub fn fp(&self) -> &vk::ExtPipelinePropertiesFn {
&self.fp
}

#[inline]
pub fn device(&self) -> vk::Device {
self.handle
}
}

0 comments on commit 2022b4f

Please sign in to comment.