-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extensions/nv: Add VK_NV_device_generated_commands_compute
- Loading branch information
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
ash/src/extensions/nv/device_generated_commands_compute.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
pub use self::coverage_reduction_mode::CoverageReductionMode; | ||
pub use self::device_diagnostic_checkpoints::DeviceDiagnosticCheckpoints; | ||
pub use self::device_generated_commands_compute::DeviceGeneratedCommandsCompute; | ||
pub use self::memory_decompression::MemoryDecompression; | ||
pub use self::mesh_shader::MeshShader; | ||
pub use self::ray_tracing::RayTracing; | ||
|
||
mod coverage_reduction_mode; | ||
mod device_diagnostic_checkpoints; | ||
mod device_generated_commands_compute; | ||
mod memory_decompression; | ||
mod mesh_shader; | ||
mod ray_tracing; |