-
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.
- Loading branch information
Showing
267 changed files
with
2,433 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ edition = "2021" | |
[dependencies] | ||
roxmltree = "0.19" | ||
tracing = "0.1" | ||
indexmap = "2" |
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
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,46 @@ | ||
use self::structures::Structure; | ||
use crate::{xml::UnwrapBorrowed, Library, LibraryId}; | ||
use indexmap::IndexMap; | ||
use std::collections::HashMap; | ||
|
||
pub mod structures; | ||
|
||
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] | ||
pub struct Origin { | ||
pub library_id: LibraryId, | ||
pub required_by: RequiredBy, | ||
} | ||
|
||
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] | ||
pub enum RequiredBy { | ||
Feature { major: u32, minor: u32 }, | ||
Extension { name: &'static str }, | ||
} | ||
|
||
#[derive(Default, Debug)] | ||
pub struct Items { | ||
pub structures: IndexMap<&'static str, Structure>, | ||
} | ||
|
||
impl Items { | ||
pub(super) fn collect( | ||
&mut self, | ||
library: &Library, | ||
types_require_map: HashMap<&str, RequiredBy>, | ||
) { | ||
for structure in &library.xml.structs { | ||
let name = structure.name.unwrap_borrowed(); | ||
let Some(&required_by) = types_require_map.get(name) else { | ||
continue; | ||
}; | ||
|
||
let origin = Origin { | ||
library_id: library.id, | ||
required_by, | ||
}; | ||
|
||
let structure = Structure::new(origin, structure); | ||
assert!(self.structures.insert(name, structure).is_none()); | ||
} | ||
} | ||
} |
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,17 @@ | ||
use super::Origin; | ||
use crate::xml::{self, UnwrapBorrowed}; | ||
|
||
#[derive(Debug)] | ||
pub struct Structure { | ||
pub origin: Origin, | ||
pub name: &'static str, | ||
} | ||
|
||
impl Structure { | ||
pub fn new(origin: Origin, xml: &xml::Structure) -> Structure { | ||
Structure { | ||
origin, | ||
name: xml.name.unwrap_borrowed(), | ||
} | ||
} | ||
} |
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,38 +1,129 @@ | ||
mod xml; | ||
pub mod cdecl; | ||
pub mod items; | ||
pub mod xml; | ||
|
||
use std::{fs, path::Path}; | ||
use items::{Items, RequiredBy}; | ||
use std::{ | ||
collections::HashMap, | ||
fmt::{self, Display}, | ||
fs, | ||
path::{Path, PathBuf}, | ||
}; | ||
use tracing::{debug, error_span}; | ||
use xml::UnwrapBorrowed; | ||
|
||
#[derive(Debug)] | ||
pub struct Analysis { | ||
pub vk: Library, | ||
pub video: Library, | ||
vk: Library, | ||
video: Library, | ||
items: Items, | ||
} | ||
|
||
impl Analysis { | ||
pub fn new(vulkan_headers_path: impl AsRef<Path>) -> Analysis { | ||
let vk = Library::new(LibraryId::Vk, &vulkan_headers_path); | ||
let video = Library::new(LibraryId::Video, &vulkan_headers_path); | ||
|
||
let mut items = Items::default(); | ||
vk.collect_into(&mut items); | ||
video.collect_into(&mut items); | ||
|
||
Analysis { vk, video, items } | ||
} | ||
|
||
pub fn vk_xml(&self) -> &xml::Registry { | ||
&self.vk.xml | ||
} | ||
|
||
pub fn video_xml(&self) -> &xml::Registry { | ||
&self.video.xml | ||
} | ||
|
||
pub fn items(&self) -> &Items { | ||
&self.items | ||
} | ||
} | ||
|
||
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] | ||
pub enum LibraryId { | ||
Vk, | ||
Video, | ||
} | ||
|
||
impl LibraryId { | ||
fn xml_path(&self, vulkan_headers_path: impl AsRef<Path>) -> PathBuf { | ||
let vulkan_headers_path = vulkan_headers_path.as_ref(); | ||
Analysis { | ||
vk: Library::new(vulkan_headers_path.join("registry/vk.xml")), | ||
video: Library::new(vulkan_headers_path.join("registry/video.xml")), | ||
match self { | ||
LibraryId::Vk => vulkan_headers_path.join("registry/vk.xml"), | ||
LibraryId::Video => vulkan_headers_path.join("registry/video.xml"), | ||
} | ||
} | ||
} | ||
|
||
impl Display for LibraryId { | ||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | ||
formatter.write_str(match self { | ||
LibraryId::Vk => "vk", | ||
LibraryId::Video => "video", | ||
}) | ||
} | ||
} | ||
|
||
#[derive(Debug)] | ||
pub struct Library { | ||
_xml: xml::Registry, | ||
id: LibraryId, | ||
xml: xml::Registry, | ||
} | ||
|
||
impl Library { | ||
fn new(xml_path: impl AsRef<Path>) -> Library { | ||
let xml = error_span!("xml", path = %xml_path.as_ref().display()).in_scope(|| { | ||
fn new(id: LibraryId, vulkan_headers_path: impl AsRef<Path>) -> Library { | ||
let xml = error_span!("xml", library_id = %id).in_scope(|| { | ||
let path = id.xml_path(vulkan_headers_path); | ||
// We leak the input string here for convenience, to avoid explicit lifetimes. | ||
let xml_input = Box::leak(fs::read_to_string(xml_path).unwrap().into_boxed_str()); | ||
let input = Box::leak(fs::read_to_string(path).unwrap().into_boxed_str()); | ||
debug!("parsing xml"); | ||
xml::Registry::parse(xml_input, "vulkan") | ||
xml::Registry::parse(input, "vulkan") | ||
}); | ||
|
||
Library { _xml: xml } | ||
Library { id, xml } | ||
} | ||
|
||
pub fn id(&self) -> LibraryId { | ||
self.id | ||
} | ||
|
||
pub fn xml(&self) -> &xml::Registry { | ||
&self.xml | ||
} | ||
|
||
fn collect_into(&self, items: &mut Items) { | ||
let mut types_require_map = HashMap::new(); | ||
|
||
for feature in &self.xml.features { | ||
let required_by = RequiredBy::Feature { | ||
major: feature.major, | ||
minor: feature.minor, | ||
}; | ||
|
||
for require in &feature.requires { | ||
for require_type in &require.types { | ||
types_require_map.insert(require_type.name.unwrap_borrowed(), required_by); | ||
} | ||
} | ||
} | ||
|
||
for extension in &self.xml.extensions { | ||
let required_by = RequiredBy::Extension { | ||
name: extension.name.unwrap_borrowed(), | ||
}; | ||
|
||
for require in &extension.requires { | ||
for require_type in &require.types { | ||
types_require_map.insert(require_type.name.unwrap_borrowed(), required_by); | ||
} | ||
} | ||
} | ||
|
||
items.collect(self, types_require_map); | ||
} | ||
} |
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
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,3 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub mod video; | ||
pub mod vk; |
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,9 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub struct StdVideoH264SpsVuiFlags; | ||
pub struct StdVideoH264HrdParameters; | ||
pub struct StdVideoH264SequenceParameterSetVui; | ||
pub struct StdVideoH264SpsFlags; | ||
pub struct StdVideoH264ScalingLists; | ||
pub struct StdVideoH264SequenceParameterSet; | ||
pub struct StdVideoH264PpsFlags; | ||
pub struct StdVideoH264PictureParameterSet; |
5 changes: 5 additions & 0 deletions
5
ash-rewrite/src/generated/video/extension/codec_h264std_decode.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,5 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub struct StdVideoDecodeH264PictureInfoFlags; | ||
pub struct StdVideoDecodeH264PictureInfo; | ||
pub struct StdVideoDecodeH264ReferenceInfoFlags; | ||
pub struct StdVideoDecodeH264ReferenceInfo; |
13 changes: 13 additions & 0 deletions
13
ash-rewrite/src/generated/video/extension/codec_h264std_encode.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,13 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub struct StdVideoEncodeH264WeightTableFlags; | ||
pub struct StdVideoEncodeH264WeightTable; | ||
pub struct StdVideoEncodeH264SliceHeaderFlags; | ||
pub struct StdVideoEncodeH264PictureInfoFlags; | ||
pub struct StdVideoEncodeH264ReferenceInfoFlags; | ||
pub struct StdVideoEncodeH264ReferenceListsInfoFlags; | ||
pub struct StdVideoEncodeH264RefListModEntry; | ||
pub struct StdVideoEncodeH264RefPicMarkingEntry; | ||
pub struct StdVideoEncodeH264ReferenceListsInfo; | ||
pub struct StdVideoEncodeH264PictureInfo; | ||
pub struct StdVideoEncodeH264ReferenceInfo; | ||
pub struct StdVideoEncodeH264SliceHeader; |
20 changes: 20 additions & 0 deletions
20
ash-rewrite/src/generated/video/extension/codec_h265std.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,20 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub struct StdVideoH265ProfileTierLevelFlags; | ||
pub struct StdVideoH265ProfileTierLevel; | ||
pub struct StdVideoH265DecPicBufMgr; | ||
pub struct StdVideoH265SubLayerHrdParameters; | ||
pub struct StdVideoH265HrdFlags; | ||
pub struct StdVideoH265HrdParameters; | ||
pub struct StdVideoH265VpsFlags; | ||
pub struct StdVideoH265VideoParameterSet; | ||
pub struct StdVideoH265ScalingLists; | ||
pub struct StdVideoH265ShortTermRefPicSetFlags; | ||
pub struct StdVideoH265ShortTermRefPicSet; | ||
pub struct StdVideoH265LongTermRefPicsSps; | ||
pub struct StdVideoH265SpsVuiFlags; | ||
pub struct StdVideoH265SequenceParameterSetVui; | ||
pub struct StdVideoH265PredictorPaletteEntries; | ||
pub struct StdVideoH265SpsFlags; | ||
pub struct StdVideoH265SequenceParameterSet; | ||
pub struct StdVideoH265PpsFlags; | ||
pub struct StdVideoH265PictureParameterSet; |
5 changes: 5 additions & 0 deletions
5
ash-rewrite/src/generated/video/extension/codec_h265std_decode.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,5 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub struct StdVideoDecodeH265PictureInfoFlags; | ||
pub struct StdVideoDecodeH265PictureInfo; | ||
pub struct StdVideoDecodeH265ReferenceInfoFlags; | ||
pub struct StdVideoDecodeH265ReferenceInfo; |
12 changes: 12 additions & 0 deletions
12
ash-rewrite/src/generated/video/extension/codec_h265std_encode.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,12 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub struct StdVideoEncodeH265WeightTableFlags; | ||
pub struct StdVideoEncodeH265WeightTable; | ||
pub struct StdVideoEncodeH265LongTermRefPics; | ||
pub struct StdVideoEncodeH265SliceSegmentHeaderFlags; | ||
pub struct StdVideoEncodeH265SliceSegmentHeader; | ||
pub struct StdVideoEncodeH265ReferenceListsInfoFlags; | ||
pub struct StdVideoEncodeH265ReferenceListsInfo; | ||
pub struct StdVideoEncodeH265PictureInfoFlags; | ||
pub struct StdVideoEncodeH265PictureInfo; | ||
pub struct StdVideoEncodeH265ReferenceInfoFlags; | ||
pub struct StdVideoEncodeH265ReferenceInfo; |
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,19 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub mod codec_h264std; | ||
pub mod codec_h264std_decode; | ||
pub mod codec_h264std_encode; | ||
pub mod codec_h265std; | ||
pub mod codec_h265std_decode; | ||
pub mod codec_h265std_encode; | ||
#[doc(no_inline)] | ||
pub use codec_h264std::*; | ||
#[doc(no_inline)] | ||
pub use codec_h264std_decode::*; | ||
#[doc(no_inline)] | ||
pub use codec_h264std_encode::*; | ||
#[doc(no_inline)] | ||
pub use codec_h265std::*; | ||
#[doc(no_inline)] | ||
pub use codec_h265std_decode::*; | ||
#[doc(no_inline)] | ||
pub use codec_h265std_encode::*; |
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,4 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub mod extension; | ||
#[doc(no_inline)] | ||
pub use extension::*; |
2 changes: 2 additions & 0 deletions
2
ash-rewrite/src/generated/vk/extension/amd_device_coherent_memory.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,2 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub struct VkPhysicalDeviceCoherentMemoryFeaturesAMD; |
3 changes: 3 additions & 0 deletions
3
ash-rewrite/src/generated/vk/extension/amd_display_native_hdr.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,3 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub struct VkDisplayNativeHdrSurfaceCapabilitiesAMD; | ||
pub struct VkSwapchainDisplayNativeHdrCreateInfoAMD; |
2 changes: 2 additions & 0 deletions
2
ash-rewrite/src/generated/vk/extension/amd_memory_overallocation_behavior.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,2 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub struct VkDeviceMemoryOverallocationCreateInfoAMD; |
2 changes: 2 additions & 0 deletions
2
ash-rewrite/src/generated/vk/extension/amd_pipeline_compiler_control.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,2 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub struct VkPipelineCompilerControlCreateInfoAMD; |
2 changes: 2 additions & 0 deletions
2
ash-rewrite/src/generated/vk/extension/amd_rasterization_order.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,2 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub struct VkPipelineRasterizationStateRasterizationOrderAMD; |
2 changes: 2 additions & 0 deletions
2
ash-rewrite/src/generated/vk/extension/amd_shader_core_properties.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,2 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub struct VkPhysicalDeviceShaderCorePropertiesAMD; |
2 changes: 2 additions & 0 deletions
2
ash-rewrite/src/generated/vk/extension/amd_shader_core_properties2.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,2 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub struct VkPhysicalDeviceShaderCoreProperties2AMD; |
2 changes: 2 additions & 0 deletions
2
ash-rewrite/src/generated/vk/extension/amd_shader_early_and_late_fragment_tests.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,2 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub struct VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD; |
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,3 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub struct VkShaderResourceUsageAMD; | ||
pub struct VkShaderStatisticsInfoAMD; |
2 changes: 2 additions & 0 deletions
2
ash-rewrite/src/generated/vk/extension/amd_texture_gather_bias_lod.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,2 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub struct VkTextureLODGatherFormatPropertiesAMD; |
8 changes: 8 additions & 0 deletions
8
ash-rewrite/src/generated/vk/extension/amdx_shader_enqueue.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,8 @@ | ||
// DO NOT EDIT: @generated by ash generator-rewrite 2.0.0 | ||
pub struct VkPhysicalDeviceShaderEnqueuePropertiesAMDX; | ||
pub struct VkPhysicalDeviceShaderEnqueueFeaturesAMDX; | ||
pub struct VkExecutionGraphPipelineCreateInfoAMDX; | ||
pub struct VkPipelineShaderStageNodeCreateInfoAMDX; | ||
pub struct VkExecutionGraphPipelineScratchSizeAMDX; | ||
pub struct VkDispatchGraphInfoAMDX; | ||
pub struct VkDispatchGraphCountInfoAMDX; |
Oops, something went wrong.