Skip to content

Commit

Permalink
generator: Handle <command> via vk-parse types and nom (#719)
Browse files Browse the repository at this point in the history
For the upcoming `api` attribute in `vk.xml` commands also need to be
processed through `vk-parse` which has support for all the new
attributes, while `vkxml` is deprecated and completely untouched for
years.  This conversion unfortunately requires whipping up yet another
quick-and-dirty `nom` parser of a specific subset of C used in `vk.xml`
to describe parameter signatures.  This PR shows that conversion is
complete and provides no accidental semantic differences.

Also update `vk-parse` to `0.9` which contains a new `code` field on
`CommandParam` (`<param>` element) to be able to inspect the code
signature of individual parameters rather than parsing them out of (and
matching them back to `vk-parse`'s `params` array!) the `<command>`
/ `CommandDefinition` as a whole:
krolli/vk-parse#25 (comment)
krolli/vk-parse@615ffb6
  • Loading branch information
MarijnS95 committed Apr 2, 2023
1 parent 449ef2f commit 5d130cb
Show file tree
Hide file tree
Showing 4 changed files with 224 additions and 114 deletions.
8 changes: 4 additions & 4 deletions ash/src/vk/extensions.rs
Expand Up @@ -13331,7 +13331,7 @@ pub type PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR = unsafe extern "system"
pub type PFN_vkCmdSetFragmentShadingRateKHR = unsafe extern "system" fn(
command_buffer: CommandBuffer,
p_fragment_size: *const Extent2D,
combiner_ops: *const [FragmentShadingRateCombinerOpKHR; 2],
combiner_ops: *const [FragmentShadingRateCombinerOpKHR; 2usize],
);
#[derive(Clone)]
pub struct KhrFragmentShadingRateFn {
Expand Down Expand Up @@ -13372,7 +13372,7 @@ impl KhrFragmentShadingRateFn {
unsafe extern "system" fn cmd_set_fragment_shading_rate_khr(
_command_buffer: CommandBuffer,
_p_fragment_size: *const Extent2D,
_combiner_ops: *const [FragmentShadingRateCombinerOpKHR; 2],
_combiner_ops: *const [FragmentShadingRateCombinerOpKHR; 2usize],
) {
panic!(concat!(
"Unable to load ",
Expand Down Expand Up @@ -18058,7 +18058,7 @@ impl NvFragmentShadingRateEnumsFn {
pub type PFN_vkCmdSetFragmentShadingRateEnumNV = unsafe extern "system" fn(
command_buffer: CommandBuffer,
shading_rate: FragmentShadingRateNV,
combiner_ops: *const [FragmentShadingRateCombinerOpKHR; 2],
combiner_ops: *const [FragmentShadingRateCombinerOpKHR; 2usize],
);
#[derive(Clone)]
pub struct NvFragmentShadingRateEnumsFn {
Expand All @@ -18076,7 +18076,7 @@ impl NvFragmentShadingRateEnumsFn {
unsafe extern "system" fn cmd_set_fragment_shading_rate_enum_nv(
_command_buffer: CommandBuffer,
_shading_rate: FragmentShadingRateNV,
_combiner_ops: *const [FragmentShadingRateCombinerOpKHR; 2],
_combiner_ops: *const [FragmentShadingRateCombinerOpKHR; 2usize],
) {
panic!(concat!(
"Unable to load ",
Expand Down
4 changes: 2 additions & 2 deletions ash/src/vk/features.rs
Expand Up @@ -999,7 +999,7 @@ pub type PFN_vkCmdSetDepthBias = unsafe extern "system" fn(
);
#[allow(non_camel_case_types)]
pub type PFN_vkCmdSetBlendConstants =
unsafe extern "system" fn(command_buffer: CommandBuffer, blend_constants: *const [f32; 4]);
unsafe extern "system" fn(command_buffer: CommandBuffer, blend_constants: *const [f32; 4usize]);
#[allow(non_camel_case_types)]
pub type PFN_vkCmdSetDepthBounds = unsafe extern "system" fn(
command_buffer: CommandBuffer,
Expand Down Expand Up @@ -2876,7 +2876,7 @@ impl DeviceFnV1_0 {
cmd_set_blend_constants: unsafe {
unsafe extern "system" fn cmd_set_blend_constants(
_command_buffer: CommandBuffer,
_blend_constants: *const [f32; 4],
_blend_constants: *const [f32; 4usize],
) {
panic!(concat!(
"Unable to load ",
Expand Down
2 changes: 1 addition & 1 deletion generator/Cargo.toml
Expand Up @@ -13,7 +13,7 @@ once_cell = "1.7"
proc-macro2 = "1.0"
quote = "1.0"
regex = "1.4"
vk-parse = { version = "0.7", features = ["vkxml-convert"] }
vk-parse = { version = "0.9", features = ["vkxml-convert"] }
vkxml = "0.3"

[dependencies.syn]
Expand Down

0 comments on commit 5d130cb

Please sign in to comment.