Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use raw pointers to static-sized arrays in FFI signatures #353

Merged
merged 1 commit into from
Jan 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions ash/src/vk/extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18507,7 +18507,7 @@ pub type PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR = extern "system" fn(
pub type PFN_vkCmdSetFragmentShadingRateKHR = extern "system" fn(
command_buffer: CommandBuffer,
p_fragment_size: *const Extent2D,
combiner_ops: &[FragmentShadingRateCombinerOpKHR; 2],
combiner_ops: *const [FragmentShadingRateCombinerOpKHR; 2],
) -> c_void;
pub struct KhrFragmentShadingRateFn {
pub get_physical_device_fragment_shading_rates_khr: extern "system" fn(
Expand All @@ -18518,7 +18518,7 @@ pub struct KhrFragmentShadingRateFn {
pub cmd_set_fragment_shading_rate_khr: extern "system" fn(
command_buffer: CommandBuffer,
p_fragment_size: *const Extent2D,
combiner_ops: &[FragmentShadingRateCombinerOpKHR; 2],
combiner_ops: *const [FragmentShadingRateCombinerOpKHR; 2],
) -> c_void,
}
unsafe impl Send for KhrFragmentShadingRateFn {}
Expand Down Expand Up @@ -18562,7 +18562,7 @@ impl KhrFragmentShadingRateFn {
extern "system" fn cmd_set_fragment_shading_rate_khr(
_command_buffer: CommandBuffer,
_p_fragment_size: *const Extent2D,
_combiner_ops: &[FragmentShadingRateCombinerOpKHR; 2],
_combiner_ops: *const [FragmentShadingRateCombinerOpKHR; 2],
) -> c_void {
panic!(concat!(
"Unable to load ",
Expand Down Expand Up @@ -18598,7 +18598,7 @@ impl KhrFragmentShadingRateFn {
&self,
command_buffer: CommandBuffer,
p_fragment_size: *const Extent2D,
combiner_ops: &[FragmentShadingRateCombinerOpKHR; 2],
combiner_ops: *const [FragmentShadingRateCombinerOpKHR; 2],
) -> c_void {
(self.cmd_set_fragment_shading_rate_khr)(command_buffer, p_fragment_size, combiner_ops)
}
Expand Down Expand Up @@ -23477,13 +23477,13 @@ impl NvFragmentShadingRateEnumsFn {
pub type PFN_vkCmdSetFragmentShadingRateEnumNV = extern "system" fn(
command_buffer: CommandBuffer,
shading_rate: FragmentShadingRateNV,
combiner_ops: &[FragmentShadingRateCombinerOpKHR; 2],
combiner_ops: *const [FragmentShadingRateCombinerOpKHR; 2],
) -> c_void;
pub struct NvFragmentShadingRateEnumsFn {
pub cmd_set_fragment_shading_rate_enum_nv: extern "system" fn(
command_buffer: CommandBuffer,
shading_rate: FragmentShadingRateNV,
combiner_ops: &[FragmentShadingRateCombinerOpKHR; 2],
combiner_ops: *const [FragmentShadingRateCombinerOpKHR; 2],
) -> c_void,
}
unsafe impl Send for NvFragmentShadingRateEnumsFn {}
Expand All @@ -23505,7 +23505,7 @@ impl NvFragmentShadingRateEnumsFn {
extern "system" fn cmd_set_fragment_shading_rate_enum_nv(
_command_buffer: CommandBuffer,
_shading_rate: FragmentShadingRateNV,
_combiner_ops: &[FragmentShadingRateCombinerOpKHR; 2],
_combiner_ops: *const [FragmentShadingRateCombinerOpKHR; 2],
) -> c_void {
panic!(concat!(
"Unable to load ",
Expand All @@ -23528,7 +23528,7 @@ impl NvFragmentShadingRateEnumsFn {
&self,
command_buffer: CommandBuffer,
shading_rate: FragmentShadingRateNV,
combiner_ops: &[FragmentShadingRateCombinerOpKHR; 2],
combiner_ops: *const [FragmentShadingRateCombinerOpKHR; 2],
) -> c_void {
(self.cmd_set_fragment_shading_rate_enum_nv)(command_buffer, shading_rate, combiner_ops)
}
Expand Down
12 changes: 7 additions & 5 deletions ash/src/vk/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ pub type PFN_vkCmdSetDepthBias = extern "system" fn(
) -> c_void;
#[allow(non_camel_case_types)]
pub type PFN_vkCmdSetBlendConstants =
extern "system" fn(command_buffer: CommandBuffer, blend_constants: &[f32; 4]) -> c_void;
extern "system" fn(command_buffer: CommandBuffer, blend_constants: *const [f32; 4]) -> c_void;
#[allow(non_camel_case_types)]
pub type PFN_vkCmdSetDepthBounds = extern "system" fn(
command_buffer: CommandBuffer,
Expand Down Expand Up @@ -1972,8 +1972,10 @@ pub struct DeviceFnV1_0 {
depth_bias_clamp: f32,
depth_bias_slope_factor: f32,
) -> c_void,
pub cmd_set_blend_constants:
extern "system" fn(command_buffer: CommandBuffer, blend_constants: &[f32; 4]) -> c_void,
pub cmd_set_blend_constants: extern "system" fn(
command_buffer: CommandBuffer,
blend_constants: *const [f32; 4],
) -> c_void,
pub cmd_set_depth_bounds: extern "system" fn(
command_buffer: CommandBuffer,
min_depth_bounds: f32,
Expand Down Expand Up @@ -3841,7 +3843,7 @@ impl DeviceFnV1_0 {
cmd_set_blend_constants: unsafe {
extern "system" fn cmd_set_blend_constants(
_command_buffer: CommandBuffer,
_blend_constants: &[f32; 4],
_blend_constants: *const [f32; 4],
) -> c_void {
panic!(concat!(
"Unable to load ",
Expand Down Expand Up @@ -5410,7 +5412,7 @@ impl DeviceFnV1_0 {
pub unsafe fn cmd_set_blend_constants(
&self,
command_buffer: CommandBuffer,
blend_constants: &[f32; 4],
blend_constants: *const [f32; 4],
) -> c_void {
(self.cmd_set_blend_constants)(command_buffer, blend_constants)
}
Expand Down
2 changes: 1 addition & 1 deletion generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ impl FieldExt for vkxml::Field {
let size: TokenStream = constant_name(size).parse().unwrap();
// arrays in c are always passed as a pointer
if is_ffi_param {
quote!(&[#ty; #size])
quote!(*const [#ty; #size])
} else {
quote!([#ty; #size])
}
Expand Down