Skip to main content

jay_ash/extensions/ext/
extended_dynamic_state.rs

1//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_extended_dynamic_state.html>
2
3use crate::vk;
4use core::ptr;
5
6impl crate::ext::extended_dynamic_state::Device {
7    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdSetCullModeEXT.html>
8    #[inline]
9    pub unsafe fn cmd_set_cull_mode(
10        &self,
11        command_buffer: vk::CommandBuffer,
12        cull_mode: vk::CullModeFlags,
13    ) {
14        unsafe { (self.fp.cmd_set_cull_mode_ext)(command_buffer, cull_mode) }
15    }
16
17    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdSetFrontFaceEXT.html>
18    #[inline]
19    pub unsafe fn cmd_set_front_face(
20        &self,
21        command_buffer: vk::CommandBuffer,
22        front_face: vk::FrontFace,
23    ) {
24        unsafe { (self.fp.cmd_set_front_face_ext)(command_buffer, front_face) }
25    }
26
27    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdSetPrimitiveTopologyEXT.html>
28    #[inline]
29    pub unsafe fn cmd_set_primitive_topology(
30        &self,
31        command_buffer: vk::CommandBuffer,
32        primitive_topology: vk::PrimitiveTopology,
33    ) {
34        unsafe { (self.fp.cmd_set_primitive_topology_ext)(command_buffer, primitive_topology) }
35    }
36
37    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdSetViewportWithCountEXT.html>
38    #[inline]
39    pub unsafe fn cmd_set_viewport_with_count(
40        &self,
41        command_buffer: vk::CommandBuffer,
42        viewports: &[vk::Viewport],
43    ) {
44        unsafe {
45            (self.fp.cmd_set_viewport_with_count_ext)(
46                command_buffer,
47                viewports.len() as u32,
48                viewports.as_ptr(),
49            )
50        }
51    }
52
53    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdSetScissorWithCountEXT.html>
54    #[inline]
55    pub unsafe fn cmd_set_scissor_with_count(
56        &self,
57        command_buffer: vk::CommandBuffer,
58        scissors: &[vk::Rect2D],
59    ) {
60        unsafe {
61            (self.fp.cmd_set_scissor_with_count_ext)(
62                command_buffer,
63                scissors.len() as u32,
64                scissors.as_ptr(),
65            )
66        }
67    }
68
69    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdBindVertexBuffers2EXT.html>
70    #[inline]
71    pub unsafe fn cmd_bind_vertex_buffers2(
72        &self,
73        command_buffer: vk::CommandBuffer,
74        first_binding: u32,
75        buffers: &[vk::Buffer],
76        offsets: &[vk::DeviceSize],
77        sizes: Option<&[vk::DeviceSize]>,
78        strides: Option<&[vk::DeviceSize]>,
79    ) {
80        unsafe {
81            assert_eq!(offsets.len(), buffers.len());
82            let p_sizes = if let Some(sizes) = sizes {
83                assert_eq!(sizes.len(), buffers.len());
84                sizes.as_ptr()
85            } else {
86                ptr::null()
87            };
88            let p_strides = if let Some(strides) = strides {
89                assert_eq!(strides.len(), buffers.len());
90                strides.as_ptr()
91            } else {
92                ptr::null()
93            };
94            (self.fp.cmd_bind_vertex_buffers2_ext)(
95                command_buffer,
96                first_binding,
97                buffers.len() as u32,
98                buffers.as_ptr(),
99                offsets.as_ptr(),
100                p_sizes,
101                p_strides,
102            )
103        }
104    }
105
106    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthTestEnableEXT.html>
107    #[inline]
108    pub unsafe fn cmd_set_depth_test_enable(
109        &self,
110        command_buffer: vk::CommandBuffer,
111        depth_test_enable: bool,
112    ) {
113        unsafe { (self.fp.cmd_set_depth_test_enable_ext)(command_buffer, depth_test_enable.into()) }
114    }
115
116    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthWriteEnableEXT.html>
117    #[inline]
118    pub unsafe fn cmd_set_depth_write_enable(
119        &self,
120        command_buffer: vk::CommandBuffer,
121        depth_write_enable: bool,
122    ) {
123        unsafe {
124            (self.fp.cmd_set_depth_write_enable_ext)(command_buffer, depth_write_enable.into())
125        }
126    }
127
128    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthCompareOpEXT.html>
129    #[inline]
130    pub unsafe fn cmd_set_depth_compare_op(
131        &self,
132        command_buffer: vk::CommandBuffer,
133        depth_compare_op: vk::CompareOp,
134    ) {
135        unsafe { (self.fp.cmd_set_depth_compare_op_ext)(command_buffer, depth_compare_op) }
136    }
137
138    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthBoundsTestEnableEXT.html>
139    #[inline]
140    pub unsafe fn cmd_set_depth_bounds_test_enable(
141        &self,
142        command_buffer: vk::CommandBuffer,
143        depth_bounds_test_enable: bool,
144    ) {
145        unsafe {
146            (self.fp.cmd_set_depth_bounds_test_enable_ext)(
147                command_buffer,
148                depth_bounds_test_enable.into(),
149            )
150        }
151    }
152
153    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdSetStencilTestEnableEXT.html>
154    #[inline]
155    pub unsafe fn cmd_set_stencil_test_enable(
156        &self,
157        command_buffer: vk::CommandBuffer,
158        stencil_test_enable: bool,
159    ) {
160        unsafe {
161            (self.fp.cmd_set_stencil_test_enable_ext)(command_buffer, stencil_test_enable.into())
162        }
163    }
164
165    /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdSetStencilOpEXT.html>
166    #[inline]
167    pub unsafe fn cmd_set_stencil_op(
168        &self,
169        command_buffer: vk::CommandBuffer,
170        face_mask: vk::StencilFaceFlags,
171        fail_op: vk::StencilOp,
172        pass_op: vk::StencilOp,
173        depth_fail_op: vk::StencilOp,
174        compare_op: vk::CompareOp,
175    ) {
176        unsafe {
177            (self.fp.cmd_set_stencil_op_ext)(
178                command_buffer,
179                face_mask,
180                fail_op,
181                pass_op,
182                depth_fail_op,
183                compare_op,
184            )
185        }
186    }
187}