Skip to content

Commit

Permalink
Standardize on direct fp table access in wrapper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralith committed Mar 22, 2022
1 parent 1016571 commit f0a0f86
Showing 1 changed file with 41 additions and 37 deletions.
78 changes: 41 additions & 37 deletions ash/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Device {
allocation_callbacks: Option<&vk::AllocationCallbacks>,
) -> VkResult<vk::PrivateDataSlot> {
let mut private_data_slot = mem::zeroed();
(self.fp_v1_3().create_private_data_slot)(
(self.device_fn_1_3.create_private_data_slot)(
self.handle,
create_info,
allocation_callbacks.as_raw_ptr(),
Expand All @@ -67,7 +67,7 @@ impl Device {
private_data_slot: vk::PrivateDataSlot,
allocation_callbacks: Option<&vk::AllocationCallbacks>,
) {
(self.fp_v1_3().destroy_private_data_slot)(
(self.device_fn_1_3.destroy_private_data_slot)(
self.handle,
private_data_slot,
allocation_callbacks.as_raw_ptr(),
Expand All @@ -81,7 +81,7 @@ impl Device {
private_data_slot: vk::PrivateDataSlot,
data: u64,
) -> VkResult<()> {
(self.fp_v1_3().set_private_data)(
(self.device_fn_1_3.set_private_data)(
self.handle,
T::TYPE,
object.as_raw(),
Expand All @@ -98,7 +98,7 @@ impl Device {
private_data_slot: vk::PrivateDataSlot,
) -> u64 {
let mut data = mem::zeroed();
(self.fp_v1_3().get_private_data)(
(self.device_fn_1_3.get_private_data)(
self.handle,
T::TYPE,
object.as_raw(),
Expand All @@ -114,7 +114,7 @@ impl Device {
command_buffer: vk::CommandBuffer,
dependency_info: &vk::DependencyInfo,
) {
(self.fp_v1_3().cmd_pipeline_barrier2)(command_buffer, dependency_info)
(self.device_fn_1_3.cmd_pipeline_barrier2)(command_buffer, dependency_info)
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdResetEvent2.html>
Expand All @@ -124,7 +124,7 @@ impl Device {
event: vk::Event,
stage_mask: vk::PipelineStageFlags2,
) {
(self.fp_v1_3().cmd_reset_event2)(command_buffer, event, stage_mask)
(self.device_fn_1_3.cmd_reset_event2)(command_buffer, event, stage_mask)
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetEvent2.html>
Expand All @@ -134,7 +134,7 @@ impl Device {
event: vk::Event,
dependency_info: &vk::DependencyInfo,
) {
(self.fp_v1_3().cmd_set_event2)(command_buffer, event, dependency_info)
(self.device_fn_1_3.cmd_set_event2)(command_buffer, event, dependency_info)
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdWaitEvents2.html>
Expand All @@ -145,7 +145,7 @@ impl Device {
dependency_infos: &[vk::DependencyInfo],
) {
assert_eq!(events.len(), dependency_infos.len());
(self.fp_v1_3().cmd_wait_events2)(
(self.device_fn_1_3.cmd_wait_events2)(
command_buffer,
events.len() as u32,
events.as_ptr(),
Expand All @@ -161,7 +161,7 @@ impl Device {
query_pool: vk::QueryPool,
query: u32,
) {
(self.fp_v1_3().cmd_write_timestamp2)(command_buffer, stage, query_pool, query)
(self.device_fn_1_3.cmd_write_timestamp2)(command_buffer, stage, query_pool, query)
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkQueueSubmit2.html>
Expand All @@ -171,7 +171,7 @@ impl Device {
submits: &[vk::SubmitInfo2],
fence: vk::Fence,
) -> VkResult<()> {
(self.fp_v1_3().queue_submit2)(queue, submits.len() as u32, submits.as_ptr(), fence)
(self.device_fn_1_3.queue_submit2)(queue, submits.len() as u32, submits.as_ptr(), fence)
.result()
}

Expand All @@ -181,47 +181,47 @@ impl Device {
command_buffer: vk::CommandBuffer,
copy_buffer_info: &vk::CopyBufferInfo2,
) {
(self.fp_v1_3().cmd_copy_buffer2)(command_buffer, copy_buffer_info)
(self.device_fn_1_3.cmd_copy_buffer2)(command_buffer, copy_buffer_info)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyImage2.html>
pub unsafe fn cmd_copy_image2(
&self,
command_buffer: vk::CommandBuffer,
copy_image_info: &vk::CopyImageInfo2,
) {
(self.fp_v1_3().cmd_copy_image2)(command_buffer, copy_image_info)
(self.device_fn_1_3.cmd_copy_image2)(command_buffer, copy_image_info)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyBufferToImage2.html>
pub unsafe fn cmd_copy_buffer_to_image2(
&self,
command_buffer: vk::CommandBuffer,
copy_buffer_to_image_info: &vk::CopyBufferToImageInfo2,
) {
(self.fp_v1_3().cmd_copy_buffer_to_image2)(command_buffer, copy_buffer_to_image_info)
(self.device_fn_1_3.cmd_copy_buffer_to_image2)(command_buffer, copy_buffer_to_image_info)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyImageToBuffer2.html>
pub unsafe fn cmd_copy_image_to_buffer2(
&self,
command_buffer: vk::CommandBuffer,
copy_image_to_buffer_info: &vk::CopyImageToBufferInfo2,
) {
(self.fp_v1_3().cmd_copy_image_to_buffer2)(command_buffer, copy_image_to_buffer_info)
(self.device_fn_1_3.cmd_copy_image_to_buffer2)(command_buffer, copy_image_to_buffer_info)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBlitImage2.html>
pub unsafe fn cmd_blit_image2(
&self,
command_buffer: vk::CommandBuffer,
blit_image_info: &vk::BlitImageInfo2,
) {
(self.fp_v1_3().cmd_blit_image2)(command_buffer, blit_image_info)
(self.device_fn_1_3.cmd_blit_image2)(command_buffer, blit_image_info)
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdResolveImage2.html>
pub unsafe fn cmd_resolve_image2(
&self,
command_buffer: vk::CommandBuffer,
resolve_image_info: &vk::ResolveImageInfo2,
) {
(self.fp_v1_3().cmd_resolve_image2)(command_buffer, resolve_image_info)
(self.device_fn_1_3.cmd_resolve_image2)(command_buffer, resolve_image_info)
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBeginRendering.html>
Expand All @@ -230,12 +230,12 @@ impl Device {
command_buffer: vk::CommandBuffer,
rendering_info: &vk::RenderingInfo,
) {
(self.fp_v1_3().cmd_begin_rendering)(command_buffer, rendering_info)
(self.device_fn_1_3.cmd_begin_rendering)(command_buffer, rendering_info)
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdEndRendering.html>
pub unsafe fn cmd_end_rendering(&self, command_buffer: vk::CommandBuffer) {
(self.fp_v1_3().cmd_end_rendering)(command_buffer)
(self.device_fn_1_3.cmd_end_rendering)(command_buffer)
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCullMode.html>
Expand All @@ -244,7 +244,7 @@ impl Device {
command_buffer: vk::CommandBuffer,
cull_mode: vk::CullModeFlags,
) {
(self.fp_v1_3().cmd_set_cull_mode)(command_buffer, cull_mode)
(self.device_fn_1_3.cmd_set_cull_mode)(command_buffer, cull_mode)
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetFrontFace.html>
Expand All @@ -253,7 +253,7 @@ impl Device {
command_buffer: vk::CommandBuffer,
front_face: vk::FrontFace,
) {
(self.fp_v1_3().cmd_set_front_face)(command_buffer, front_face)
(self.device_fn_1_3.cmd_set_front_face)(command_buffer, front_face)
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetPrimitiveTopology.html>
Expand All @@ -262,7 +262,7 @@ impl Device {
command_buffer: vk::CommandBuffer,
primitive_topology: vk::PrimitiveTopology,
) {
(self.fp_v1_3().cmd_set_primitive_topology)(command_buffer, primitive_topology)
(self.device_fn_1_3.cmd_set_primitive_topology)(command_buffer, primitive_topology)
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetViewportWithCount.html>
Expand All @@ -271,7 +271,7 @@ impl Device {
command_buffer: vk::CommandBuffer,
viewports: &[vk::Viewport],
) {
(self.fp_v1_3().cmd_set_viewport_with_count)(
(self.device_fn_1_3.cmd_set_viewport_with_count)(
command_buffer,
viewports.len() as u32,
viewports.as_ptr(),
Expand All @@ -284,7 +284,7 @@ impl Device {
command_buffer: vk::CommandBuffer,
scissors: &[vk::Rect2D],
) {
(self.fp_v1_3().cmd_set_scissor_with_count)(
(self.device_fn_1_3.cmd_set_scissor_with_count)(
command_buffer,
scissors.len() as u32,
scissors.as_ptr(),
Expand Down Expand Up @@ -314,7 +314,7 @@ impl Device {
} else {
ptr::null()
};
(self.fp_v1_3().cmd_bind_vertex_buffers2)(
(self.device_fn_1_3.cmd_bind_vertex_buffers2)(
command_buffer,
first_binding,
buffers.len() as u32,
Expand All @@ -331,7 +331,7 @@ impl Device {
command_buffer: vk::CommandBuffer,
depth_test_enable: bool,
) {
(self.fp_v1_3().cmd_set_depth_test_enable)(command_buffer, depth_test_enable.into())
(self.device_fn_1_3.cmd_set_depth_test_enable)(command_buffer, depth_test_enable.into())
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthWriteEnable.html>
Expand All @@ -340,7 +340,7 @@ impl Device {
command_buffer: vk::CommandBuffer,
depth_write_enable: bool,
) {
(self.fp_v1_3().cmd_set_depth_write_enable)(command_buffer, depth_write_enable.into())
(self.device_fn_1_3.cmd_set_depth_write_enable)(command_buffer, depth_write_enable.into())
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthCompareOp.html>
Expand All @@ -349,7 +349,7 @@ impl Device {
command_buffer: vk::CommandBuffer,
depth_compare_op: vk::CompareOp,
) {
(self.fp_v1_3().cmd_set_depth_compare_op)(command_buffer, depth_compare_op)
(self.device_fn_1_3.cmd_set_depth_compare_op)(command_buffer, depth_compare_op)
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthBoundsTestEnable.html>
Expand All @@ -358,7 +358,7 @@ impl Device {
command_buffer: vk::CommandBuffer,
depth_bounds_test_enable: bool,
) {
(self.fp_v1_3().cmd_set_depth_bounds_test_enable)(
(self.device_fn_1_3.cmd_set_depth_bounds_test_enable)(
command_buffer,
depth_bounds_test_enable.into(),
)
Expand All @@ -370,7 +370,7 @@ impl Device {
command_buffer: vk::CommandBuffer,
stencil_test_enable: bool,
) {
(self.fp_v1_3().cmd_set_stencil_test_enable)(command_buffer, stencil_test_enable.into())
(self.device_fn_1_3.cmd_set_stencil_test_enable)(command_buffer, stencil_test_enable.into())
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetStencilOp.html>
Expand All @@ -383,7 +383,7 @@ impl Device {
depth_fail_op: vk::StencilOp,
compare_op: vk::CompareOp,
) {
(self.fp_v1_3().cmd_set_stencil_op)(
(self.device_fn_1_3.cmd_set_stencil_op)(
command_buffer,
face_mask,
fail_op,
Expand All @@ -399,7 +399,7 @@ impl Device {
command_buffer: vk::CommandBuffer,
rasterizer_discard_enable: bool,
) {
(self.fp_v1_3().cmd_set_rasterizer_discard_enable)(
(self.device_fn_1_3.cmd_set_rasterizer_discard_enable)(
command_buffer,
rasterizer_discard_enable.into(),
)
Expand All @@ -411,7 +411,7 @@ impl Device {
command_buffer: vk::CommandBuffer,
depth_bias_enable: bool,
) {
(self.fp_v1_3().cmd_set_depth_bias_enable)(command_buffer, depth_bias_enable.into())
(self.device_fn_1_3.cmd_set_depth_bias_enable)(command_buffer, depth_bias_enable.into())
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetPrimitiveRestartEnable.html>
Expand All @@ -420,7 +420,7 @@ impl Device {
command_buffer: vk::CommandBuffer,
primitive_restart_enable: bool,
) {
(self.fp_v1_3().cmd_set_primitive_restart_enable)(
(self.device_fn_1_3.cmd_set_primitive_restart_enable)(
command_buffer,
primitive_restart_enable.into(),
)
Expand All @@ -432,7 +432,7 @@ impl Device {
create_info: &vk::DeviceBufferMemoryRequirements,
out: &mut vk::MemoryRequirements2,
) {
(self.fp_v1_3().get_device_buffer_memory_requirements)(self.handle, create_info, out)
(self.device_fn_1_3.get_device_buffer_memory_requirements)(self.handle, create_info, out)
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceImageMemoryRequirements.html>
Expand All @@ -441,7 +441,7 @@ impl Device {
create_info: &vk::DeviceImageMemoryRequirements,
out: &mut vk::MemoryRequirements2,
) {
(self.fp_v1_3().get_device_image_memory_requirements)(self.handle, create_info, out)
(self.device_fn_1_3.get_device_image_memory_requirements)(self.handle, create_info, out)
}

/// Retrieve the number of elements to pass to [`get_device_image_sparse_memory_requirements()`][Self::get_device_image_sparse_memory_requirements()]
Expand All @@ -450,7 +450,9 @@ impl Device {
create_info: &vk::DeviceImageMemoryRequirements,
) -> usize {
let mut count = 0;
(self.fp_v1_3().get_device_image_sparse_memory_requirements)(
(self
.device_fn_1_3
.get_device_image_sparse_memory_requirements)(
self.handle,
create_info,
&mut count,
Expand All @@ -469,7 +471,9 @@ impl Device {
out: &mut [vk::SparseImageMemoryRequirements2],
) {
let mut count = out.len() as u32;
(self.fp_v1_3().get_device_image_sparse_memory_requirements)(
(self
.device_fn_1_3
.get_device_image_sparse_memory_requirements)(
self.handle,
create_info,
&mut count,
Expand Down

0 comments on commit f0a0f86

Please sign in to comment.