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 Jul 1, 2022
1 parent a1d2d09 commit e794296
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `VK_NV_coverage_reduction_mode` device extension (#617)
- Added `VK_KHR_ray_tracing_maintenance1` device extension (#620)
- Added `VK_EXT_image_compression_control` device extension (#621)
- Added `VK_EXT_pipeline_properties` device extension (#622)
- Added new functions to `VK_KHR_swapchain`, available since Vulkan 1.1 (#629)
- Added `VK_KHR_device_group_creation` instance extension (#630)
- Added `VK_KHR_device_group` device extension (#631)
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 @@ -13,6 +13,7 @@ pub use self::image_compression_control::ImageCompressionControl;
pub use self::image_drm_format_modifier::ImageDrmFormatModifier;
pub use self::metal_surface::MetalSurface;
pub use self::physical_device_drm::PhysicalDeviceDrm;
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 @@ -32,6 +33,7 @@ mod image_compression_control;
mod image_drm_format_modifier;
mod metal_surface;
mod physical_device_drm;
mod pipeline_properties;
mod private_data;
mod sample_locations;
mod tooling_info;
52 changes: 52 additions & 0 deletions ash/src/extensions/ext/pipeline_properties.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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>
///
/// TODO: Currently only accepts [`vk::PipelinePropertiesIdentifierEXT`]
#[inline]
pub unsafe fn get_pipeline_properties(
&self,
pipeline_info: &vk::PipelineInfoEXT,
// TODO: https://github.com/krolli/vk-parse/pull/24
pipeline_properties: *mut vk::BaseOutStructure,
) -> VkResult<()> {
todo!("https://github.com/krolli/vk-parse/pull/24")
// (self.fp.get_pipeline_properties_ext)(self.handle, pipeline_info, pipeline_properties)
// .result()
}

#[inline]
pub const fn 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 e794296

Please sign in to comment.