extensions/nv: Add VK_NV_device_generated_commands_compute (#781)

This commit is contained in:
Marijn Suijten 2023-08-14 16:42:57 +02:00 committed by GitHub
parent b91c2aac92
commit 3fa908c70a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 74 additions and 0 deletions

View file

@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `VK_AMDX_shader_enqueue` device extension (#776) - Added `VK_AMDX_shader_enqueue` device extension (#776)
- Added `VK_EXT_host_image_copy` device extension (#779) - Added `VK_EXT_host_image_copy` device extension (#779)
- Added `VK_KHR_maintenance5` device extension (#780) - Added `VK_KHR_maintenance5` device extension (#780)
- Added `VK_NV_device_generated_commands_compute` device extension (#781)
### Changed ### Changed

View file

@ -0,0 +1,71 @@
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_NV_device_generated_commands_compute.html>
#[derive(Clone)]
pub struct DeviceGeneratedCommandsCompute {
handle: vk::Device,
fp: vk::NvDeviceGeneratedCommandsComputeFn,
}
impl DeviceGeneratedCommandsCompute {
pub fn new(instance: &Instance, device: &Device) -> Self {
let handle = device.handle();
let fp = vk::NvDeviceGeneratedCommandsComputeFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))
});
Self { handle, fp }
}
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPipelineIndirectMemoryRequirementsNV.html>
#[inline]
pub unsafe fn get_pipeline_indirect_memory_requirements(
&self,
create_info: &vk::ComputePipelineCreateInfo,
memory_requirements: &mut vk::MemoryRequirements2,
) {
(self.fp.get_pipeline_indirect_memory_requirements_nv)(
self.handle,
create_info,
memory_requirements,
)
}
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdUpdatePipelineIndirectBufferNV.html>
#[inline]
pub unsafe fn cmd_update_pipeline_indirect_buffer(
&self,
command_buffer: vk::CommandBuffer,
pipeline_bind_point: vk::PipelineBindPoint,
pipeline: vk::Pipeline,
) {
(self.fp.cmd_update_pipeline_indirect_buffer_nv)(
command_buffer,
pipeline_bind_point,
pipeline,
)
}
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPipelineIndirectDeviceAddressNV.html>
#[inline]
pub unsafe fn get_pipeline_indirect_device_address(
&self,
info: &vk::PipelineIndirectDeviceAddressInfoNV,
) -> vk::DeviceAddress {
(self.fp.get_pipeline_indirect_device_address_nv)(self.handle, info)
}
pub const NAME: &'static CStr = vk::NvDeviceGeneratedCommandsComputeFn::NAME;
#[inline]
pub fn fp(&self) -> &vk::NvDeviceGeneratedCommandsComputeFn {
&self.fp
}
#[inline]
pub fn device(&self) -> vk::Device {
self.handle
}
}

View file

@ -1,11 +1,13 @@
pub use self::coverage_reduction_mode::CoverageReductionMode; pub use self::coverage_reduction_mode::CoverageReductionMode;
pub use self::device_diagnostic_checkpoints::DeviceDiagnosticCheckpoints; pub use self::device_diagnostic_checkpoints::DeviceDiagnosticCheckpoints;
pub use self::device_generated_commands_compute::DeviceGeneratedCommandsCompute;
pub use self::memory_decompression::MemoryDecompression; pub use self::memory_decompression::MemoryDecompression;
pub use self::mesh_shader::MeshShader; pub use self::mesh_shader::MeshShader;
pub use self::ray_tracing::RayTracing; pub use self::ray_tracing::RayTracing;
mod coverage_reduction_mode; mod coverage_reduction_mode;
mod device_diagnostic_checkpoints; mod device_diagnostic_checkpoints;
mod device_generated_commands_compute;
mod memory_decompression; mod memory_decompression;
mod mesh_shader; mod mesh_shader;
mod ray_tracing; mod ray_tracing;