extensions/khr: Add VK_KHR_sampler_ycbcr_conversion (#785)
This commit is contained in:
parent
43d4a68ab2
commit
5a9d779eef
|
@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Added `VK_NV_device_generated_commands_compute` device extension (#781)
|
- Added `VK_NV_device_generated_commands_compute` device extension (#781)
|
||||||
- Added `VK_KHR_cooperative_matrix` instance extension (#782)
|
- Added `VK_KHR_cooperative_matrix` instance extension (#782)
|
||||||
- Added `VK_EXT_vertex_input_dynamic_state` device extension (#784)
|
- Added `VK_EXT_vertex_input_dynamic_state` device extension (#784)
|
||||||
|
- Added `VK_KHR_sampler_ycbcr_conversion` device extension (#785)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ pub use self::present_wait::PresentWait;
|
||||||
pub use self::push_descriptor::PushDescriptor;
|
pub use self::push_descriptor::PushDescriptor;
|
||||||
pub use self::ray_tracing_maintenance1::RayTracingMaintenance1;
|
pub use self::ray_tracing_maintenance1::RayTracingMaintenance1;
|
||||||
pub use self::ray_tracing_pipeline::RayTracingPipeline;
|
pub use self::ray_tracing_pipeline::RayTracingPipeline;
|
||||||
|
pub use self::sampler_ycbcr_conversion::SamplerYcbcrConversion;
|
||||||
pub use self::surface::Surface;
|
pub use self::surface::Surface;
|
||||||
pub use self::swapchain::Swapchain;
|
pub use self::swapchain::Swapchain;
|
||||||
pub use self::synchronization2::Synchronization2;
|
pub use self::synchronization2::Synchronization2;
|
||||||
|
@ -71,6 +72,7 @@ mod present_wait;
|
||||||
mod push_descriptor;
|
mod push_descriptor;
|
||||||
mod ray_tracing_maintenance1;
|
mod ray_tracing_maintenance1;
|
||||||
mod ray_tracing_pipeline;
|
mod ray_tracing_pipeline;
|
||||||
|
mod sampler_ycbcr_conversion;
|
||||||
mod surface;
|
mod surface;
|
||||||
mod swapchain;
|
mod swapchain;
|
||||||
mod synchronization2;
|
mod synchronization2;
|
||||||
|
|
66
ash/src/extensions/khr/sampler_ycbcr_conversion.rs
Normal file
66
ash/src/extensions/khr/sampler_ycbcr_conversion.rs
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
use crate::prelude::*;
|
||||||
|
use crate::vk;
|
||||||
|
use crate::RawPtr;
|
||||||
|
use crate::{Device, Instance};
|
||||||
|
use std::ffi::CStr;
|
||||||
|
use std::mem;
|
||||||
|
|
||||||
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_sampler_ycbcr_conversion.html>
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct SamplerYcbcrConversion {
|
||||||
|
handle: vk::Device,
|
||||||
|
fp: vk::KhrSamplerYcbcrConversionFn,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SamplerYcbcrConversion {
|
||||||
|
pub fn new(instance: &Instance, device: &Device) -> Self {
|
||||||
|
let handle = device.handle();
|
||||||
|
let fp = vk::KhrSamplerYcbcrConversionFn::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/vkCreateSamplerYcbcrConversion.html>
|
||||||
|
#[inline]
|
||||||
|
pub unsafe fn create_sampler_ycbcr_conversion(
|
||||||
|
&self,
|
||||||
|
create_info: &vk::SamplerYcbcrConversionCreateInfo,
|
||||||
|
allocation_callbacks: Option<&vk::AllocationCallbacks>,
|
||||||
|
) -> VkResult<vk::SamplerYcbcrConversion> {
|
||||||
|
let mut ycbcr_conversion = mem::zeroed();
|
||||||
|
(self.fp.create_sampler_ycbcr_conversion_khr)(
|
||||||
|
self.handle,
|
||||||
|
create_info,
|
||||||
|
allocation_callbacks.as_raw_ptr(),
|
||||||
|
&mut ycbcr_conversion,
|
||||||
|
)
|
||||||
|
.result_with_success(ycbcr_conversion)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroySamplerYcbcrConversion.html>
|
||||||
|
#[inline]
|
||||||
|
pub unsafe fn destroy_sampler_ycbcr_conversion(
|
||||||
|
&self,
|
||||||
|
ycbcr_conversion: vk::SamplerYcbcrConversion,
|
||||||
|
allocation_callbacks: Option<&vk::AllocationCallbacks>,
|
||||||
|
) {
|
||||||
|
(self.fp.destroy_sampler_ycbcr_conversion_khr)(
|
||||||
|
self.handle,
|
||||||
|
ycbcr_conversion,
|
||||||
|
allocation_callbacks.as_raw_ptr(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const NAME: &'static CStr = vk::KhrSamplerYcbcrConversionFn::NAME;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn fp(&self) -> &vk::KhrSamplerYcbcrConversionFn {
|
||||||
|
&self.fp
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn device(&self) -> vk::Device {
|
||||||
|
self.handle
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue