diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a4ddd2c..6dc1451 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -23,10 +23,7 @@ jobs: cache-on-failure: true workspaces: | shader-reflect - spirq-as - spirq-core - spirq-dis - spirq-spvasm + spirq - name: Cargo Format id: cargo_format @@ -60,10 +57,3 @@ jobs: cargo run -p shader-reflect assets/spirv-spec.frag.spv -o assets/spirv-spec.frag.spv.json diff assets/spirv-spec.frag.json assets/spirv-spec.frag.spv.json cargo run -p shader-reflect assets/moon.spv -o assets/moon.spv.json --reference-all-resources - - - name: Assemble Disassemble Roundtrip - id: cargo_build_and_test - run: | - cargo run -p spirq-as assets/gallery.frag.spvasm -o assets/gallery.frag.spv - cargo run -p spirq-dis assets/gallery.frag.spv -o assets/gallery.frag.spvasm --no-indent - echo git diff --exit-code --binary diff --git a/CHANGELOG.md b/CHANGELOG.md index 44562cc..4452c3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## v1.2.0 + +- Separated `spirq-` family of subcrates to [`spq`](https://github.com/PENGUINLIONG/spq-rs) + + ## v1.1.2 - Fixed compatibility with `spirv` v0.3. (#130) diff --git a/Cargo.lock b/Cargo.lock index 5dc94e4..3a9f41a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -129,7 +129,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -159,12 +159,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - [[package]] name = "equivalent" version = "1.0.1" @@ -212,13 +206,14 @@ dependencies = [ [[package]] name = "inline-spirv" -version = "0.1.6" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b167f7553467c596aa5a432ea130dce4da07f44f40c60251b2369904663eceb3" +checksum = "c31c5529150e569a0abf53803f304dc3329570ccb11da01719e3be7d28405ea6" dependencies = [ "quote", "shaderc", - "syn 1.0.109", + "spirq-spvasm", + "syn", ] [[package]] @@ -247,7 +242,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -270,13 +265,12 @@ dependencies = [ ] [[package]] -name = "pretty_assertions" -version = "1.4.0" +name = "ordered-float" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +checksum = "a76df7075c7d4d01fdcb46c912dd17fba5b60c78ea480b475f2b6ab6f666584e" dependencies = [ - "diff", - "yansi", + "num-traits", ] [[package]] @@ -320,7 +314,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn", ] [[package]] @@ -343,7 +337,7 @@ dependencies = [ "serde", "serde_json", "shaderc", - "spirq", + "spirq 1.1.3", ] [[package]] @@ -376,50 +370,48 @@ dependencies = [ "inline-spirv", "num-derive", "num-traits", - "ordered-float", - "spirq-core", + "ordered-float 4.2.0", + "spq-core", ] [[package]] -name = "spirq-as" -version = "0.1.4" +name = "spirq" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "007c5d8eaa031ad723894e38ca47819fbf76889ef5fd047cc86882b565355f52" dependencies = [ - "anyhow", - "clap", - "spirq-spvasm", + "fnv", + "num-derive", + "num-traits", + "ordered-float 3.9.2", + "spirq-core", ] [[package]] name = "spirq-core" version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aedd7eaf8571f35732bdbfc38b42cf25329aadd1c85abb6fb1cc30af466b98b" dependencies = [ "anyhow", "bytemuck", "fnv", "half", "num-traits", - "ordered-float", + "ordered-float 3.9.2", "spirv", ] -[[package]] -name = "spirq-dis" -version = "0.1.4" -dependencies = [ - "anyhow", - "clap", - "spirq-spvasm", -] - [[package]] name = "spirq-spvasm" version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0941c46a5b2c9d26f899f8e63a727c3e4cafb54e14d98166e68ea6b5e8400f53" dependencies = [ "anyhow", "half", "num-traits", - "pretty_assertions", - "spirq", + "spirq 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "spirq-core", ] @@ -433,21 +425,25 @@ dependencies = [ ] [[package]] -name = "strsim" -version = "0.11.0" +name = "spq-core" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" +checksum = "54c20ea3869984b0cdd695e7cb69dfc7f8814b99c1611446504e2d2e38d17380" +dependencies = [ + "anyhow", + "bytemuck", + "fnv", + "half", + "num-traits", + "ordered-float 3.9.2", + "spirv", +] [[package]] -name = "syn" -version = "1.0.109" +name = "strsim" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" [[package]] name = "syn" @@ -537,9 +533,3 @@ name = "windows_x86_64_msvc" version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" - -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" diff --git a/Cargo.toml b/Cargo.toml index ebd9d1a..e859c5b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,5 @@ [workspace] members = [ "spirq", - "spirq-core", - "spirq-spvasm", - "spirq-dis", - "spirq-as", "shader-reflect", ] diff --git a/README.md b/README.md index 2a7d804..ba84b73 100644 --- a/README.md +++ b/README.md @@ -3,25 +3,17 @@ [![Crate](https://img.shields.io/crates/v/spirq)](https://crates.io/crates/spirq) [![Documentation](https://docs.rs/spirq/badge.svg)](https://docs.rs/spirq) -`spirq` is a family of crates to help you process SPIR-V binary and assembly for Vulkan. +`spirq` is a shader reflection tool to help you process SPIR-V binary and assembly for Vulkan. You can use `spirq` to query host-shader interfaces including descriptor bindings, pipeline inputs and outputs, specialization constants. -| Crate | Purpose | -|-|-| -|[spirq](spirq/README.md) [![Crate](https://img.shields.io/crates/v/spirq)](https://crates.io/crates/spirq)| Shader resource reflection, including descriptor bindings, pipeline inputs and outputs, specialization constants. | -|[spirq-core](spirq-core/README.md) [![Crate](https://img.shields.io/crates/v/spirq-core)](https://crates.io/crates/spirq-core)| Common structures and routines for SPIR-V IR analysis. | -|[spirq-spvasm](spirq-spvasm/README.md) [![Crate](https://img.shields.io/crates/v/spirq-spvasm)](https://crates.io/crates/spirq-spvasm)| SPIR-V assembler and disassembler. | +You can also use the commandline (CLI) tool [`shader-reflect`](shader-reflect/README.md) to use `spirq` without programming in Rust. -Commandline (CLI) tools are also provided for general use. +> Note: `spirq-` family of crates have been moved to [`spq`](https://github.com/PENGUINLIONG/spq-rs). -| Crate | Purpose | -|-|-| -|[shader-reflect](shader-reflect/README.md) [![Crate](https://img.shields.io/crates/v/shader-reflect)](https://crates.io/crates/shader-reflect)| Shader resource declaration reflector. | -|[spirq-dis](spirq-dis/README.md) [![Crate](https://img.shields.io/crates/v/spirq-dis)](https://crates.io/crates/spirq-dis)| SPIR-V disassembler frontend. Drop-in replacement of `spirv-dis`. | -|[spirq-as](spirq-as/README.md) [![Crate](https://img.shields.io/crates/v/spirq-as)](https://crates.io/crates/spirq-as)| SPIR-V assembler frontend. Drop-in replacement of `spirv-as`. | +## Usage -## What's different from other crates? +See [the crate level readme](spirq/README.md) for detail. -A lot of my works stand in an overlapping field of compilers and graphics systems, so I often have to work with weird or even corrupted SPIR-V binaries. Obviously, existing tools like `rspirv` and `spirv-reflect` are not designed for this. I then decided to develop my own toolkit, which is now the spirq family. +## What's different from other crates? Compared with spirq, `rspirv` has more strict requirements on SPIR-V physical layout, which makes it impossible to process bad test cases for other projects. `spirv-reflect` is a broadly used reflection tool and it's a wrapper crate of Khronos' official [SPIRV-Reflect](https://github.com/KhronosGroup/SPIRV-Reflect) tool. `SPIRV-Reflect`, however, was developed in pretty early days and it has some legacy bad designs (like a limit of 16 descriptors). [SPIRV-Tools](https://github.com/KhronosGroup/SPIRV-Reflect) provides Khronos' official assembler and disassembler, while it's hard to be integrated to other Rust projects. diff --git a/spirq-as/Cargo.toml b/spirq-as/Cargo.toml deleted file mode 100644 index 4a52b80..0000000 --- a/spirq-as/Cargo.toml +++ /dev/null @@ -1,23 +0,0 @@ -[package] -name = "spirq-as" -version = "0.1.4" -authors = ["PENGUINLIONG "] -edition = "2018" -license = "MIT OR Apache-2.0" -description = "SPIR-V assembler" -repository = "https://github.com/PENGUINLIONG/spirq-rs" -homepage = "https://github.com/PENGUINLIONG/spirq-rs" -documentation = "https://docs.rs/spirq-as" -categories = ["graphics"] -readme = "README.md" -keywords = ["spirv"] - -[badges] -maintenance = { status = "actively-developed" } - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -anyhow = "1.0" -spirq-spvasm = { version = "0.1.4", path = "../spirq-spvasm" } -clap = { version = "4.0.6", features = ["derive"] } diff --git a/spirq-as/README.md b/spirq-as/README.md deleted file mode 100644 index f3f4339..0000000 --- a/spirq-as/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# SPIR-Q Assembler - -[![Crate](https://img.shields.io/crates/v/spirq-as)](https://crates.io/crates/spirq-as) - -SPIR-Q Assembler (`spirq-as`) is a SPIR-V assembler written in pure Rust. It is a drop-in replacement of the official assembler `spirv-as` with the same commandline arguments. - -## Install - -You can install `spirq-as` from cargo with: - -```bash -cargo install spirq-as -``` - -## Usage - -To assemble SPIR-V binary from SPIR-V assembly, you can either pass the source file path by argument or pipe the code in. - -```bash -spirq-as [INPUT].spvasm -o [OUTPUT].spv -# - or - -cat [INPUT].spvasm | spirq-as -o [OUTPUT].spv -``` - -`spirq-as` is a CLI tool for end users. You can also integrate the assembler to your application from the library crate [`spirq-spvasm`](../spirq-spvasm/README.md). - -## License - -This project is licensed under either of - -* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) -* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) - -at your option. diff --git a/spirq-as/src/main.rs b/spirq-as/src/main.rs deleted file mode 100644 index 0416b30..0000000 --- a/spirq-as/src/main.rs +++ /dev/null @@ -1,120 +0,0 @@ -use clap::Parser; -use spirq_spvasm::{Assembler, SpirvHeader}; -use std::{ - borrow::Borrow, - fs::File, - io::{stderr, Read, Write}, - path::Path, - process::exit, -}; - -const SPIRV_VERSION_1_0: u32 = 0x0001_0000; -const SPIRV_VERSION_1_1: u32 = 0x0001_0100; -const SPIRV_VERSION_1_2: u32 = 0x0001_0200; -const SPIRV_VERSION_1_3: u32 = 0x0001_0300; -const SPIRV_VERSION_1_4: u32 = 0x0001_0400; -const SPIRV_VERSION_1_5: u32 = 0x0001_0500; -const SPIRV_VERSION_1_6: u32 = 0x0001_0600; - -// TODO: (penguinliong) Get ourselves a generator ID. -const GENERATOR: u32 = 0; - -#[derive(Parser, Debug)] -#[command(author, version, about, long_about = None)] -struct Args { - #[arg( - help = "Input SPIR-V assembly file path. Or read from stdin if input file path is not provided." - )] - in_path: Option, - - #[arg( - short, - long, - help = "Output SPIR-V file path. The output file is defaulted to \ - {in_path}.spv if this path is not given." - )] - out_path: Option, - - #[arg( - long, - help = "{vulkan1.1spv1.4|vulkan1.0|vulkan1.1|vulkan1.2|vulkan1.3 \ - |spv1.0|spv1.1|spv1.2|spv1.3|spv1.4|spv1.5|spv1.6} \ - Use specified environment." - )] - target_env: Option, -} - -fn main() { - let args = Args::parse(); - - let mut in_file: Box = if let Some(in_path) = &args.in_path { - let in_path = Path::new(in_path); - let in_file = File::open(in_path).unwrap_or_else(|e| { - writeln!(stderr(), "error: failed to open input file: {}", e).unwrap(); - exit(1); - }); - let in_file: Box = Box::new(in_file); - in_file - } else { - let stdin = std::io::stdin(); - let in_file = Box::new(stdin); - in_file - }; - let out_path = if let Some(out_path) = args.out_path { - Path::new(&out_path).to_owned() - } else { - let in_path = match args.in_path.as_ref() { - Some(x) => x, - _ => "out", - }; - Path::new(&format!("{}.spv", in_path)).to_owned() - }; - - let mut code = String::new(); - in_file.read_to_string(&mut code).unwrap_or_else(|e| { - writeln!(stderr(), "error: failed to read input file: {}", e).unwrap(); - exit(1); - }); - - let header = match args.target_env.as_ref().map(Borrow::borrow) { - Some("vulken1.1spv1.4") => SpirvHeader::new(SPIRV_VERSION_1_4, GENERATOR), - Some("vulkan1.0") => SpirvHeader::new(SPIRV_VERSION_1_0, GENERATOR), - Some("vulkan1.1") => SpirvHeader::new(SPIRV_VERSION_1_1, GENERATOR), - Some("vulkan1.2") => SpirvHeader::new(SPIRV_VERSION_1_2, GENERATOR), - Some("vulkan1.3") => SpirvHeader::new(SPIRV_VERSION_1_3, GENERATOR), - Some("spv1.0") => SpirvHeader::new(SPIRV_VERSION_1_0, GENERATOR), - Some("spv1.1") => SpirvHeader::new(SPIRV_VERSION_1_1, GENERATOR), - Some("spv1.2") => SpirvHeader::new(SPIRV_VERSION_1_2, GENERATOR), - Some("spv1.3") => SpirvHeader::new(SPIRV_VERSION_1_3, GENERATOR), - Some("spv1.4") => SpirvHeader::new(SPIRV_VERSION_1_4, GENERATOR), - Some("spv1.5") => SpirvHeader::new(SPIRV_VERSION_1_5, GENERATOR), - Some("spv1.6") => SpirvHeader::new(SPIRV_VERSION_1_6, GENERATOR), - None => SpirvHeader::new(SPIRV_VERSION_1_4, GENERATOR), - _ => { - writeln!( - stderr(), - "error: unknown target environment: {}", - args.target_env.unwrap() - ) - .unwrap(); - exit(1); - } - }; - - let spv = Assembler::new() - .assemble(&code, header) - .unwrap_or_else(|e| { - writeln!(stderr(), "error: failed to read input file: {}", e).unwrap(); - exit(1); - }); - - let mut out_file = File::create(out_path).unwrap_or_else(|e| { - writeln!(stderr(), "error: failed to open output file: {}", e).unwrap(); - exit(1); - }); - - out_file.write_all(&spv.into_bytes()).unwrap_or_else(|e| { - writeln!(stderr(), "error: failed to write output file: {}", e).unwrap(); - exit(1); - }); -} diff --git a/spirq-core/Cargo.toml b/spirq-core/Cargo.toml deleted file mode 100644 index 846fd5d..0000000 --- a/spirq-core/Cargo.toml +++ /dev/null @@ -1,27 +0,0 @@ -[package] -name = "spirq-core" -version = "1.0.4" -authors = ["PENGUINLIONG "] -edition = "2018" -license = "MIT OR Apache-2.0" -description = "SPIR-Q core feature implementation, a light weight SPIR-V query utility for graphics." -repository = "https://github.com/PENGUINLIONG/spirq-rs" -homepage = "https://github.com/PENGUINLIONG/spirq-rs" -documentation = "https://docs.rs/spirq-core" -categories = ["graphics"] -readme = "README.md" -keywords = ["spirv", "vulkan", "opengl", "opencl"] - -[badges] -maintenance = { status = "actively-developed" } - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -fnv = "1.0.7" -spirv = "0.3" -anyhow = "1.0" -ordered-float = "3.4" -num-traits = "0.2" -half = { version = "2.3", features = ["num-traits"] } -bytemuck = "1.14" diff --git a/spirq-core/README.md b/spirq-core/README.md deleted file mode 100644 index 4323fa7..0000000 --- a/spirq-core/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# SPIR-Q Core - -[![Crate](https://img.shields.io/crates/v/spirq-core)](https://crates.io/crates/spirq-core) -[![Documentation](https://docs.rs/spirq-core/badge.svg)](https://docs.rs/spirq-core) - -SPIR-Q Core provides the foundational structures and functions in the SPIR-Q ecosystem: - -- Binary instruction parser and builder (without semantical understanding of the operands) -- SPIR-V types and type registry -- Constant expression evaluator -- Shader interface resource descriptors - -## License - -This project is licensed under either of - -* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) -* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) - -at your option. diff --git a/spirq-core/src/annotation.rs b/spirq-core/src/annotation.rs deleted file mode 100644 index f553f01..0000000 --- a/spirq-core/src/annotation.rs +++ /dev/null @@ -1,239 +0,0 @@ -//! Annotation instruction (decorations and names) utilities. -use fnv::FnvHashMap as HashMap; - -use crate::{ - error::{anyhow, Result}, - ty::{AccessType, Type}, - var::{DescriptorBinding, InterfaceLocation}, -}; - -pub use spirv::Decoration; - -type VariableId = u32; -type InstrId = u32; - -#[derive(Clone, Copy, PartialEq, Eq, Hash)] -struct DecorationKey { - pub id: InstrId, - pub member_idx: Option, - pub deco: Decoration, -} -impl DecorationKey { - pub fn new(id: InstrId, deco: Decoration) -> Self { - Self { - id, - member_idx: None, - deco, - } - } - pub fn new_member(id: InstrId, member_idx: u32, deco: Decoration) -> Self { - Self { - id, - member_idx: Some(member_idx), - deco, - } - } -} - -#[derive(Default)] -pub struct DecorationRegistry<'a> { - deco_map: HashMap, -} -impl<'a> DecorationRegistry<'a> { - fn set_impl(&mut self, key: DecorationKey, operands: &'a [u32]) -> Result<()> { - use std::collections::hash_map::Entry; - match self.deco_map.entry(key) { - Entry::Vacant(entry) => { - entry.insert(operands); - Ok(()) - } - Entry::Occupied(_) => Err(anyhow!("duplicate decoration at id {}", key.id)), - } - } - fn get_impl(&self, key: DecorationKey) -> Result<&'a [u32]> { - self.deco_map - .get(&key) - .copied() - .ok_or(anyhow!("missing decoration at id {}", key.id)) - } - - pub fn set(&mut self, id: InstrId, deco: Decoration, operands: &'a [u32]) -> Result<()> { - self.set_impl(DecorationKey::new(id, deco), operands) - } - pub fn set_member( - &mut self, - id: InstrId, - member_idx: u32, - deco: Decoration, - operands: &'a [u32], - ) -> Result<()> { - self.set_impl(DecorationKey::new_member(id, member_idx, deco), operands) - } - pub fn get(&self, id: InstrId, deco: Decoration) -> Result<&'a [u32]> { - self.get_impl(DecorationKey::new(id, deco)) - } - pub fn get_member(&self, id: InstrId, member_idx: u32, deco: Decoration) -> Result<&'a [u32]> { - self.get_impl(DecorationKey::new_member(id, member_idx, deco)) - } - - pub fn get_u32(&self, id: InstrId, deco: Decoration) -> Result { - self.get(id, deco) - .and_then(|x| { - x.get(0).ok_or(anyhow!( - "expected a single operand for decoration {:?} at id {}", - deco, - id - )) - }) - .copied() - } - pub fn get_member_u32(&self, id: InstrId, member_idx: u32, deco: Decoration) -> Result { - self.get_member(id, member_idx, deco) - .and_then(|x| { - x.get(0).ok_or(anyhow!( - "expected a single operand for member decoration {:?} at id {} for member {}", - deco, - id, - member_idx - )) - }) - .copied() - } - - pub fn contains(&self, id: InstrId, deco: Decoration) -> bool { - self.deco_map.contains_key(&DecorationKey::new(id, deco)) - } - pub fn contains_member(&self, id: InstrId, member_idx: u32, deco: Decoration) -> bool { - self.deco_map - .contains_key(&DecorationKey::new_member(id, member_idx, deco)) - } - - pub fn get_all(&self, deco: Decoration) -> impl Iterator { - self.deco_map - .iter() - .filter(move |(key, _)| key.deco == deco) - .map(|(key, value)| (key.id, *value)) - } - - /// Get the location-component pair of an interface variable. - pub fn get_var_location(&self, var_id: VariableId) -> Result { - let comp = self.get_u32(var_id, Decoration::Component).unwrap_or(0); - self.get_u32(var_id, Decoration::Location) - .map(|loc| InterfaceLocation::new(loc, comp)) - } - /// Get the set-binding pair of a descriptor resource. - pub fn get_var_desc_bind(&self, var_id: VariableId) -> Result { - let desc_set = self.get_u32(var_id, Decoration::DescriptorSet).unwrap_or(0); - self.get_u32(var_id, Decoration::Binding) - .map(|bind_point| DescriptorBinding::new(desc_set, bind_point)) - } - /// Get the set-binding pair of a descriptor resource, but the binding point - /// is forced to 0 if it's not specified in SPIR-V source. - pub fn get_var_desc_bind_or_default(&self, var_id: VariableId) -> DescriptorBinding { - self.get_var_desc_bind(var_id) - .unwrap_or(DescriptorBinding::new(0, 0)) - } - /// Get the access type of an memory object. - pub fn get_desc_access_ty(&self, id: InstrId, ty: &Type) -> Option { - self.get_access_ty_from_deco(id).and_then(|x| { - // Use the stricter one. - if x == AccessType::ReadWrite { - match ty.access_ty() { - Some(x) => Some(x), - None => Some(AccessType::ReadWrite), - } - } else { - Some(x) - } - }) - } - pub fn get_access_ty_from_deco(&self, id: InstrId) -> Option { - let write_only = self.contains(id, Decoration::NonReadable); - let read_only = self.contains(id, Decoration::NonWritable); - match (write_only, read_only) { - (true, true) => None, - (true, false) => Some(AccessType::WriteOnly), - (false, true) => Some(AccessType::ReadOnly), - (false, false) => Some(AccessType::ReadWrite), - } - } - pub fn get_member_access_ty_from_deco( - &self, - id: InstrId, - member_idx: u32, - ) -> Option { - let write_only = self.contains_member(id, member_idx, Decoration::NonReadable); - let read_only = self.contains_member(id, member_idx, Decoration::NonWritable); - match (write_only, read_only) { - (true, true) => None, - (true, false) => Some(AccessType::WriteOnly), - (false, true) => Some(AccessType::ReadOnly), - (false, false) => Some(AccessType::ReadWrite), - } - } - - /// Get the input attachment index of the variable. - pub fn get_var_input_attm_idx(&self, var_id: VariableId) -> Result { - self.get_u32(var_id, Decoration::InputAttachmentIndex) - } -} - -#[derive(Clone, PartialEq, Eq, Hash)] -pub struct NameKey { - pub id: InstrId, - pub member_idx: Option, -} -#[derive(Default)] -pub struct NameRegistry<'a> { - name_map: HashMap, -} -impl<'a> NameRegistry<'a> { - // Names are debuf information. Not important so ID collisions are ignored. - pub fn set(&mut self, id: InstrId, name: &'a str) { - use std::collections::hash_map::Entry; - let key = NameKey { - id, - member_idx: None, - }; - match self.name_map.entry(key) { - Entry::Vacant(entry) => { - entry.insert(name); - } - _ => {} - } - } - pub fn set_member(&mut self, id: InstrId, member_idx: u32, name: &'a str) { - use std::collections::hash_map::Entry; - let key = NameKey { - id, - member_idx: Some(member_idx), - }; - match self.name_map.entry(key) { - Entry::Vacant(entry) => { - entry.insert(name); - } - _ => {} - } - } - - pub fn get(&self, id: InstrId) -> Option<&'a str> { - self.name_map - .get(&NameKey { - id, - member_idx: None, - }) - .copied() - } - pub fn get_member(&self, id: InstrId, member_idx: u32) -> Option<&'a str> { - self.name_map - .get(&NameKey { - id, - member_idx: Some(member_idx), - }) - .copied() - } - - pub fn iter(&self) -> impl Iterator { - self.name_map.iter() - } -} diff --git a/spirq-core/src/constant.rs b/spirq-core/src/constant.rs deleted file mode 100644 index 4dfe527..0000000 --- a/spirq-core/src/constant.rs +++ /dev/null @@ -1,250 +0,0 @@ -//! Constant and specialization constant representations. -use std::convert::TryFrom; - -use half::f16; -use ordered_float::OrderedFloat; - -use crate::{ - error::{anyhow, Result}, - ty::{ScalarType, Type}, - var::SpecId, -}; - -/// Typed constant value. -#[non_exhaustive] -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -pub enum ConstantValue { - Typeless(Box<[u8]>), - Bool(bool), - S8(i8), - S16(i16), - S32(i32), - S64(i64), - U8(u8), - U16(u16), - U32(u32), - U64(u64), - F16(OrderedFloat), - F32(OrderedFloat), - F64(OrderedFloat), -} -impl From<&[u32]> for ConstantValue { - fn from(x: &[u32]) -> Self { - let bytes = x.iter().flat_map(|x| x.to_le_bytes()).collect(); - ConstantValue::Typeless(bytes) - } -} -impl From<&[u8]> for ConstantValue { - fn from(x: &[u8]) -> Self { - let bytes = x.to_owned().into_boxed_slice(); - ConstantValue::Typeless(bytes) - } -} -impl From<[u8; 4]> for ConstantValue { - fn from(x: [u8; 4]) -> Self { - ConstantValue::try_from(&x as &[u8]).unwrap() - } -} -impl From<[u8; 8]> for ConstantValue { - fn from(x: [u8; 8]) -> Self { - ConstantValue::try_from(&x as &[u8]).unwrap() - } -} -impl From for ConstantValue { - fn from(x: bool) -> Self { - Self::Bool(x) - } -} -impl From for ConstantValue { - fn from(x: u32) -> Self { - Self::U32(x) - } -} -impl From for ConstantValue { - fn from(x: i32) -> Self { - Self::S32(x) - } -} -impl From for ConstantValue { - fn from(x: f32) -> Self { - Self::F32(OrderedFloat(x)) - } -} -impl ConstantValue { - pub fn to_typed(&self, ty: &Type) -> Result { - let x = match self { - Self::Typeless(x) => x, - _ => return Err(anyhow!("{self:?} is already typed")), - }; - - if let Some(scalar_ty) = ty.as_scalar() { - match scalar_ty { - ScalarType::Boolean => Ok(ConstantValue::Bool(x.iter().any(|x| x != &0))), - ScalarType::Integer { - bits: 8, - is_signed: true, - } if x.len() == 4 => { - let x = i8::from_le_bytes([x[0]]); - Ok(ConstantValue::S8(x)) - } - ScalarType::Integer { - bits: 8, - is_signed: false, - } if x.len() == 4 => { - let x = u8::from_le_bytes([x[0]]); - Ok(ConstantValue::U8(x)) - } - ScalarType::Integer { - bits: 16, - is_signed: true, - } if x.len() == 4 => { - let x = i16::from_le_bytes([x[0], x[1]]); - Ok(ConstantValue::S16(x)) - } - ScalarType::Integer { - bits: 16, - is_signed: false, - } if x.len() == 4 => { - let x = u16::from_le_bytes([x[0], x[1]]); - Ok(ConstantValue::U16(x)) - } - ScalarType::Integer { - bits: 32, - is_signed: true, - } if x.len() == 4 => { - let x = i32::from_le_bytes([x[0], x[1], x[2], x[3]]); - Ok(ConstantValue::S32(x)) - } - ScalarType::Integer { - bits: 32, - is_signed: false, - } if x.len() == 4 => { - let x = u32::from_le_bytes([x[0], x[1], x[2], x[3]]); - Ok(ConstantValue::U32(x)) - } - ScalarType::Integer { - bits: 64, - is_signed: true, - } if x.len() == 8 => { - let x = i64::from_le_bytes([x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]]); - Ok(ConstantValue::S64(x)) - } - ScalarType::Integer { - bits: 64, - is_signed: false, - } if x.len() == 8 => { - let x = u64::from_le_bytes([x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]]); - Ok(ConstantValue::U64(x)) - } - ScalarType::Float { bits: 16 } if x.len() == 4 => { - let x = f16::from_le_bytes([x[0], x[1]]); - Ok(ConstantValue::F16(OrderedFloat(x))) - } - ScalarType::Float { bits: 32 } if x.len() == 4 => { - let x = f32::from_le_bytes([x[0], x[1], x[2], x[3]]); - Ok(ConstantValue::F32(OrderedFloat(x))) - } - ScalarType::Float { bits: 64 } if x.len() == 8 => { - let x = f64::from_le_bytes([x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]]); - Ok(ConstantValue::F64(OrderedFloat(x))) - } - _ => Err(anyhow!( - "cannot parse {:?} from {} bytes", - scalar_ty, - x.len() - )), - } - } else { - Err(anyhow!("cannot parse {:?} as a constant value", ty)) - } - } - - pub fn to_bool(&self) -> Option { - match self { - Self::Bool(x) => Some(*x), - _ => None, - } - } - pub fn to_s32(&self) -> Option { - match self { - Self::S32(x) => Some(*x), - _ => None, - } - } - pub fn to_u32(&self) -> Option { - match self { - Self::S32(x) => Some(*x), - _ => None, - } - } - pub fn to_f32(&self) -> Option { - match self { - Self::F32(x) => Some((*x).into()), - _ => None, - } - } - - pub fn to_typeless(&self) -> Option> { - match self { - Self::Typeless(x) => Some(x.clone()), - Self::S8(x) => Some(Box::new(x.to_le_bytes())), - Self::S16(x) => Some(Box::new(x.to_le_bytes())), - Self::S32(x) => Some(Box::new(x.to_le_bytes())), - Self::S64(x) => Some(Box::new(x.to_le_bytes())), - Self::U8(x) => Some(Box::new(x.to_le_bytes())), - Self::U16(x) => Some(Box::new(x.to_le_bytes())), - Self::U32(x) => Some(Box::new(x.to_le_bytes())), - Self::U64(x) => Some(Box::new(x.to_le_bytes())), - Self::F16(x) => Some(Box::new(x.to_le_bytes())), - Self::F32(x) => Some(Box::new(x.to_le_bytes())), - Self::F64(x) => Some(Box::new(x.to_le_bytes())), - Self::Bool(x) => Some(Box::new([*x as u8])), - } - } -} - -/// Constant or specialization constant record. -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -pub struct Constant { - pub name: Option, - /// Type of constant. - pub ty: Type, - /// Defined value of constant, or default value of specialization constant. - pub value: ConstantValue, - /// Specialization constant ID, notice that this is NOT an instruction ID. - /// It is used to identify specialization constants for graphics libraries. - pub spec_id: Option, -} -impl Constant { - /// Create a constant record with name, type and value. `ty` must be a - /// `ScalarType`. - pub fn new(name: Option, ty: Type, value: ConstantValue) -> Self { - Self { - name, - ty, - value, - spec_id: None, - } - } - /// Create an intermediate constant record with type and value. Intermediate - /// constants don't have names because they contribute to subexpressions in - /// arithmetic. - pub fn new_itm(ty: Type, value: ConstantValue) -> Self { - Self { - name: None, - ty, - value, - spec_id: None, - } - } - /// Create a specialization constant record with name, type, default value - /// and a `SpecId`. - pub fn new_spec(name: Option, ty: Type, value: ConstantValue, spec_id: SpecId) -> Self { - Self { - name, - ty, - value: value, - spec_id: Some(spec_id), - } - } -} diff --git a/spirq-core/src/evaluator.rs b/spirq-core/src/evaluator.rs deleted file mode 100644 index 9314984..0000000 --- a/spirq-core/src/evaluator.rs +++ /dev/null @@ -1,632 +0,0 @@ -use crate::{ - constant::{Constant, ConstantValue}, - error::{anyhow, Error, Result}, - spirv::Op, - ty::{ScalarType, Type}, -}; -use fnv::FnvHashMap as HashMap; - -type InstrId = u32; - -fn const_id_not_found(id: InstrId) -> Error { - anyhow!("constant id {} not found", id) -} -fn evaluation_failed(op: Op, result_ty: &Type, operands: &[ConstantValue]) -> Error { - anyhow!("cannot evaluate {op:?} with {operands:?} as {result_ty:?}") -} -fn broken_expr_tree(id: InstrId) -> Error { - anyhow!("broken expression tree at id {}", id) -} - -#[derive(Default)] -pub struct Evaluator { - ext_instr_set: HashMap, - values: HashMap, -} -impl Evaluator { - pub fn new() -> Self { - Self { - ext_instr_set: HashMap::default(), - values: HashMap::default(), - } - } - - pub fn import_ext_instr_set(&mut self, id: InstrId, name: String) -> Result<()> { - use std::collections::hash_map::Entry; - match self.ext_instr_set.entry(id) { - Entry::Vacant(entry) => { - entry.insert(name); - Ok(()) - } - Entry::Occupied(_) => Err(anyhow!("extended instruction set id {} already exists", id)), - } - } - pub fn get_ext_instr_set_name(&mut self, id: InstrId) -> Result<&str> { - self.ext_instr_set - .get(&id) - .ok_or(anyhow!("missing extended instruction set id {}", id)) - .map(|s| s.as_str()) - } - - pub fn set(&mut self, id: InstrId, constant: Constant) -> Result<&Constant> { - use std::collections::hash_map::Entry; - match self.values.entry(id) { - Entry::Vacant(entry) => Ok(entry.insert(constant)), - Entry::Occupied(_) => Err(anyhow!("constant id {} already exists", id)), - } - } - pub fn get(&self, id: InstrId) -> Result<&Constant> { - self.values.get(&id).ok_or(const_id_not_found(id)) - } - - pub fn get_value(&self, id: InstrId) -> Result<&ConstantValue> { - self.get(id).map(|c| &c.value) - } - - pub fn iter(&self) -> impl Iterator { - self.values.iter() - } - - pub fn evaluate( - op: spirv::Op, - result_ty: &Type, - operands: &[ConstantValue], - ) -> Result { - let value = match op { - // Convert ops. - Op::ConvertFToS => { - let x = match operands { - [ConstantValue::F32(x)] => *x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32(x.0 as i32), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::ConvertFToU => { - let x = match operands { - [ConstantValue::F32(x)] => *x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: false, - }) => ConstantValue::U32(x.0 as u32), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::ConvertSToF => { - let x = match operands { - [ConstantValue::S32(x)] => *x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Float { bits: 32 }) => { - ConstantValue::F32((x as f32).into()) - } - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::ConvertUToF => { - let x = match operands { - [ConstantValue::U32(x)] => *x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Float { bits: 32 }) => { - ConstantValue::F32((x as f32).into()) - } - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::SConvert => { - let x = match operands { - [ConstantValue::S32(x)] => *x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32(x), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::UConvert => { - let x = match operands { - [ConstantValue::U32(x)] => *x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: false, - }) => ConstantValue::U32(x), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::FConvert => { - let x = match operands { - [ConstantValue::F32(x)] => *x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Float { bits: 32 }) => ConstantValue::F32(x), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::Bitcast => { - let bits = match operands { - [ConstantValue::U32(x)] => x.to_ne_bytes(), - [ConstantValue::S32(x)] => x.to_ne_bytes(), - [ConstantValue::F32(x)] => x.to_ne_bytes(), - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32(i32::from_ne_bytes(bits)), - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: false, - }) => ConstantValue::U32(u32::from_ne_bytes(bits)), - Type::Scalar(ScalarType::Float { bits: 32 }) => { - ConstantValue::F32(f32::from_ne_bytes(bits).into()) - } - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - // 3.42.13. Arithmetic Instructions - Op::SNegate => { - let a = match operands { - [ConstantValue::S32(x)] => *x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32(-a), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::FNegate => { - let a = match operands { - [ConstantValue::F32(x)] => *x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Float { bits: 32 }) => ConstantValue::F32(-a), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::IAdd => { - let (a, b) = match operands { - [ConstantValue::S32(x), ConstantValue::S32(y)] => (*x as i64, *y as i64), - [ConstantValue::S32(x), ConstantValue::U32(y)] => (*x as i64, *y as i64), - [ConstantValue::U32(x), ConstantValue::S32(y)] => (*x as i64, *y as i64), - [ConstantValue::U32(x), ConstantValue::U32(y)] => (*x as i64, *y as i64), - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32((a + b) as i32), - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: false, - }) => ConstantValue::U32((a + b) as u32), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::FAdd => { - let (a, b) = match operands { - [ConstantValue::F32(x), ConstantValue::F32(y)] => (*x, *y), - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Float { bits: 32 }) => ConstantValue::F32(a + b), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::ISub => { - let (a, b) = match operands { - [ConstantValue::S32(x), ConstantValue::S32(y)] => (*x as i64, *y as i64), - [ConstantValue::S32(x), ConstantValue::U32(y)] => (*x as i64, *y as i64), - [ConstantValue::U32(x), ConstantValue::S32(y)] => (*x as i64, *y as i64), - [ConstantValue::U32(x), ConstantValue::U32(y)] => (*x as i64, *y as i64), - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32(((a - b) & 0xffffffff) as i32), - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: false, - }) => ConstantValue::U32(((a - b) & 0xffffffff) as u32), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::FSub => { - let (a, b) = match operands { - [ConstantValue::F32(x), ConstantValue::F32(y)] => (*x, *y), - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Float { bits: 32 }) => ConstantValue::F32(a - b), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::IMul => { - let (a, b) = match operands { - [ConstantValue::S32(x), ConstantValue::S32(y)] => (*x as i64, *y as i64), - [ConstantValue::S32(x), ConstantValue::U32(y)] => (*x as i64, *y as i64), - [ConstantValue::U32(x), ConstantValue::S32(y)] => (*x as i64, *y as i64), - [ConstantValue::U32(x), ConstantValue::U32(y)] => (*x as i64, *y as i64), - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32(((a * b) & 0xffffffff) as i32), - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: false, - }) => ConstantValue::U32(((a * b) & 0xffffffff) as u32), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::FMul => { - let (a, b) = match operands { - [ConstantValue::F32(x), ConstantValue::F32(y)] => (*x, *y), - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Float { bits: 32 }) => ConstantValue::F32(a * b), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::UDiv => { - let (a, b) = match operands { - [ConstantValue::S32(x), ConstantValue::S32(y)] => (*x as u64, *y as u64), - [ConstantValue::S32(x), ConstantValue::U32(y)] => (*x as u64, *y as u64), - [ConstantValue::U32(x), ConstantValue::S32(y)] => (*x as u64, *y as u64), - [ConstantValue::U32(x), ConstantValue::U32(y)] => (*x as u64, *y as u64), - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32(((a / b) & 0xffffffff) as i32), - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: false, - }) => ConstantValue::U32(((a / b) & 0xffffffff) as u32), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::SDiv => { - let (a, b) = match operands { - [ConstantValue::S32(x), ConstantValue::S32(y)] => (*x as i64, *y as i64), - [ConstantValue::S32(x), ConstantValue::U32(y)] => (*x as i64, *y as i64), - [ConstantValue::U32(x), ConstantValue::S32(y)] => (*x as i64, *y as i64), - [ConstantValue::U32(x), ConstantValue::U32(y)] => (*x as i64, *y as i64), - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32(((a / b) & 0xffffffff) as i32), - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: false, - }) => ConstantValue::U32(((a / b) & 0xffffffff) as u32), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::FDiv => { - let (a, b) = match operands { - [ConstantValue::F32(x), ConstantValue::F32(y)] => (*x, *y), - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Float { bits: 32 }) => ConstantValue::F32(a / b), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::UMod => { - let (a, b) = match operands { - [ConstantValue::S32(x), ConstantValue::S32(y)] => (*x as u64, *y as u64), - [ConstantValue::S32(x), ConstantValue::U32(y)] => (*x as u64, *y as u64), - [ConstantValue::U32(x), ConstantValue::S32(y)] => (*x as u64, *y as u64), - [ConstantValue::U32(x), ConstantValue::U32(y)] => (*x as u64, *y as u64), - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32(((a % b) & 0xffffffff) as i32), - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: false, - }) => ConstantValue::U32(((a % b) & 0xffffffff) as u32), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::SRem => { - let (a, b) = match operands { - [ConstantValue::S32(x), ConstantValue::S32(y)] => (*x as i64, *y as i64), - [ConstantValue::S32(x), ConstantValue::U32(y)] => (*x as i64, *y as i64), - [ConstantValue::U32(x), ConstantValue::S32(y)] => (*x as i64, *y as i64), - [ConstantValue::U32(x), ConstantValue::U32(y)] => (*x as i64, *y as i64), - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32(((a % b) & 0xffffffff) as i32), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::SMod => { - let (a, b) = match operands { - [ConstantValue::S32(x), ConstantValue::S32(y)] => (*x as i64, *y as i64), - [ConstantValue::S32(x), ConstantValue::U32(y)] => (*x as i64, *y as i64), - [ConstantValue::U32(x), ConstantValue::S32(y)] => (*x as i64, *y as i64), - [ConstantValue::U32(x), ConstantValue::U32(y)] => (*x as i64, *y as i64), - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32((a.rem_euclid(b) & 0xffffffff) as i32), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::FRem => { - let (a, b) = match operands { - [ConstantValue::F32(x), ConstantValue::F32(y)] => (*x, *y), - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Float { bits: 32 }) => ConstantValue::F32(a % b), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::FMod => { - let (a, b) = match operands { - [ConstantValue::F32(x), ConstantValue::F32(y)] => (*x, *y), - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Float { bits: 32 }) => { - ConstantValue::F32(a.rem_euclid(*b).into()) - } - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - // 3.42.14. Bit Instructions - Op::ShiftRightLogical => { - if operands.len() != 2 { - return Err(evaluation_failed(op, result_ty, operands)); - } - let base = match operands[0] { - ConstantValue::S32(x) => u32::from_ne_bytes(x.to_ne_bytes()), - ConstantValue::U32(x) => x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - let shift = match operands[1] { - ConstantValue::S32(x) => u32::from_ne_bytes(x.to_ne_bytes()), - ConstantValue::U32(x) => x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32(i32::from_ne_bytes((base >> shift).to_ne_bytes())), - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: false, - }) => ConstantValue::U32(base >> shift), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::ShiftRightArithmetic => { - if operands.len() != 2 { - return Err(evaluation_failed(op, result_ty, operands)); - } - // See https://www.reddit.com/r/rust/comments/2lp3il/where_is_arithmetic_signed_rightshift. - let base = match operands[0] { - ConstantValue::S32(x) => x, - ConstantValue::U32(x) => i32::from_ne_bytes(x.to_ne_bytes()), - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - let shift = match operands[1] { - ConstantValue::S32(x) => u32::from_ne_bytes(x.to_ne_bytes()), - ConstantValue::U32(x) => x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32(base >> shift), - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: false, - }) => ConstantValue::U32(u32::from_ne_bytes((base >> shift).to_ne_bytes())), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::ShiftLeftLogical => { - if operands.len() != 2 { - return Err(evaluation_failed(op, result_ty, operands)); - } - let base = match operands[0] { - ConstantValue::S32(x) => u32::from_ne_bytes(x.to_ne_bytes()), - ConstantValue::U32(x) => x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - let shift = match operands[1] { - ConstantValue::S32(x) => u32::from_ne_bytes(x.to_ne_bytes()), - ConstantValue::U32(x) => x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32(i32::from_ne_bytes((base << shift).to_ne_bytes())), - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: false, - }) => ConstantValue::U32(base << shift), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::BitwiseOr => { - if operands.len() != 2 { - return Err(evaluation_failed(op, result_ty, operands)); - } - let x = match operands[0] { - ConstantValue::S32(x) => u32::from_ne_bytes(x.to_ne_bytes()), - ConstantValue::U32(x) => x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - let y = match operands[1] { - ConstantValue::S32(x) => u32::from_ne_bytes(x.to_ne_bytes()), - ConstantValue::U32(x) => x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32(i32::from_ne_bytes((x | y).to_ne_bytes())), - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: false, - }) => ConstantValue::U32(x | y), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::BitwiseXor => { - if operands.len() != 2 { - return Err(evaluation_failed(op, result_ty, operands)); - } - let x = match operands[0] { - ConstantValue::S32(x) => u32::from_ne_bytes(x.to_ne_bytes()), - ConstantValue::U32(x) => x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - let y = match operands[1] { - ConstantValue::S32(x) => u32::from_ne_bytes(x.to_ne_bytes()), - ConstantValue::U32(x) => x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32(i32::from_ne_bytes((x ^ y).to_ne_bytes())), - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: false, - }) => ConstantValue::U32(x ^ y), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::BitwiseAnd => { - if operands.len() != 2 { - return Err(evaluation_failed(op, result_ty, operands)); - } - let x = match operands[0] { - ConstantValue::S32(x) => u32::from_ne_bytes(x.to_ne_bytes()), - ConstantValue::U32(x) => x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - let y = match operands[1] { - ConstantValue::S32(x) => u32::from_ne_bytes(x.to_ne_bytes()), - ConstantValue::U32(x) => x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32(i32::from_ne_bytes((x & y).to_ne_bytes())), - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: false, - }) => ConstantValue::U32(x & y), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - Op::Not => { - if operands.len() != 1 { - return Err(evaluation_failed(op, result_ty, operands)); - } - let x = match operands[0] { - ConstantValue::S32(x) => u32::from_ne_bytes(x.to_ne_bytes()), - ConstantValue::U32(x) => x, - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - match result_ty { - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: true, - }) => ConstantValue::S32(i32::from_ne_bytes((!x).to_ne_bytes())), - Type::Scalar(ScalarType::Integer { - bits: 32, - is_signed: false, - }) => ConstantValue::U32(!x), - _ => return Err(evaluation_failed(op, result_ty, operands)), - } - } - _ => return Err(evaluation_failed(op, result_ty, operands)), - }; - Ok(value) - } - - pub fn interpret( - &mut self, - op: spirv::Op, - result_id: InstrId, - result_ty: &Type, - operand_ids: &[InstrId], - ) -> Result<&Constant> { - let mut operands = Vec::new(); - for operand in operand_ids.iter() { - if let Ok(operand) = self.get_value(*operand) { - operands.push(operand.to_owned()); - } else { - return Err(broken_expr_tree(result_id)); - } - } - - let value = Self::evaluate(op, result_ty, &operands)?; - self.set(result_id, Constant::new_itm(result_ty.clone(), value)) - } - - pub fn constants(&self) -> Vec { - let mut out: Vec<_> = self.values.iter().collect(); - out.sort_by_key(|c| c.0); - out.into_iter().map(|c| c.1.clone()).collect() - } -} diff --git a/spirq-core/src/func.rs b/spirq-core/src/func.rs deleted file mode 100644 index 3633cef..0000000 --- a/spirq-core/src/func.rs +++ /dev/null @@ -1,85 +0,0 @@ -use fnv::{FnvHashMap as HashMap, FnvHashSet as HashSet}; - -use crate::{ - constant::Constant, - error::{anyhow, Result}, -}; - -type VariableId = u32; -type FunctionId = u32; - -/// SPIR-V execution mode. -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -pub struct ExecutionMode { - pub exec_mode: spirv::ExecutionMode, - pub operands: Vec, -} - -/// Function reflection intermediate. -#[derive(Default, Debug, Clone)] -pub struct Function { - pub name: Option, - pub accessed_vars: HashSet, - pub callees: HashSet, - pub exec_modes: Vec, -} - -#[derive(Default)] -pub struct FunctionRegistry { - func_map: HashMap, -} -impl FunctionRegistry { - pub fn set(&mut self, id: FunctionId, func: Function) -> Result<()> { - use std::collections::hash_map::Entry; - match self.func_map.entry(id) { - Entry::Vacant(entry) => { - entry.insert(func); - Ok(()) - } - _ => Err(anyhow!("function id {} already existed", id)), - } - } - - pub fn get(&self, id: FunctionId) -> Result<&Function> { - self.func_map - .get(&id) - .ok_or(anyhow!("function id {} is not found", id)) - } - pub fn get_mut(&mut self, id: FunctionId) -> Result<&mut Function> { - self.func_map - .get_mut(&id) - .ok_or(anyhow!("function id {} is not found", id)) - } - pub fn get_by_name(&self, name: &str) -> Result<&Function> { - self.func_map - .values() - .find(|x| { - if let Some(nm) = x.name.as_ref() { - nm == name - } else { - false - } - }) - .ok_or(anyhow!("function {} is not found", name)) - } - - pub fn collect_ordered(&self) -> Vec { - let mut out: Vec<_> = self.func_map.iter().collect(); - out.sort_by_key(|x| x.0); - out.into_iter().map(|x| x.1.clone()).collect() - } - - fn collect_fn_vars_impl(&self, func: FunctionId, vars: &mut Vec) { - if let Ok(func) = self.get(func) { - vars.extend(func.accessed_vars.iter()); - for call in func.callees.iter() { - self.collect_fn_vars_impl(*call, vars); - } - } - } - pub fn collect_fn_vars(&self, func: FunctionId) -> Vec { - let mut accessed_vars = Vec::new(); - self.collect_fn_vars_impl(func, &mut accessed_vars); - accessed_vars - } -} diff --git a/spirq-core/src/lib.rs b/spirq-core/src/lib.rs deleted file mode 100644 index 09b4765..0000000 --- a/spirq-core/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub use spirv; - -pub mod annotation; -pub mod constant; -pub mod evaluator; -pub mod func; -pub mod parse; -pub mod ty; -pub mod var; - -/// Error infrastructure. -pub mod error { - pub use anyhow::{anyhow, Error, Result}; -} diff --git a/spirq-core/src/parse/bin.rs b/spirq-core/src/parse/bin.rs deleted file mode 100644 index 3498954..0000000 --- a/spirq-core/src/parse/bin.rs +++ /dev/null @@ -1,116 +0,0 @@ -use anyhow::Result; -use spirv::{MAJOR_VERSION, MINOR_VERSION}; -use std::{convert::TryInto, iter::FromIterator}; - -use super::Instrs; - -#[derive(Debug, Clone)] -pub struct SpirvHeader { - pub magic: u32, - pub version: u32, - pub generator: u32, - pub bound: u32, - pub schema: u32, -} -impl Default for SpirvHeader { - fn default() -> Self { - SpirvHeader { - magic: 0x07230203, - version: ((MAJOR_VERSION as u32) << 16) | ((MINOR_VERSION as u32) << 8), - generator: 0, - bound: 0, - schema: 0, - } - } -} -impl SpirvHeader { - pub fn new(version: u32, generator: u32) -> Self { - SpirvHeader { - version, - generator, - ..Default::default() - } - } - pub fn words(&self) -> [u32; 5] { - [ - self.magic, - self.version, - self.generator, - self.bound, - self.schema, - ] - } -} - -/// SPIR-V program binary. -#[derive(Debug, Default, Clone)] -pub struct SpirvBinary(Vec); -impl From> for SpirvBinary { - fn from(x: Vec) -> Self { - SpirvBinary(x) - } -} -impl From<&[u32]> for SpirvBinary { - fn from(x: &[u32]) -> Self { - SpirvBinary(x.to_owned()) - } -} -impl FromIterator for SpirvBinary { - fn from_iter>(iter: I) -> Self { - SpirvBinary(iter.into_iter().collect::>()) - } -} -impl From<&[u8]> for SpirvBinary { - fn from(x: &[u8]) -> Self { - if x.len() == 0 { - return SpirvBinary::default(); - } - x.chunks_exact(4) - .map(|x| x.try_into().unwrap()) - .map(match x[0] { - 0x03 => u32::from_le_bytes, - 0x07 => u32::from_be_bytes, - _ => return SpirvBinary::default(), - }) - .collect::() - } -} -impl From> for SpirvBinary { - fn from(x: Vec) -> Self { - SpirvBinary::from(x.as_ref() as &[u8]) - } -} - -impl SpirvBinary { - pub fn words(&self) -> &[u32] { - &self.0 - } - pub fn into_words(self) -> Vec { - self.0 - } - pub fn into_bytes(self) -> Vec { - self.0 - .iter() - .flat_map(|x| x.to_le_bytes().to_vec()) - .collect::>() - } - - pub fn instrs(&self) -> Result { - const HEADER_LEN: usize = 5; - Instrs::new(&self.words()[HEADER_LEN..]) - } - - pub fn header(&self) -> Option { - let header = &self.words()[..5]; - if header.len() < 5 { - return None; - } - Some(SpirvHeader { - magic: header[0], - version: header[1], - generator: header[2], - bound: header[3], - schema: header[4], - }) - } -} diff --git a/spirq-core/src/parse/instr.rs b/spirq-core/src/parse/instr.rs deleted file mode 100644 index 50d7934..0000000 --- a/spirq-core/src/parse/instr.rs +++ /dev/null @@ -1,242 +0,0 @@ -//! SPIR-V instruction parser. -use anyhow::bail; -use spirv::Op; -use std::{borrow::Borrow, fmt, ops::Deref}; - -use crate::error::{anyhow, Result}; - -pub struct Instrs<'a> { - inner: &'a [u32], - cache: Option<&'a Instr>, -} -impl<'a> Instrs<'a> { - pub fn new(spv: &'a [u32]) -> Result> { - let mut out = Instrs { - inner: &spv, - cache: None, - }; - out.load_next()?; - Ok(out) - } - - fn load_next(&mut self) -> Result<()> { - let mut new_cache = None; - while let Some(head) = self.inner.first() { - let len = ((*head as u32) >> 16) as usize; - // Report zero-length instructions. - if len == 0 { - bail!("instruction length is zero"); - } - - if len <= self.inner.len() { - let instr = Instr::new(&self.inner[..len])?; - self.inner = &self.inner[len..]; - new_cache = Some(instr); - } else { - if len < self.inner.len() { - bail!("instruction is truncated"); - } - } - break; - } - - self.cache = new_cache; - Ok(()) - } - - pub fn peek(&self) -> Option<&'a Instr> { - self.cache.clone() - } - pub fn next(&mut self) -> Result> { - let last_cache = self.cache.take(); - self.load_next()?; - return Ok(last_cache); - } - pub fn next_non_nop(&mut self) -> Result> { - while let Some(instr) = self.next()? { - if instr.opcode() != Op::Nop as u32 { - return Ok(Some(instr)); - } - } - Ok(None) - } -} - -pub struct Instr { - inner: [u32], -} -impl Instr { - pub fn new(x: &[u32]) -> Result<&Instr> { - if x.len() >= 1 { - Ok(unsafe { std::mem::transmute(x) }) - } else { - Err(anyhow!("instruction is too short")) - } - } - - /// Get the instruction opcode. - pub fn opcode(&self) -> u32 { - self.inner[0] & 0xFFFF - } - /// Get the instruction op. - pub fn op(&self) -> Op { - Op::from_u32(self.opcode()).unwrap() - } - /// Get the word count of the instruction, including the first word - /// containing the word count and opcode. - pub fn word_count(&self) -> usize { - self.inner.len() - } - /// Get an instruction operand reader. The reader does NO boundary checking - /// so the user code MUST make sure the implementation follows the - /// specification. - pub fn operands(&self) -> Operands<'_> { - Operands(&self.inner[1..]) - } -} -impl AsRef<[u32]> for Instr { - fn as_ref(&self) -> &[u32] { - &self.inner - } -} -impl ToOwned for Instr { - type Owned = Instruction; - fn to_owned(&self) -> Self::Owned { - Instruction::from(&self.inner) - } -} -impl fmt::Debug for Instr { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?} {:?}", self.op(), &self.inner[1..]) - } -} - -#[derive(Debug, Clone)] -pub struct Instruction { - inner: Vec, -} -impl From> for Instruction { - fn from(x: Vec) -> Instruction { - Instruction { inner: x } - } -} -impl From<&[u32]> for Instruction { - fn from(x: &[u32]) -> Instruction { - Instruction::from(x.to_owned()) - } -} -impl AsRef<[u32]> for Instruction { - fn as_ref(&self) -> &[u32] { - &self.inner - } -} -impl Borrow for Instruction { - fn borrow(&self) -> &Instr { - Instr::new(self.inner.as_ref()).unwrap() - } -} -impl Deref for Instruction { - type Target = Instr; - fn deref(&self) -> &Instr { - self.borrow() - } -} -impl Instruction { - pub fn builder(op: Op) -> InstructionBuilder { - InstructionBuilder::new(op) - } - pub fn into_words(self) -> Vec { - self.inner - } -} - -pub struct InstructionBuilder { - inner: Vec, -} -impl InstructionBuilder { - pub fn new(op: Op) -> InstructionBuilder { - InstructionBuilder { - inner: vec![(op as u32) & 0xFFFF], - } - } - pub fn push(mut self, x: u32) -> Self { - self.inner.push(x); - self - } - pub fn push_list(mut self, x: &[u32]) -> Self { - self.inner.extend_from_slice(x); - self - } - pub fn push_str(mut self, x: &str) -> Self { - use std::ffi::CString; - let cstr = CString::new(x).unwrap(); - let bytes = cstr.as_bytes(); - let words = bytes.len() / 4 + 1; - // Pad the string with zeros. - let bytes = { - let mut out = bytes.to_owned(); - out.resize(words * 4, 0); - out - }; - let slice: &[u32] = bytemuck::cast_slice(&bytes); - self.inner.extend_from_slice(slice); - self - } - pub fn build(mut self) -> Instruction { - self.inner[0] |= (self.inner.len() as u32) << 16; - Instruction::from(self.inner) - } -} - -#[derive(Clone)] -pub struct Operands<'a>(&'a [u32]); -impl<'a> Operands<'a> { - pub fn read_bool(&mut self) -> Result { - self.read_u32().map(|x| x != 0) - } - pub fn read_u32(&mut self) -> Result { - if let Some(x) = self.0.first() { - self.0 = &self.0[1..]; - Ok(*x) - } else { - Err(anyhow!("operand is too short")) - } - } - pub fn read_f32(&mut self) -> Result { - self.read_u32().map(|x| f32::from_bits(x)) - } - pub fn read_id(&mut self) -> Result { - self.read_u32() - } - pub fn read_str(&mut self) -> Result<&'a str> { - use std::ffi::CStr; - // Find the word with a trailing zero. - let ieos = self - .0 - .iter() - .position(|x| (x >> 24) == 0) - .ok_or(anyhow!("string is not null-terminated"))?; - - let slice: &[u32] = &self.0[..ieos + 1]; - self.0 = &self.0[ieos + 1..]; - let bytes: &[u8] = bytemuck::cast_slice(slice); - let cstr = CStr::from_bytes_until_nul(bytes)?; - Ok(cstr.to_str()?) - } - pub fn read_list(&mut self) -> Result<&'a [u32]> { - let rv = self.0; - self.0 = &[]; - Ok(rv) - } -} -impl<'a> Iterator for Operands<'a> { - type Item = u32; - fn next(&mut self) -> Option { - self.read_u32().ok() - } -} -impl<'a> ExactSizeIterator for Operands<'a> { - fn len(&self) -> usize { - self.0.len() - } -} diff --git a/spirq-core/src/parse/mod.rs b/spirq-core/src/parse/mod.rs deleted file mode 100644 index d8a46c8..0000000 --- a/spirq-core/src/parse/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod bin; -pub mod instr; - -pub use bin::{SpirvBinary, SpirvHeader}; -pub use instr::{Instr, Instrs, Instruction, InstructionBuilder, Operands}; diff --git a/spirq-core/src/ty/mod.rs b/spirq-core/src/ty/mod.rs deleted file mode 100644 index c09bbc3..0000000 --- a/spirq-core/src/ty/mod.rs +++ /dev/null @@ -1,843 +0,0 @@ -//! Structured representations of SPIR-V types. -use std::fmt; -use std::hash::Hash; -use std::rc::Rc; - -pub mod reg; -pub mod walk; - -pub use self::{reg::TypeRegistry, walk::Walk}; -pub use crate::spirv::{Dim, ImageFormat, StorageClass}; - -pub trait SpirvType { - /// Minimum size of the type in bytes if it can be represented in-memory. - /// It's the size of all static members and plus one element if it's an array. - /// Same as [`wgpu::BindingType::Buffer::min_binding_size`](https://docs.rs/wgpu/latest/wgpu/enum.BindingType.html). - fn min_nbyte(&self) -> Option; - /// Size of the type in bytes if it can be represented in-memory. - fn nbyte(&self) -> Option { - self.min_nbyte() - } - /// Returns true if the type is sized. A sized type can be represented - /// in-memory. Otherwise the type can only be used as a descriptor resource. - fn is_sized(&self) -> bool { - self.nbyte().is_some() - } - /// Returns the offset of the i-th member in bytes if it's a composite type. - fn member_offset(&self, _member_index: usize) -> Option { - None - } - /// Returns how the type can be accessed: `ReadOnly`, `WriteOnly` or - /// `ReadWrite`. - fn access_ty(&self) -> Option { - None - } -} - -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -pub enum ScalarType { - /// Pseudo-type representing no data. It's sometimes used to represent data - /// without a type hint at compile-time in SPIR-V. You shouldn't see this in - /// your reflection results. - Void, - /// Boolean value of either true or false. Be careful with booleans. - /// Booleans is NOT allowed to be exposed to the host according to the - /// SPIR-V specification. You shouldn't see this in your reflection results. - Boolean, - /// Two's complement integer. - Integer { - /// Number of bytes the integer takes. - bits: u32, - /// Whether the integer is signed. - is_signed: bool, - }, - /// IEEE 754 floating-point number. - Float { - /// Number of bytes the float takes. - bits: u32, - }, -} -impl ScalarType { - /// Create a signed integer type with the given number of bits. - pub fn int(bits: u32) -> Self { - Self::Integer { - bits, - is_signed: true, - } - } - /// Create an unsigned integer type with the given number of bits. - pub fn uint(bits: u32) -> Self { - Self::Integer { - bits, - is_signed: false, - } - } - /// Create a floating point type with the given number of bits. - pub fn float(bits: u32) -> Self { - Self::Float { bits } - } - /// Create a 32-bit signed integer type. - pub fn i32() -> Self { - Self::int(32) - } - /// Create a 32-bit unsigned integer type. - pub fn u32() -> Self { - Self::uint(32) - } - /// Create a 32-bit floating-point type. - pub fn f32() -> Self { - Self::float(32) - } -} -impl SpirvType for ScalarType { - fn min_nbyte(&self) -> Option { - match self { - Self::Void => None, - Self::Boolean => None, - Self::Integer { bits, .. } => Some((*bits / 8) as usize), - Self::Float { bits } => Some((*bits / 8) as usize), - } - } -} -impl fmt::Display for ScalarType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Self::Void => f.write_str("void"), - Self::Boolean => f.write_str("bool"), - Self::Integer { bits, is_signed } => match is_signed { - true => write!(f, "i{}", bits), - false => write!(f, "u{}", bits), - }, - Self::Float { bits } => write!(f, "f{}", bits), - } - } -} - -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -pub struct VectorType { - /// Vector scalar type. - pub scalar_ty: ScalarType, - /// Number of scalar components in the vector. - pub nscalar: u32, -} -impl SpirvType for VectorType { - fn min_nbyte(&self) -> Option { - Some(self.scalar_ty.min_nbyte()? * self.nscalar as usize) - } -} -impl fmt::Display for VectorType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "vec{}<{}>", self.nscalar, self.scalar_ty) - } -} - -#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)] -pub enum MatrixAxisOrder { - ColumnMajor, - RowMajor, -} -impl Default for MatrixAxisOrder { - fn default() -> MatrixAxisOrder { - MatrixAxisOrder::ColumnMajor - } -} - -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -pub struct MatrixType { - /// Matrix vector type. - pub vector_ty: VectorType, - /// Number of vectors in the matrix. - pub nvector: u32, - /// Axis order of the matrix. Valid SPIR-V never gives a `None` major. - pub axis_order: Option, - /// Stride between vectors in the matrix. Valid SPIR-V never gives a `None` - /// stride. - pub stride: Option, -} -impl SpirvType for MatrixType { - fn min_nbyte(&self) -> Option { - Some(self.stride? * self.nvector as usize) - } -} -impl fmt::Display for MatrixType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let major = match self.axis_order { - Some(MatrixAxisOrder::ColumnMajor) => "ColumnMajor", - Some(MatrixAxisOrder::RowMajor) => "RowMajor", - None => "AxisOrder?", - }; - let nrow = self.vector_ty.nscalar; - let ncol = self.nvector; - let scalar_ty = &self.vector_ty.scalar_ty; - let stride = match self.stride { - Some(x) => x.to_string(), - None => "?".to_owned(), - }; - write!(f, "mat{nrow}x{ncol}<{scalar_ty},{major},{stride}>") - } -} - -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -pub struct ImageType { - /// Scalar type of image access result. - pub scalar_ty: ScalarType, - /// Dimension of the image. - pub dim: Dim, - /// Whether the image is a depth image, or `None` if it's unknown at compile - /// time. - pub is_depth: Option, - /// Whether the image is an array of images. In Vulkan, it means that the - /// image can have multiple layers. In Vulkan, only `Dim1D`, `Dim2D`, and - /// `DimCube` can be arrayed. - pub is_array: bool, - /// Whether the image is multisampled. In Vulkan, only 2D images and 2D - /// image arrays can be multi sampled. - pub is_multisampled: bool, - /// Whether the image is sampled, or `None` if it's unknown at compile time. - pub is_sampled: Option, - /// Matches `VkImageCreateInfo::format`. Can be `ImageFormat::Unknown` in - /// case of a sampled image. - pub fmt: ImageFormat, -} -impl SpirvType for ImageType { - fn min_nbyte(&self) -> Option { - None - } -} -impl fmt::Display for ImageType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let scalar_ty = &self.scalar_ty; - let is_sampled = match self.is_sampled { - Some(true) => "Sampled", - Some(false) => "Storage", - None => "Sampled?", - }; - let depth = match self.is_depth { - Some(true) => "Depth", - Some(false) => "Color", - None => "Depth?", - }; - let dim = format!("{:?}", self.dim)[3..].to_owned(); - let is_array = match self.is_array { - true => "Array", - false => "", - }; - let is_multisampled = match self.is_multisampled { - true => "MS", - false => "", - }; - write!( - f, - "Image{dim}{is_array}{is_multisampled}<{scalar_ty},{is_sampled},{depth},{:?}>", - self.fmt - ) - } -} - -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -pub struct SamplerType {} -impl SpirvType for SamplerType { - fn min_nbyte(&self) -> Option { - None - } -} -impl fmt::Display for SamplerType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str("Sampler") - } -} - -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -pub struct CombinedImageSamplerType { - pub sampled_image_ty: SampledImageType, -} -impl SpirvType for CombinedImageSamplerType { - fn min_nbyte(&self) -> Option { - None - } -} -impl fmt::Display for CombinedImageSamplerType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "CombinedImageSampler<{}>", self.sampled_image_ty) - } -} - -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -pub struct SampledImageType { - /// Scalar type of image access result. - pub scalar_ty: ScalarType, - /// Dimension of the image. - pub dim: Dim, - /// Whether the image is a depth image, or `None` if it's unknown at compile - /// time. - pub is_depth: Option, - /// Whether the image is an array of images. In Vulkan, it means that the - /// image can have multiple layers. In Vulkan, only `Dim1D`, `Dim2D`, and - /// `DimCube` can be arrayed. - pub is_array: bool, - /// Whether the image is multisampled. In Vulkan, only 2D images and 2D - /// image arrays can be multi sampled. - pub is_multisampled: bool, -} -impl SpirvType for SampledImageType { - fn min_nbyte(&self) -> Option { - None - } -} -impl fmt::Display for SampledImageType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let scalar_ty = &self.scalar_ty; - let dim = format!("{:?}", self.dim)[3..].to_owned(); - let depth = match self.is_depth { - Some(true) => "Depth", - Some(false) => "Color", - None => "Depth?", - }; - let is_array = match self.is_array { - true => "Array", - false => "", - }; - let is_multisampled = match self.is_multisampled { - true => "MS", - false => "", - }; - write!( - f, - "SampledImage{dim}{is_array}{is_multisampled}<{scalar_ty},{depth}>" - ) - } -} - -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -pub struct StorageImageType { - /// Dimension of the image. - pub dim: Dim, - /// Whether the image is an array of images. In Vulkan, it means that the - /// image can have multiple layers. In Vulkan, only `Dim1D`, `Dim2D`, and - /// `DimCube` can be arrayed. - pub is_array: bool, - /// Whether the image is multisampled. In Vulkan, only 2D images and 2D - /// image arrays can be multi sampled. - pub is_multisampled: bool, - /// Matches `VkImageCreateInfo::format`. Can be `ImageFormat::Unknown` in - /// case of a sampled image. - pub fmt: ImageFormat, -} -impl SpirvType for StorageImageType { - fn min_nbyte(&self) -> Option { - None - } -} -impl fmt::Display for StorageImageType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let dim = format!("{:?}", self.dim)[3..].to_owned(); - let is_array = match self.is_array { - true => "Array", - false => "", - }; - let is_multisampled = match self.is_multisampled { - true => "MS", - false => "", - }; - write!( - f, - "StorageImage{dim}{is_array}{is_multisampled}<{:?}>", - self.fmt - ) - } -} - -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -pub struct SubpassDataType { - /// Scalar type of subpass data access result. - pub scalar_ty: ScalarType, - /// Image arrangement which encodes multisampling state. - pub is_multisampled: bool, -} -impl SpirvType for SubpassDataType { - fn min_nbyte(&self) -> Option { - None - } -} -impl fmt::Display for SubpassDataType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let scalar_ty = &self.scalar_ty; - let is_multisampled = match self.is_multisampled { - true => "MS", - false => "", - }; - write!(f, "SubpassData{is_multisampled}<{scalar_ty}>") - } -} - -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -pub struct ArrayType { - /// Type of the array element. - pub element_ty: Box, - /// Number of elements in the array. None if the array length is only known - /// at runtime. - pub nelement: Option, - /// Stride between elements in the array. None if the array doesn't have - /// a explicitly specified layout. For example, an array of descriptor - /// resources doesn't have a physical layout. - pub stride: Option, -} -impl SpirvType for ArrayType { - fn min_nbyte(&self) -> Option { - Some(self.stride? * self.nelement.unwrap_or(0).max(1) as usize) - } - fn nbyte(&self) -> Option { - Some(self.stride? * self.nelement.unwrap_or(0) as usize) - } - fn member_offset(&self, member_index: usize) -> Option { - Some(self.stride? * member_index) - } - fn access_ty(&self) -> Option { - self.element_ty.access_ty() - } -} -impl fmt::Display for ArrayType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - if let Some(nrepeat) = self.nelement { - write!(f, "[{}; {}]", self.element_ty, nrepeat) - } else { - write!(f, "[{}]", self.element_ty) - } - } -} - -/// Access type of a variable. -#[repr(u32)] -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub enum AccessType { - /// The variable can be accessed by read. - ReadOnly = 1, - /// The variable can be accessed by write. - WriteOnly = 2, - /// The variable can be accessed by read or by write. - ReadWrite = 3, -} -impl std::ops::BitOr for AccessType { - type Output = AccessType; - fn bitor(self, rhs: AccessType) -> AccessType { - return match (self, rhs) { - (Self::ReadOnly, Self::ReadOnly) => Self::ReadOnly, - (Self::WriteOnly, Self::WriteOnly) => Self::WriteOnly, - _ => Self::ReadWrite, - }; - } -} -impl std::ops::BitAnd for AccessType { - type Output = Option; - fn bitand(self, rhs: AccessType) -> Option { - return match (self, rhs) { - (Self::ReadOnly, Self::ReadWrite) - | (Self::ReadWrite, Self::ReadOnly) - | (Self::ReadOnly, Self::ReadOnly) => Some(Self::ReadOnly), - (Self::WriteOnly, Self::ReadWrite) - | (Self::ReadWrite, Self::WriteOnly) - | (Self::WriteOnly, Self::WriteOnly) => Some(Self::WriteOnly), - (Self::ReadWrite, Self::ReadWrite) => Some(Self::ReadWrite), - (_, _) => None, - }; - } -} - -#[derive(PartialEq, Eq, Clone, Hash, Debug)] -pub struct StructMember { - pub name: Option, - /// Offset of this member from the beginning of the struct. None if the - /// struct doesn't have a explicitly specified layout. For example, - /// `gl_PerVertex` doesn't have a physical layout. You won't see a `None` in - /// reflected result. - pub offset: Option, - pub ty: Type, - pub access_ty: AccessType, -} -#[derive(PartialEq, Eq, Default, Clone, Hash, Debug)] -pub struct StructType { - pub name: Option, - pub members: Vec, // Offset and type. -} -impl StructType { - pub fn name(&self) -> Option<&str> { - self.name.as_ref().map(AsRef::as_ref) - } -} -impl SpirvType for StructType { - fn min_nbyte(&self) -> Option { - let last_member = &self.members.last()?; - Some(last_member.offset? + last_member.ty.min_nbyte()?) - } - fn nbyte(&self) -> Option { - let last_member = &self.members.last()?; - Some(last_member.offset? + last_member.ty.nbyte()?) - } - fn member_offset(&self, member_index: usize) -> Option { - self.members.get(member_index).and_then(|x| x.offset) - } - fn access_ty(&self) -> Option { - self.members.iter().fold(None, |seed, x| match seed { - None => Some(x.access_ty), - Some(AccessType::ReadOnly) => match x.access_ty { - AccessType::ReadOnly => Some(AccessType::ReadOnly), - _ => Some(AccessType::ReadWrite), - }, - Some(AccessType::WriteOnly) => match x.access_ty { - AccessType::WriteOnly => Some(AccessType::WriteOnly), - _ => Some(AccessType::ReadWrite), - }, - Some(AccessType::ReadWrite) => Some(AccessType::ReadWrite), - }) - } -} -impl fmt::Display for StructType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - if let Some(name) = &self.name { - write!(f, "{} {{ ", name)?; - } else { - f.write_str("{ ")?; - } - for (i, member) in self.members.iter().enumerate() { - if i != 0 { - f.write_str(", ")?; - } - if let Some(name) = &member.name { - write!(f, "{}: {}", name, member.ty)?; - } else { - write!(f, "{}: {}", i, member.ty)?; - } - } - f.write_str(" }") - } -} - -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -pub struct AccelStructType {} -impl SpirvType for AccelStructType { - fn min_nbyte(&self) -> Option { - None - } -} -impl fmt::Display for AccelStructType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str("AccelStruct") - } -} - -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -pub struct DeviceAddressType {} -impl SpirvType for DeviceAddressType { - fn min_nbyte(&self) -> Option { - Some(std::mem::size_of::()) - } -} -impl fmt::Display for DeviceAddressType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str("Address") - } -} - -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -pub struct PointerType { - pub pointee_ty: Box, - pub store_cls: StorageClass, -} -impl SpirvType for PointerType { - fn min_nbyte(&self) -> Option { - Some(std::mem::size_of::()) - } - fn access_ty(&self) -> Option { - self.pointee_ty.access_ty() - } -} -impl fmt::Display for PointerType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str("Pointer { ")?; - write!(f, "{}", *self.pointee_ty)?; - f.write_str(" }") - } -} - -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -pub struct RayQueryType {} -impl SpirvType for RayQueryType { - fn min_nbyte(&self) -> Option { - None - } -} -impl fmt::Display for RayQueryType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str("RayQuery") - } -} - -macro_rules! declr_ty_accessor { - ([$e:ident] $($name:ident -> $ty:ident,)+) => { - $( - pub fn $name(&self) -> bool { - match self { - $e::$ty(..) => true, - _ => false - } - } - )+ - } -} -macro_rules! declr_ty_downcast { - ([$e:ident] $($name:ident -> $ty:ident($inner_ty:ident),)+) => { - $( - pub fn $name(&self) -> Option<&$inner_ty> { - match self { - $e::$ty(x) => Some(x), - _ => None - } - } - )+ - } -} - -#[derive(PartialEq, Eq, Hash, Clone, Debug)] -#[non_exhaustive] -pub enum Type { - /// A single value, which can be a signed or unsigned integer, a floating - /// point number, or a boolean value. - Scalar(ScalarType), - /// A collection of scalars. - Vector(VectorType), - /// A collection of vectors. - Matrix(MatrixType), - /// An image. In most cases, this variant is elevated to - /// `CombinedImageSampler`, `SampledImage`, or `StorageImage` so you - /// shouldn't see this in your reflection results. - Image(ImageType), - /// A sampled image externally combined with a sampler state. Such design is - /// preferred in OpenGL and Vulkan. - CombinedImageSampler(CombinedImageSamplerType), - /// A sampled image yet to be combined with a `Sampler`. Such design is - /// preferred in DirectX and Vulkan. - SampledImage(SampledImageType), - /// A storage image that shaders can read and/or write. - StorageImage(StorageImageType), - /// Separable sampler state. - Sampler(SamplerType), - /// Pixel store from input attachments. - SubpassData(SubpassDataType), - /// Repetition of a single type. - Array(ArrayType), - /// Aggregation of types. - Struct(StructType), - /// Acceleration structure for ray-tracing. Only available with - /// `RayTracingKHR` capability enabled. - AccelStruct(AccelStructType), - /// Forward-declared pointer but the type of pointed data is unknown. - /// Usually used for GPU linked lists. See `VK_KHR_buffer_device_address`. - DeviceAddress(DeviceAddressType), - /// Forward-declared pointer. Usually used for bindless resources with the - /// `buffer_reference` extension. See `VK_KHR_buffer_device_address`. - DevicePointer(PointerType), - /// Ray query payload type (`rayQueryEXT`). Only available with `RayQueryKHR` - /// capability enabled. - RayQuery(RayQueryType), -} -impl Type { - pub fn min_nbyte(&self) -> Option { - match self { - Type::Scalar(x) => x.min_nbyte(), - Type::Vector(x) => x.min_nbyte(), - Type::Matrix(x) => x.min_nbyte(), - Type::Image(x) => x.min_nbyte(), - Type::CombinedImageSampler(x) => x.min_nbyte(), - Type::SampledImage(x) => x.min_nbyte(), - Type::StorageImage(x) => x.min_nbyte(), - Type::Sampler(x) => x.min_nbyte(), - Type::SubpassData(x) => x.min_nbyte(), - Type::Array(x) => x.min_nbyte(), - Type::Struct(x) => x.min_nbyte(), - Type::AccelStruct(x) => x.min_nbyte(), - Type::DeviceAddress(x) => x.min_nbyte(), - Type::DevicePointer(x) => x.min_nbyte(), - Type::RayQuery(x) => x.min_nbyte(), - } - } - pub fn nbyte(&self) -> Option { - match self { - Type::Scalar(x) => x.nbyte(), - Type::Vector(x) => x.nbyte(), - Type::Matrix(x) => x.nbyte(), - Type::Image(x) => x.nbyte(), - Type::CombinedImageSampler(x) => x.nbyte(), - Type::SampledImage(x) => x.nbyte(), - Type::StorageImage(x) => x.nbyte(), - Type::Sampler(x) => x.nbyte(), - Type::SubpassData(x) => x.nbyte(), - Type::Array(x) => x.nbyte(), - Type::Struct(x) => x.nbyte(), - Type::AccelStruct(x) => x.nbyte(), - Type::DeviceAddress(x) => x.nbyte(), - Type::DevicePointer(x) => x.nbyte(), - Type::RayQuery(x) => x.nbyte(), - } - } - pub fn member_offset(&self, member_index: usize) -> Option { - match self { - Type::Scalar(x) => x.member_offset(member_index), - Type::Vector(x) => x.member_offset(member_index), - Type::Matrix(x) => x.member_offset(member_index), - Type::Image(x) => x.member_offset(member_index), - Type::CombinedImageSampler(x) => x.member_offset(member_index), - Type::SampledImage(x) => x.member_offset(member_index), - Type::StorageImage(x) => x.member_offset(member_index), - Type::Sampler(x) => x.member_offset(member_index), - Type::SubpassData(x) => x.member_offset(member_index), - Type::Array(x) => x.member_offset(member_index), - Type::Struct(x) => x.member_offset(member_index), - Type::AccelStruct(x) => x.member_offset(member_index), - Type::DeviceAddress(x) => x.member_offset(member_index), - Type::DevicePointer(x) => x.member_offset(member_index), - Type::RayQuery(x) => x.member_offset(member_index), - } - } - pub fn access_ty(&self) -> Option { - match self { - Type::Scalar(x) => x.access_ty(), - Type::Vector(x) => x.access_ty(), - Type::Matrix(x) => x.access_ty(), - Type::Image(x) => x.access_ty(), - Type::CombinedImageSampler(x) => x.access_ty(), - Type::SampledImage(x) => x.access_ty(), - Type::StorageImage(x) => x.access_ty(), - Type::Sampler(x) => x.access_ty(), - Type::SubpassData(x) => x.access_ty(), - Type::Array(x) => x.access_ty(), - Type::Struct(x) => x.access_ty(), - Type::AccelStruct(x) => x.access_ty(), - Type::DeviceAddress(x) => x.access_ty(), - Type::DevicePointer(x) => x.access_ty(), - Type::RayQuery(x) => x.access_ty(), - } - } - - // Iterate over all entries in the type tree. - pub fn walk<'a>(&'a self) -> Walk<'a> { - Walk::new(self) - } - declr_ty_accessor! { - [Type] - is_scalar -> Scalar, - is_vector -> Vector, - is_matrix -> Matrix, - is_image -> Image, - is_sampler -> Sampler, - is_combined_image_sampler -> CombinedImageSampler, - is_sampled_image -> SampledImage, - is_storage_image -> StorageImage, - is_subpass_data -> SubpassData, - is_array -> Array, - is_struct -> Struct, - is_accel_struct -> AccelStruct, - is_device_address -> DeviceAddress, - is_device_pointer -> DevicePointer, - } - declr_ty_downcast! { - [Type] - as_scalar -> Scalar(ScalarType), - as_vector -> Vector(VectorType), - as_matrix -> Matrix(MatrixType), - as_image -> Image(ImageType), - as_sampler -> Sampler(SamplerType), - as_combined_image_sampler -> CombinedImageSampler(CombinedImageSamplerType), - as_sampled_image -> SampledImage(SampledImageType), - as_storage_image -> StorageImage(StorageImageType), - as_subpass_data -> SubpassData(SubpassDataType), - as_array -> Array(ArrayType), - as_struct -> Struct(StructType), - as_accel_struct -> AccelStruct(AccelStructType), - as_device_address -> DeviceAddress(DeviceAddressType), - as_device_pointer -> DevicePointer(PointerType), - } - fn mutate_impl Type>(self, f: Rc) -> Type { - use Type::*; - let out = match self { - Array(src) => { - let dst = ArrayType { - element_ty: Box::new(src.element_ty.mutate_impl(f.clone())), - nelement: src.nelement, - stride: src.stride, - }; - Type::Array(dst) - } - Struct(src) => { - let dst = StructType { - name: src.name, - members: src - .members - .into_iter() - .map(|x| StructMember { - name: x.name, - offset: x.offset, - ty: x.ty.mutate_impl(f.clone()), - access_ty: x.access_ty, - }) - .collect(), - }; - Type::Struct(dst) - } - _ => self, - }; - (*f)(out) - } - pub fn mutate Type>(self, f: F) -> Type { - self.mutate_impl(Rc::new(f)) - } -} -impl fmt::Display for Type { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Type::Scalar(x) => x.fmt(f), - Type::Vector(x) => x.fmt(f), - Type::Matrix(x) => x.fmt(f), - Type::Image(x) => x.fmt(f), - Type::Sampler(x) => x.fmt(f), - Type::CombinedImageSampler(x) => x.fmt(f), - Type::SampledImage(x) => x.fmt(f), - Type::StorageImage(x) => x.fmt(f), - Type::SubpassData(x) => x.fmt(f), - Type::Array(x) => x.fmt(f), - Type::Struct(x) => x.fmt(f), - Type::AccelStruct(x) => x.fmt(f), - Type::DeviceAddress(x) => x.fmt(f), - Type::DevicePointer(x) => x.fmt(f), - Type::RayQuery(x) => x.fmt(f), - } - } -} - -/// Descriptor type matching `VkDescriptorType`. -#[derive(Debug, PartialEq, Eq, Hash, Clone)] -pub enum DescriptorType { - /// `VK_DESCRIPTOR_TYPE_SAMPLER` - Sampler(), - /// `VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER` - CombinedImageSampler(), - /// `VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE` - SampledImage(), - /// `VK_DESCRIPTOR_TYPE_STORAGE_IMAGE` - StorageImage(AccessType), - /// `VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER`. - UniformTexelBuffer(), - /// `VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER`. - StorageTexelBuffer(AccessType), - /// `VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER` or - /// `VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC` depending on how you gonna - /// use it. - UniformBuffer(), - /// `VK_DESCRIPTOR_TYPE_STORAGE_BUFFER` or - /// `VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC` depending on how you gonna - /// use it. - StorageBuffer(AccessType), - /// `VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT` and its input attachment index. - InputAttachment(u32), - /// `VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR` - AccelStruct(), -} diff --git a/spirq-core/src/ty/reg.rs b/spirq-core/src/ty/reg.rs deleted file mode 100644 index 79dd323..0000000 --- a/spirq-core/src/ty/reg.rs +++ /dev/null @@ -1,50 +0,0 @@ -use fnv::FnvHashMap as HashMap; - -use crate::{ - error::{anyhow, Result}, - ty::Type, -}; - -type TypeId = u32; - -#[derive(Default)] -pub struct TypeRegistry { - ty_map: HashMap, -} -impl TypeRegistry { - /// Allocate a type handle referred by `ty_id` and optionally assign a type - /// to it. - pub fn set(&mut self, id: TypeId, ty: Type) -> Result<()> { - use std::collections::hash_map::Entry; - match self.ty_map.entry(id) { - Entry::Vacant(entry) => { - entry.insert(ty); - Ok(()) - } - Entry::Occupied(mut entry) => { - if entry.get().is_device_address() && ty.is_device_pointer() { - entry.insert(ty); - Ok(()) - } else { - Err(anyhow!( - "type collision at id {}: {:?} vs {:?}", - id, - entry.get(), - ty - )) - } - } - } - } - - /// Get the type identified by `handle`. - pub fn get(&self, id: TypeId) -> Result<&Type> { - self.ty_map - .get(&id) - .ok_or(anyhow!("missing type id {}", id)) - } - - pub fn iter(&self) -> impl Iterator { - self.ty_map.iter() - } -} diff --git a/spirq-core/src/ty/walk.rs b/spirq-core/src/ty/walk.rs deleted file mode 100644 index d66fda1..0000000 --- a/spirq-core/src/ty/walk.rs +++ /dev/null @@ -1,132 +0,0 @@ -use crate::ty::Type; -use std::fmt; - -#[derive(Clone)] -pub enum Seg<'a> { - NamedIndex(usize, &'a str), - Index(usize), -} -impl<'a> fmt::Debug for Seg<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Seg::NamedIndex(_, name) => f.write_str(name), - Seg::Index(i) => write!(f, "{}", i), - } - } -} - -#[derive(Clone, Debug)] -pub struct MemberVariableRouting<'a> { - pub sym: Vec>, - pub offset: usize, - pub ty: &'a Type, -} - -struct WalkFrame<'a> { - sym_stem: Option>>, - base_offset: usize, - ty: &'a Type, - i: usize, -} -pub struct Walk<'a> { - inner: Vec>, -} -impl<'a> Walk<'a> { - pub fn new(ty: &'a Type) -> Walk<'a> { - let frame = WalkFrame { - sym_stem: None, - base_offset: 0, - ty: ty, - i: 0, - }; - Walk { inner: vec![frame] } - } -} -impl<'a> Iterator for Walk<'a> { - type Item = MemberVariableRouting<'a>; - fn next(&mut self) -> Option> { - fn get_child_ty_offset_seg<'a>( - ty: &'a Type, - i: usize, - ) -> Option<(&'a Type, usize, Seg<'a>)> { - match ty { - Type::Struct(struct_ty) => { - let member = struct_ty.members.get(i)?; - let seg = if let Some(name) = &member.name { - Seg::NamedIndex(i, &name) - } else { - Seg::Index(i) - }; - Some((&member.ty, member.offset.unwrap_or_default(), seg)) - } - Type::Array(arr_ty) => { - // Unsized buffer are treated as 0-sized. - if i < arr_ty.nelement.unwrap_or_default() as usize { - Some(( - &arr_ty.element_ty, - arr_ty.stride.unwrap_or_default() * i, - Seg::Index(i), - )) - } else { - None - } - } - _ => None, - } - } - enum LoopEnd<'a> { - Push(WalkFrame<'a>), - PopReturn(MemberVariableRouting<'a>), - } - loop { - // If used, this field will be filled with the next frame to be - // pushed at the back of the walk stack; or the last frame will be - // popped if the field is kept `None`. - let loop_end = if let Some(frame) = self.inner.last_mut() { - if let Some((child_ty, offset, seg)) = get_child_ty_offset_seg(frame.ty, frame.i) { - frame.i += 1; // Step member. - let offset = frame.base_offset + offset; - let ty = child_ty; - let sym = if let Some(sym_stem) = &frame.sym_stem { - let mut sym = sym_stem.clone(); - sym.push(seg); - sym - } else { - vec![seg] - }; - if child_ty.is_struct() || child_ty.is_array() { - // Found composite type, step into it. - LoopEnd::Push(WalkFrame { - sym_stem: Some(sym), - base_offset: offset, - ty, - i: 0, - }) - } else { - // Return directly if it's not a composite type. - return Some(MemberVariableRouting { sym, offset, ty }); - } - } else { - // Here can be reached only when the first frame's type is - // neither an array nor a struct; or a later frame's - // composite type's elements has been exhausted. - let ty = frame.ty; - let offset = frame.base_offset; - let sym = frame.sym_stem.clone().unwrap_or_default(); - LoopEnd::PopReturn(MemberVariableRouting { sym, offset, ty }) - } - } else { - // We have exhausted all types we have, including the root type - // of walk. - return None; - }; - match loop_end { - LoopEnd::Push(frame) => self.inner.push(frame), - LoopEnd::PopReturn(route) => { - self.inner.pop(); - return Some(route); - } - } - } - } -} diff --git a/spirq-core/src/var.rs b/spirq-core/src/var.rs deleted file mode 100644 index 55ad680..0000000 --- a/spirq-core/src/var.rs +++ /dev/null @@ -1,185 +0,0 @@ -use crate::{ - error::{anyhow, Result}, - ty::{DescriptorType, PointerType, StorageClass, Type, Walk}, -}; -use fnv::FnvHashMap as HashMap; -use std::fmt; - -type VariableId = u32; - -/// Descriptor set and binding point carrier. -#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Default, Clone, Copy)] -pub struct DescriptorBinding(u32, u32); -impl DescriptorBinding { - pub fn new(desc_set: u32, bind_point: u32) -> Self { - DescriptorBinding(desc_set, bind_point) - } - - pub fn set(&self) -> u32 { - self.0 - } - pub fn bind(&self) -> u32 { - self.1 - } - pub fn into_inner(self) -> (u32, u32) { - (self.0, self.1) - } -} -impl fmt::Display for DescriptorBinding { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "(set={}, bind={})", self.0, self.1) - } -} -impl fmt::Debug for DescriptorBinding { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - (self as &dyn fmt::Display).fmt(f) - } -} - -/// Interface variable location and component. -#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Default, Clone, Copy)] -pub struct InterfaceLocation(u32, u32); -impl InterfaceLocation { - pub fn new(loc: u32, comp: u32) -> Self { - InterfaceLocation(loc, comp) - } - - pub fn loc(&self) -> u32 { - self.0 - } - pub fn comp(&self) -> u32 { - self.1 - } - pub fn into_inner(self) -> (u32, u32) { - (self.0, self.1) - } -} -impl fmt::Display for InterfaceLocation { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "(loc={}, comp={})", self.0, self.1) - } -} -impl fmt::Debug for InterfaceLocation { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - (self as &dyn fmt::Display).fmt(f) - } -} - -/// Specialization constant ID. -pub type SpecId = u32; - -/// A SPIR-V variable - interface variables, descriptor resources and push -/// constants. -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum Variable { - /// Input interface variable. - Input { - name: Option, - // Interface location of input. - location: InterfaceLocation, - /// The concrete SPIR-V type definition of descriptor resource. - ty: Type, - }, - /// Output interface variable. - Output { - name: Option, - // Interface location of output. - location: InterfaceLocation, - /// The concrete SPIR-V type definition of descriptor resource. - ty: Type, - }, - /// Descriptor resource. - Descriptor { - name: Option, - // Binding point of descriptor resource. - desc_bind: DescriptorBinding, - /// Descriptor resource type matching `VkDescriptorType`. - desc_ty: DescriptorType, - /// The concrete SPIR-V type definition of descriptor resource. - ty: Type, - /// Number of bindings at the binding point. All descriptors can have - /// multiple binding points. If the multi-binding is dynamic, 0 will be - /// returned. - /// - /// For more information about dynamic multi-binding, please refer to - /// Vulkan extension `VK_EXT_descriptor_indexing`, GLSL extension - /// `GL_EXT_nonuniform_qualifier` and SPIR-V extension - /// `SPV_EXT_descriptor_indexing`. Dynamic multi-binding is only - /// supported in Vulkan 1.2. - nbind: u32, - }, - /// Push constant. - PushConstant { - name: Option, - /// The concrete SPIR-V type definition of descriptor resource. - ty: Type, - }, - /// Specialization constant. - SpecConstant { - name: Option, - /// Specialization constant ID. - spec_id: SpecId, - /// The concrete SPIR-V type definition of descriptor resource. - ty: Type, - }, -} -impl Variable { - pub fn name(&self) -> Option<&str> { - match self { - Variable::Input { name, .. } => name.as_deref(), - Variable::Output { name, .. } => name.as_deref(), - Variable::Descriptor { name, .. } => name.as_deref(), - Variable::PushConstant { name, .. } => name.as_deref(), - Variable::SpecConstant { name, .. } => name.as_deref(), - } - } - pub fn ty(&self) -> &Type { - match self { - Variable::Input { ty, .. } => ty, - Variable::Output { ty, .. } => ty, - Variable::Descriptor { ty, .. } => ty, - Variable::PushConstant { ty, .. } => ty, - Variable::SpecConstant { ty, .. } => ty, - } - } - pub fn walk<'a>(&'a self) -> Walk<'a> { - self.ty().walk() - } -} - -/// Variable allocated by `OpVariable`. -pub struct VariableAlloc { - pub name: Option, - /// Variable storage class. - pub store_cls: StorageClass, - /// Pointer type of the variable. It points to an array if it's a multibind. - /// Otherwise, it directly points to the actual inner type. - pub ptr_ty: PointerType, -} - -#[derive(Default)] -pub struct VariableRegistry { - var_map: HashMap, -} -impl VariableRegistry { - pub fn set(&mut self, id: VariableId, var: VariableAlloc) -> Result<()> { - use std::collections::hash_map::Entry; - match self.var_map.entry(id) { - Entry::Vacant(entry) => { - entry.insert(var); - Ok(()) - } - _ => Err(anyhow!("variable id {} already existed", id)), - } - } - - pub fn get(&self, id: VariableId) -> Result<&VariableAlloc> { - self.var_map - .get(&id) - .ok_or(anyhow!("variable id {} is not found", id)) - } - - pub fn iter(&self) -> impl Iterator { - self.var_map.iter() - } -} diff --git a/spirq-dis/Cargo.toml b/spirq-dis/Cargo.toml deleted file mode 100644 index 5f2b95d..0000000 --- a/spirq-dis/Cargo.toml +++ /dev/null @@ -1,23 +0,0 @@ -[package] -name = "spirq-dis" -version = "0.1.4" -authors = ["PENGUINLIONG "] -edition = "2018" -license = "MIT OR Apache-2.0" -description = "SPIR-V disassembler" -repository = "https://github.com/PENGUINLIONG/spirq-rs" -homepage = "https://github.com/PENGUINLIONG/spirq-rs" -documentation = "https://docs.rs/spirq-dis" -categories = ["graphics"] -readme = "README.md" -keywords = ["spirv"] - -[badges] -maintenance = { status = "actively-developed" } - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -anyhow = "1.0" -spirq-spvasm = { version = "0.1.4", path = "../spirq-spvasm" } -clap = { version = "4.0.6", features = ["derive"] } diff --git a/spirq-dis/README.md b/spirq-dis/README.md deleted file mode 100644 index 19b0f6f..0000000 --- a/spirq-dis/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# SPIR-Q Disassembler - -[![Crate](https://img.shields.io/crates/v/spirq-dis)](https://crates.io/crates/spirq-dis) - -SPIR-Q Disassembler (`spirq-dis`) is a SPIR-V disassembler written in pure Rust. It is a drop-in replacement of the official disassembler `spirv-dis` with the same commandline arguments. - -## Install - -You can install `spirq-dis` from cargo with: - -```bash -cargo install spirq-dis -``` - -## Usage - -To disassemble SPIR-V binary, you can either pass the SPIR-V file path by argument or pipe the content in. - -```bash -spirq-dis [INPUT].spv -o [OUTPUT].spvasm -# - or - -cat [INPUT].spv | spirq-dis -o [OUTPUT].spvasm -``` - -`spirq-dis` is a CLI tool for end users. You can also integrate the disassembler to your application from the library crate [`spirq-spvasm`](../spirq-spvasm/README.md). - -## License - -This project is licensed under either of - -* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) -* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) - -at your option. diff --git a/spirq-dis/src/main.rs b/spirq-dis/src/main.rs deleted file mode 100644 index d327ee0..0000000 --- a/spirq-dis/src/main.rs +++ /dev/null @@ -1,86 +0,0 @@ -use clap::Parser; -use spirq_spvasm::{Disassembler, SpirvBinary}; -use std::{ - fs::File, - io::{stderr, Read, Write}, - path::Path, - process::exit, -}; - -#[derive(Parser, Debug)] -#[command(author, version, about, long_about = None)] -struct Args { - #[arg(help = "Input SPIR-V assembly file path. Or read from stdin if input \ - file path is not provided.")] - in_path: Option, - - #[arg( - short, - long, - help = "Output SPIR-V assembly file path. The output is printed to \ - stdout if this path is not given." - )] - out_path: Option, - - #[arg(long, help = "Don't indent instructions.")] - no_indent: bool, - - #[arg(long, help = "Don't output the header as leading comments.")] - no_header: bool, - - #[arg(long, help = "Show raw Id values instead of friendly names.")] - raw_id: bool, -} - -fn main() { - let args = Args::parse(); - - let mut in_file: Box = if let Some(in_path) = &args.in_path { - let in_path = Path::new(in_path); - let in_file = File::open(in_path).unwrap_or_else(|e| { - writeln!(stderr(), "error: failed to open input file: {}", e).unwrap(); - exit(1); - }); - let in_file: Box = Box::new(in_file); - in_file - } else { - let stdin = std::io::stdin(); - let in_file = Box::new(stdin); - in_file - }; - - let mut spv = Vec::new(); - in_file.read_to_end(&mut spv).unwrap_or_else(|e| { - writeln!(stderr(), "error: failed to read input file: {}", e).unwrap(); - exit(1); - }); - - let dis = Disassembler::new() - .print_header(!args.no_header) - .indent(!args.no_indent) - .name_ids(!args.raw_id) - .name_type_ids(!args.raw_id) - .name_const_ids(!args.raw_id); - let spvasm = dis - .disassemble(&SpirvBinary::from(spv)) - .unwrap_or_else(|e| { - writeln!(stderr(), "error: failed to read input file: {}", e).unwrap(); - exit(1); - }); - - if let Some(out_path) = args.out_path { - let out_path = Path::new(&out_path).to_owned(); - let mut out_file = File::create(out_path).unwrap_or_else(|e| { - writeln!(stderr(), "error: failed to open output file: {}", e).unwrap(); - exit(1); - }); - out_file - .write_all(&spvasm.into_bytes()) - .unwrap_or_else(|e| { - writeln!(stderr(), "error: failed to write output file: {}", e).unwrap(); - exit(1); - }); - } else { - println!("{}", spvasm); - }; -} diff --git a/spirq-spvasm/Cargo.toml b/spirq-spvasm/Cargo.toml deleted file mode 100644 index 992a6f3..0000000 --- a/spirq-spvasm/Cargo.toml +++ /dev/null @@ -1,28 +0,0 @@ -[package] -name = "spirq-spvasm" -version = "0.1.4" -authors = ["PENGUINLIONG "] -edition = "2018" -license = "MIT OR Apache-2.0" -description = "Tools for SPIR-V Assembly interaction." -repository = "https://github.com/PENGUINLIONG/spirq-rs" -homepage = "https://github.com/PENGUINLIONG/spirq-rs" -documentation = "https://docs.rs/spirq-spvasm" -categories = ["graphics"] -readme = "README.md" -keywords = ["spirv", "spvasm"] - -[badges] -maintenance = { status = "actively-developed" } - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -anyhow = "1.0" -num-traits = "0.2" -spirq-core = { version = "1.0.4", path = "../spirq-core" } -spirq = { version = "1.1.1", path = "../spirq"} -half = { version = "2.3", features = ["num-traits"] } - -[dev-dependencies] -pretty_assertions = "1.4" diff --git a/spirq-spvasm/README.md b/spirq-spvasm/README.md deleted file mode 100644 index 78961d0..0000000 --- a/spirq-spvasm/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# SPIR-Q Tools for SPIR-V Assembly - -[![Crate](https://img.shields.io/crates/v/spirq-spvasm)](https://crates.io/crates/spirq-spvasm) -[![Documentation](https://docs.rs/spirq-spvasm/badge.svg)](https://docs.rs/spirq-spvasm) - -SPIR-Q tools for SPIR-V Assembly provides useful auxiliaries for shader and shader tool development. The toolkit currently provides the following tools: - -- Assembler [`spirq-as`](../spirq-as/README.md) (drop-in replacement of `spirv-as`) -- Disassemlber [`spirq-dis`](../spirq-dis) (drop-in replacement of `spirv-dis`) - -`spirq-as` and `spirq-dis` share the same commandline arguments as [the official tools](https://github.com/KhronosGroup/SPIRV-Tools). They consume the same SPIR-V assembly syntax as described [here](https://github.com/KhronosGroup/SPIRV-Tools/blob/main/docs/syntax.md). - -## License - -This project is licensed under either of - -* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) -* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) - -at your option. diff --git a/spirq-spvasm/scripts/generate_decorate_parameter_enum_type.py b/spirq-spvasm/scripts/generate_decorate_parameter_enum_type.py deleted file mode 100644 index af7c840..0000000 --- a/spirq-spvasm/scripts/generate_decorate_parameter_enum_type.py +++ /dev/null @@ -1,76 +0,0 @@ -import json - -with open("assets/spirv/spirv.core.grammar.json") as f: - j = json.load(f) - -j = [ - parameter_kind - for parameter_kind in j["operand_kinds"] - if parameter_kind["kind"] == "Decoration" -][0] - -parameter_kinds = {} -for instr in j["enumerants"]: - value = instr["value"] - - op_parameter_kinds = {} - if "parameters" in instr: - parameters = instr["parameters"] - i = 0 - for parameter in parameters: - kind = parameter["kind"] - if kind in ["IdResultType", "IdResult"]: - continue - if ( - kind.startswith("Id") - or kind.startswith("Literal") - or kind.startswith("Pair") - ): - i += 1 - continue - - op_parameter_kinds[i] = parameter["kind"] - i += 1 - parameter_kinds[value] = op_parameter_kinds - -out = [] - -out += [ - "use anyhow::{bail, Result};", - "use spirq_core::spirv::Op;", - "", - "fn unknown_decorate_parameter_index(decoration: u32, i: usize) -> Result<&'static str> {", - ' let opname = Op::from_u32(decoration).map(|op| format!("{:?}", op)).unwrap_or("".to_owned());', - ' bail!("Unknown op {} ({}) parameter index: {}", opname, decoration, i)', - "}", - "", - "pub fn decorate_parameter_enum_type(decoration: u32, i: usize) -> Result<&'static str> {", - " let out: &'static str = match decoration {", -] - -for decoration, decorate_parameter_kinds in parameter_kinds.items(): - if len(decorate_parameter_kinds) == 0: - continue - - out += [ - f" {decoration} => match i {{", - ] - for i, kind in decorate_parameter_kinds.items(): - out += [ - f' {i} => "{kind}",', - ] - out += [ - " _ => return unknown_decorate_parameter_index(decoration, i),", - " },", - ] - -out += [ - ' _ => bail!("{}-th parameter of decoration {} is not a enum", i, decoration),', - " };", - " Ok(out)", - "}", - "", -] - -with open("spirq-spvasm/src/generated/decorate_parameter_enum_type.rs", "w") as f: - f.write("\n".join(out)) diff --git a/spirq-spvasm/scripts/generate_enum_from_str.py b/spirq-spvasm/scripts/generate_enum_from_str.py deleted file mode 100644 index 4ced7c0..0000000 --- a/spirq-spvasm/scripts/generate_enum_from_str.py +++ /dev/null @@ -1,74 +0,0 @@ -from collections import defaultdict -import json - -with open("assets/spirv/spirv.core.grammar.json") as f: - j = json.load(f) - -bit_enums = defaultdict(dict) -value_enums = defaultdict(dict) -for operand_kind in j["operand_kinds"]: - category = operand_kind["category"] - kind = operand_kind["kind"] - - if category == "BitEnum": - enumerants = operand_kind["enumerants"] - for enumerant in enumerants: - bit_enums[kind][enumerant["enumerant"]] = enumerant["value"] - elif category == "ValueEnum": - enumerants = operand_kind["enumerants"] - for enumerant in enumerants: - value_enums[kind][enumerant["enumerant"]] = enumerant["value"] - -out = [] - -out += [ - "use anyhow::{bail, Result};", - "", - "pub fn enum_from_str(ety: &str, name: &str) -> Result {", - " let out: u32 = match ety {", -] - -# ValueEnum -for kind, enumerants in value_enums.items(): - if len(enumerants) == 0: - continue - - out += [ - f' "{kind}" => match name {{', - ] - for name, value in enumerants.items(): - out += [ - f' "{name}" => {value},', - ] - out += [ - ' _ => bail!("unknown enum: {}::{}", ety, name)', - " }", - ] - -# BitEnum -for kind, enumerants in bit_enums.items(): - if len(enumerants) == 0: - continue - - out += [ - f' "{kind}" => match name {{', - ] - for name, value in enumerants.items(): - out += [ - f' "{name}" => {value},', - ] - out += [ - ' _ => bail!("unknown enum: {}::{}", ety, name)', - " }", - ] - -out += [ - ' _ => bail!("unknown enum: {}::{}", ety, name),', - " };", - " Ok(out)", - "}", - "", -] - -with open("spirq-spvasm/src/generated/enum_from_str.rs", "w") as f: - f.write("\n".join(out)) diff --git a/spirq-spvasm/scripts/generate_enum_to_str.py b/spirq-spvasm/scripts/generate_enum_to_str.py deleted file mode 100644 index 07e65d4..0000000 --- a/spirq-spvasm/scripts/generate_enum_to_str.py +++ /dev/null @@ -1,70 +0,0 @@ -from collections import defaultdict -import json - -with open("assets/spirv/spirv.core.grammar.json") as f: - j = json.load(f) - -bit_enums = defaultdict(dict) -value_enums = defaultdict(dict) -for operand_kind in j["operand_kinds"]: - category = operand_kind["category"] - kind = operand_kind["kind"] - - if category == "BitEnum": - enumerants = operand_kind["enumerants"] - for enumerant in enumerants: - bit_enums[kind][enumerant["enumerant"]] = enumerant["value"] - elif category == "ValueEnum": - enumerants = operand_kind["enumerants"] - for enumerant in enumerants: - value_enums[kind][enumerant["enumerant"]] = enumerant["value"] - -out = [] - -out += [ - "#![allow(unreachable_patterns)]", - "use anyhow::{bail, Result};", - "", - "pub fn enum_to_str(ety: &str, value: u32) -> Result {", - " let out: String = match ety {", -] - -# ValueEnum -for kind, enumerants in value_enums.items(): - if len(enumerants) == 0: - continue - - out += [ - f' "{kind}" => match value {{', - ] - for name, value in enumerants.items(): - out += [ - f' {value} => "{name}".to_owned(),', - ] - out += [ - " _ => value.to_string(),", - " }", - ] - -# BitEnum -for kind, enumerants in bit_enums.items(): - if len(enumerants) == 0: - continue - - out += [ - f' "{kind}" => match value {{', - ' 0 => "None".to_owned(),', - " _ => value.to_string(),", - " }", - ] - -out += [ - ' _ => bail!("unknown enum: {}", ety),', - " };", - " Ok(out)", - "}", - "", -] - -with open("spirq-spvasm/src/generated/enum_to_str.rs", "w") as f: - f.write("\n".join(out)) diff --git a/spirq-spvasm/scripts/generate_op_from_str.py b/spirq-spvasm/scripts/generate_op_from_str.py deleted file mode 100644 index fc577e4..0000000 --- a/spirq-spvasm/scripts/generate_op_from_str.py +++ /dev/null @@ -1,35 +0,0 @@ -import json - -name2op = {} -with open("assets/spirv/spirv.core.grammar.json") as f: - j = json.load(f) - -for instr in j["instructions"]: - opname = instr["opname"] - opcode = instr["opcode"] - - assert opname not in name2op - name2op[opname] = opcode - -out = [] - -out += [ - "use anyhow::{bail, Result};", - "", - "pub fn op_from_str(opname: &str) -> Result {", - " let out: u32 = match opname {", -] - -for opname, opcode in name2op.items(): - out += [f' "{opname}" => {opcode},'] - -out += [ - ' _ => bail!("Unknown opname: {}", opname),', - " };", - " Ok(out)", - "}", - "", -] - -with open("spirq-spvasm/src/generated/op_from_str.rs", "w") as f: - f.write("\n".join(out)) diff --git a/spirq-spvasm/scripts/generate_op_has_result_id.py b/spirq-spvasm/scripts/generate_op_has_result_id.py deleted file mode 100644 index e8d4580..0000000 --- a/spirq-spvasm/scripts/generate_op_has_result_id.py +++ /dev/null @@ -1,41 +0,0 @@ -import json - -op_has_result_id = {} -with open("assets/spirv/spirv.core.grammar.json") as f: - j = json.load(f) - -for instr in j["instructions"]: - opcode = instr["opcode"] - - has_result_id = False - if "operands" in instr: - operands = instr["operands"] - for operand in operands: - if operand["kind"] == "IdResult": - has_result_id = True - break - - op_has_result_id[opcode] = has_result_id - -out = [] - -out += [ - "use anyhow::{bail, Result};", - "", - "pub fn op_has_result_id(opcode: u32) -> Result {", - " let out: bool = match opcode {", -] - -for opcode, has_result_id in op_has_result_id.items(): - out += [f' {opcode} => {"true" if has_result_id else "false"},'] - -out += [ - ' _ => bail!("Unknown opcode: {}", opcode),', - " };", - " Ok(out)", - "}", - "", -] - -with open("spirq-spvasm/src/generated/op_has_result_id.rs", "w") as f: - f.write("\n".join(out)) diff --git a/spirq-spvasm/scripts/generate_op_has_result_type_id.py b/spirq-spvasm/scripts/generate_op_has_result_type_id.py deleted file mode 100644 index 1855c13..0000000 --- a/spirq-spvasm/scripts/generate_op_has_result_type_id.py +++ /dev/null @@ -1,41 +0,0 @@ -import json - -op_has_result_id = {} -with open("assets/spirv/spirv.core.grammar.json") as f: - j = json.load(f) - -for instr in j["instructions"]: - opcode = instr["opcode"] - - has_result_id = False - if "operands" in instr: - operands = instr["operands"] - for operand in operands: - if operand["kind"] == "IdResultType": - has_result_id = True - break - - op_has_result_id[opcode] = has_result_id - -out = [] - -out += [ - "use anyhow::{bail, Result};", - "", - "pub fn op_has_result_type_id(opcode: u32) -> Result {", - " let out: bool = match opcode {", -] - -for opcode, has_result_id in op_has_result_id.items(): - out += [f' {opcode} => {"true" if has_result_id else "false"},'] - -out += [ - ' _ => bail!("Unknown opcode: {}", opcode),', - " };", - " Ok(out)", - "}", - "", -] - -with open("spirq-spvasm/src/generated/op_has_result_type_id.rs", "w") as f: - f.write("\n".join(out)) diff --git a/spirq-spvasm/scripts/generate_op_to_str.py b/spirq-spvasm/scripts/generate_op_to_str.py deleted file mode 100644 index 6aa45e0..0000000 --- a/spirq-spvasm/scripts/generate_op_to_str.py +++ /dev/null @@ -1,44 +0,0 @@ -import json - -name2op = {} -with open("assets/spirv/spirv.core.grammar.json") as f: - j = json.load(f) - -for instr in j["instructions"]: - opname = instr["opname"] - opcode = instr["opcode"] - - # Third party extension names should be suppressed so that they don't show - # up when disassembling. - is_khr_op = ("extensions" not in instr) or ( - opname.endswith("KHR") or opname.endswith("EXT") - ) - is_official_ext = ("extensions" not in instr) or any( - x.startswith("SPV_KHR") or x.startswith("SPV_EXT") for x in instr["extensions"] - ) - if is_khr_op and is_official_ext: - name2op[opname] = opcode - -out = [] - -out += [ - "#![allow(unreachable_patterns)]", - "use anyhow::{bail, Result};", - "", - "pub fn op_to_str(opcode: u32) -> Result<&'static str> {", - " let out: &'static str = match opcode {", -] - -for opname, opcode in name2op.items(): - out += [f' {opcode} => "{opname}",'] - -out += [ - ' _ => bail!("Unknown opcode: {}", opcode),', - " };", - " Ok(out)", - "}", - "", -] - -with open("spirq-spvasm/src/generated/op_to_str.rs", "w") as f: - f.write("\n".join(out)) diff --git a/spirq-spvasm/scripts/generate_operand_enum_type.py b/spirq-spvasm/scripts/generate_operand_enum_type.py deleted file mode 100644 index ec99a40..0000000 --- a/spirq-spvasm/scripts/generate_operand_enum_type.py +++ /dev/null @@ -1,69 +0,0 @@ -import json - -with open("assets/spirv/spirv.core.grammar.json") as f: - j = json.load(f) - -operand_kinds = {} -for instr in j["instructions"]: - opcode = instr["opcode"] - - op_operand_kinds = {} - if "operands" in instr: - operands = instr["operands"] - i = 0 - for operand in operands: - kind = operand["kind"] - if kind in ["IdResultType", "IdResult"]: - continue - if ( - kind.startswith("Id") - or kind.startswith("Literal") - or kind.startswith("Pair") - ): - i += 1 - continue - - op_operand_kinds[i] = operand["kind"] - i += 1 - operand_kinds[opcode] = op_operand_kinds - -out = [] - -out += [ - "use anyhow::{bail, Result};", - "", - "", - "fn unknown_operand_index(i: usize) -> Result<&'static str> {", - ' bail!("Unknown operand index: {}", i)', - "}", - "", - "pub fn operand_enum_type(opcode: u32, i: usize) -> Result<&'static str> {", - " let out: &'static str = match opcode {", -] - -for opcode, op_operand_kinds in operand_kinds.items(): - if len(op_operand_kinds) == 0: - continue - - out += [ - f" {opcode} => match i {{", - ] - for i, kind in op_operand_kinds.items(): - out += [ - f' {i} => "{kind}",', - ] - out += [ - " _ => return unknown_operand_index(i),", - " }", - ] - -out += [ - ' _ => bail!("{}-th operand of opcode {} is not a enum", i, opcode),', - " };", - " Ok(out)", - "}", - "", -] - -with open("spirq-spvasm/src/generated/operand_enum_type.rs", "w") as f: - f.write("\n".join(out)) diff --git a/spirq-spvasm/scripts/generate_print_operand.py b/spirq-spvasm/scripts/generate_print_operand.py deleted file mode 100644 index f6c8c87..0000000 --- a/spirq-spvasm/scripts/generate_print_operand.py +++ /dev/null @@ -1,254 +0,0 @@ -import json -from typing import List, Optional - -with open("assets/spirv/spirv.core.grammar.json") as f: - j = json.load(f) - -ops = {} -for instr in j["instructions"]: - opcode = instr["opcode"] - opname = instr["opname"] - - op_operand_kinds = [] - if "operands" in instr: - operands = instr["operands"] - for operand in operands: - kind = operand["kind"] - quantifier = operand["quantifier"] if "quantifier" in operand else None - op_operand_kinds.append((kind, quantifier)) - ops[opcode] = opname, op_operand_kinds - -operand_parameters = {} -for operand_kind in j["operand_kinds"]: - category = operand_kind["category"] - kind = operand_kind["kind"] - - enum_parameters = {} - if category == "BitEnum": - enumerants = operand_kind["enumerants"] - for enumerant in enumerants: - value = enumerant["value"] - parameter_name = enumerant["enumerant"] - if "parameters" in enumerant: - parameters = [p["kind"] for p in enumerant["parameters"]] - else: - parameters = [] - enum_parameters[value] = parameter_name, parameters - elif category == "ValueEnum": - enumerants = operand_kind["enumerants"] - for enumerant in enumerants: - value = enumerant["value"] - parameter_name = enumerant["enumerant"] - if "parameters" in enumerant: - parameters = [p["kind"] for p in enumerant["parameters"]] - else: - parameters = [] - enum_parameters[value] = parameter_name, parameters - else: - continue - operand_parameters[kind] = category, enum_parameters - - -out = [] - -out += [ - "use std::collections::HashMap;", - "use anyhow::{bail, Result};", - "use spirq_core::parse::Operands;", - "use super::enum_to_str::enum_to_str;", - "", - "fn print_id(operands: &mut Operands, id_names: &HashMap) -> Result {", - " let id = operands.read_u32()?;", - " if let Some(name) = id_names.get(&id) {", - ' Ok(format!("%{}", name))', - " } else {", - ' Ok(format!("%{}", id))', - " }", - "}", - "fn print_u32(operands: &mut Operands) -> Result {", - " Ok(operands.read_u32()?.to_string())", - "}", - "#[allow(dead_code)]", - "fn print_f32(operands: &mut Operands) -> Result {", - " Ok(operands.read_f32()?.to_string())", - "}", - "fn print_str(operands: &mut Operands) -> Result {", - ' Ok(format!(r#""{}""#, operands.read_str()?))', - "}", - "fn print_list(operands: &mut Operands) -> Result> {", - " let out = operands.read_list()?", - " .iter()", - " .map(|x| x.to_string())", - " .collect::>();", - " Ok(out)", - "}", - "fn print_pair_id_id_list(operands: &mut Operands, id_names: &HashMap) -> Result> {", - " let mut out = Vec::new();", - " out.push(print_id(operands, id_names)?);", - " out.push(print_id(operands, id_names)?);", - " Ok(out)", - "}", - "fn print_pair_id_u32_list(operands: &mut Operands, id_names: &HashMap) -> Result> {", - " let mut out = Vec::new();", - " out.push(print_id(operands, id_names)?);", - " out.push(print_u32(operands)?);", - " Ok(out)", - "}", - "fn print_pair_u32_id_list(operands: &mut Operands, id_names: &HashMap) -> Result> {", - " let mut out = Vec::new();", - " out.push(print_u32(operands)?);", - " out.push(print_id(operands, id_names)?);", - " Ok(out)", - "}", - "", -] - - -def print_operand(kind: str, quantifier: Optional[str], indent: int) -> List[str]: - padding = " " * (indent * 4) - - out = [] - out += [ - padding + f"// {kind}" + (f" {quantifier}" if quantifier else ""), - ] - - if quantifier == "*": - out += [ - padding + "while operands.len() != 0 {", - ] - padding += " " - elif quantifier == "?": - out += [ - padding + "if operands.len() != 0 {", - ] - padding += " " - elif quantifier is None: - pass - else: - raise RuntimeError(f"unknown quantifier {quantifier}") - - # Literal - if kind == "LiteralInteger": - out += [padding + "out.push(print_u32(operands)?);"] - elif kind == "LiteralFloat": - out += [padding + "out.push(print_f32(operands)?);"] - elif kind == "LiteralString": - out += [padding + "out.push(print_str(operands)?);"] - elif kind == "LiteralContextDependentNumber": - out += [padding + "out.extend(print_list(operands)?);"] - elif kind.startswith("Literal"): - out += [padding + "out.push(print_u32(operands)?);"] - # Id - elif kind.startswith("Id"): - out += [padding + "out.push(print_id(operands, id_names)?);"] - # Pair - elif kind == "PairIdRefIdRef": - out += [padding + "out.extend(print_pair_id_id_list(operands, id_names)?);"] - elif kind == "PairIdRefLiteralInteger": - out += [padding + "out.extend(print_pair_id_u32_list(operands, id_names)?);"] - elif kind == "PairLiteralIntegerIdRef": - out += [padding + "out.extend(print_pair_u32_id_list(operands, id_names)?);"] - # Enum - else: - out += [padding + f"out.extend(print_enum_{kind}(operands, id_names)?);"] - - if quantifier == "*": - out += [ - padding[:-4] + "}", - ] - elif quantifier == "?": - out += [ - padding[:-4] + "}", - ] - elif quantifier is None: - pass - else: - raise RuntimeError(f"unknown quantifier {quantifier}") - - return out - - -for kind, (category, parameters) in operand_parameters.items(): - out += [ - "#[allow(non_snake_case)]", - "#[allow(dead_code)]", - "#[allow(unused_variables)]", - f"fn print_enum_{kind}(operands: &mut Operands, id_names: &HashMap) -> Result> {{", - " let value = operands.read_u32()?;", - " #[allow(unused_mut)]", - f' let mut out = vec![enum_to_str(&"{kind}", value)?];', - ] - if category == "ValueEnum": - out += [ - " match value {", - ] - for value, (parameter_name, params) in parameters.items(): - out += [ - f" // {parameter_name}", - f" {value} => {{", - ] - for i, param in enumerate(params): - out += print_operand(param, None, 3) - - out += [ - " }", - ] - out += [ - " _ => {},", - " }", - ] - elif category == "BitEnum": - for value, (parameter_name, params) in parameters.items(): - out += [ - f" // {parameter_name}", - f" if value & {value} != 0 {{", - ] - for i, param in enumerate(params): - out += print_operand(param, None, 2) - - out += [ - " }", - ] - else: - raise RuntimeError(f"unsupported enum category: {category}") - - out += [ - " Ok(out)", - "}", - "", - ] - -out += [ - "pub fn print_operand(opcode: u32, operands: &mut Operands, id_names: &HashMap) -> Result> {", - " let mut out: Vec = Vec::new();", - " match opcode {", -] - -for opcode, (opname, op_operand_kinds) in ops.items(): - out += [ - f" // {opname}", - f" {opcode} => {{", - ] - for kind, quantifier in op_operand_kinds: - if kind in ["IdResult", "IdResultType"]: - continue - - out += print_operand(kind, quantifier, 3) - # Deal with extra operands. We don't know what they are but we can print them as u32 anyway. - out += [ - " }", - ] - -out += [ - ' _ => bail!("unsupported opcode {}", opcode),', - " };", - " while operands.len() != 0 {", - ' out.push(format!("!{}", operands.read_u32()?));', - " }", - " Ok(out)", - "}", - "", -] - -with open("spirq-spvasm/src/generated/print_operand.rs", "w") as f: - f.write("\n".join(out)) diff --git a/spirq-spvasm/src/asm/assembler.rs b/spirq-spvasm/src/asm/assembler.rs deleted file mode 100644 index 9dd99cb..0000000 --- a/spirq-spvasm/src/asm/assembler.rs +++ /dev/null @@ -1,730 +0,0 @@ -use std::collections::{hash_map::Entry, HashMap, HashSet}; - -use super::tokenizer::{Lit, Token, Tokenizer}; -use crate::generated; -use anyhow::{anyhow, bail, Result}; -use half::f16; -use num_traits::FromPrimitive; -use spirq_core::{ - parse::{bin::SpirvHeader, InstructionBuilder, SpirvBinary}, - spirv::Op, - ty::ScalarType, -}; - -#[derive(Debug, Clone, Hash, PartialEq, Eq)] -enum IdRef { - Name(String), - Id(u32), -} -#[derive(Debug, Clone)] -enum Operand { - IdRef(IdRef), - Literal(Lit), - Ident(String), -} - -#[derive(Debug, Clone)] -struct Instruction { - result_id: Option, - opcode: u32, - operands: Vec, -} - -struct TokenStream<'a> { - tokenizer: Tokenizer<'a>, - cache: Option, -} -impl<'a> TokenStream<'a> { - fn new(tokenizer: Tokenizer<'a>) -> Result { - let mut out = Self { - tokenizer, - cache: None, - }; - out.load_next()?; - Ok(out) - } - - fn load_next(&mut self) -> Result<()> { - self.cache = self.tokenizer.next().transpose()?; - Ok(()) - } - - fn peek(&mut self) -> Option<&Token> { - self.cache.as_ref() - } - fn next(&mut self) -> Result> { - let last_cache = self.cache.take(); - self.load_next()?; - Ok(last_cache) - } -} - -/// SPIR-V assembler. -#[derive(Default)] -pub struct Assembler { - name2id: HashMap, - used_ids: HashSet, - next_id: u32, - bound: u32, - // The LieteralContextDependentNumber in OpConstant depends on the type of - // the constant. So we need to keep track of the type of each constant. - scalar_tys: HashMap, -} -impl Assembler { - /// Create a new SPIR-V assembler. - pub fn new() -> Self { - Self { - next_id: 1, - bound: 1, - ..Default::default() - } - } - - fn parse_opcode(&self, s: &mut TokenStream) -> Result { - let token = s.next()?.ok_or_else(|| anyhow!("expected opcode"))?; - match token { - Token::Ident(ident) => generated::op_from_str(&ident), - _ => Err(anyhow!("expected opcode")), - } - } - - fn str2idref(&self, id: String) -> IdRef { - if let Some(id) = id.parse::().ok() { - IdRef::Id(id) - } else { - IdRef::Name(id) - } - } - fn parse_idref(&self, s: &mut TokenStream) -> Result { - let token = s.next()?.ok_or_else(|| anyhow!("expected idref"))?; - let idref = match token { - Token::IdRef(id) => self.str2idref(id), - _ => unreachable!(), - }; - Ok(idref) - } - - fn parse_operand(&self, s: &mut TokenStream) -> Result { - let token = s.next()?.ok_or_else(|| anyhow!("expected operand"))?; - match token { - Token::IdRef(id) => { - let idref = self.str2idref(id); - Ok(Operand::IdRef(idref)) - } - Token::Literal(lit) => Ok(Operand::Literal(lit.clone())), - Token::Ident(ident) => Ok(Operand::Ident(ident.clone())), - _ => Err(anyhow!("expected operand, but {:?}", token)), - } - } - - fn parse_instr_with_result_id(&self, s: &mut TokenStream) -> Result { - let result_id = self.parse_idref(s)?; - let eq_token = s.next()?.ok_or_else(|| anyhow!("expected '='"))?; - if !matches!(eq_token, Token::Eq) { - bail!("expected '='"); - } - let opcode = self.parse_opcode(s)?; - - let mut operands = Vec::new(); - while let Some(token) = s.peek() { - match token { - Token::Comment(_) => { - s.next()?; - } - Token::NewLine => { - s.next()?; - break; - } - _ => { - let operand = self.parse_operand(s)?; - operands.push(operand); - } - }; - } - - let out = Instruction { - result_id: Some(result_id), - opcode, - operands, - }; - Ok(out) - } - fn parse_instr_without_result_id(&self, s: &mut TokenStream) -> Result { - let opcode = self.parse_opcode(s)?; - let mut operands = Vec::new(); - - while let Some(token) = s.peek() { - match token { - Token::Comment(_) => { - s.next()?; - } - Token::NewLine => { - s.next()?; - break; - } - _ => { - let operand = self.parse_operand(s)?; - operands.push(operand); - } - }; - } - - let out = Instruction { - result_id: None, - opcode, - operands, - }; - Ok(out) - } - - fn parse_instr(&self, s: &mut TokenStream) -> Result> { - while let Some(token) = s.peek() { - match token { - Token::Comment(_) => { - s.next()?; - } - Token::NewLine => { - s.next()?; - } - Token::Ident(_) => { - let instr = self.parse_instr_without_result_id(s)?; - return Ok(Some(instr)); - } - Token::IdRef(_) => { - let instr = self.parse_instr_with_result_id(s)?; - return Ok(Some(instr)); - } - _ => { - bail!("unexpected token {:?}", token); - } - } - } - Ok(None) - } - - fn parse_instrs(&self, s: &mut TokenStream) -> Result> { - let mut instrs = Vec::new(); - while let Some(instr) = self.parse_instr(s)? { - instrs.push(instr); - } - Ok(instrs) - } - - fn parse(&self, input: &str) -> Result> { - let tokenizer = Tokenizer::new(input); - let mut s = TokenStream::new(tokenizer)?; - self.parse_instrs(&mut s) - } - - fn mark_id(&mut self, id: u32) { - self.used_ids.insert(id); - } - fn acquire_id(&mut self, name: &str) -> u32 { - if let Some(id) = self.name2id.get(name) { - return *id; - } - let mut id = self.next_id; - while self.used_ids.contains(&id) { - id += 1; - } - self.next_id = id + 1; - self.name2id.insert(name.to_owned(), id); - self.used_ids.insert(id); - id - } - fn process_idref(&mut self, idref: &IdRef) -> Result { - let out = match idref { - IdRef::Name(name) => { - let id = self.acquire_id(name); - IdRef::Id(id) - } - IdRef::Id(id) => IdRef::Id(*id), - }; - Ok(out) - } - - // Call this after you sanitized named refs to ID refs. - fn assemble_op_type_int(&mut self, instr: &Instruction) -> Result> { - if instr.operands.len() != 2 { - bail!("OpTypeInt expected 2 operands"); - } - let width = match instr.operands[0] { - Operand::Literal(Lit::Int(i)) => i as u32, - _ => bail!("OpTypeInt width expected literal integer"), - }; - let signedness = match instr.operands[1] { - Operand::Literal(Lit::Int(i)) => i as u32, - _ => bail!("OpTypeInt signedness expected literal integer"), - }; - - let result_id = instr - .result_id - .as_ref() - .and_then(|idref| match idref { - IdRef::Id(id) => Some(*id), - _ => None, - }) - .ok_or_else(|| anyhow!("OpTypeInt expected result id"))?; - - match self.scalar_tys.entry(result_id) { - Entry::Vacant(entry) => { - let scalar_ty = ScalarType::Integer { - bits: width, - is_signed: signedness != 0, - }; - entry.insert(scalar_ty); - } - Entry::Occupied(_) => bail!("OpTypeInt result id already exists"), - } - - let instr = InstructionBuilder::new(Op::TypeInt) - .push(result_id) - .push(width) - .push(signedness) - .build(); - Ok(instr.into_words()) - } - // Call this after you sanitized named refs to ID refs. - fn assemble_op_type_float(&mut self, instr: &Instruction) -> Result> { - if instr.operands.len() != 1 { - bail!("OpTypeFloat expected 1 operand"); - } - let width = match instr.operands[0] { - Operand::Literal(Lit::Int(i)) => i as u32, - _ => bail!("OpTypeFloat width expected literal integer"), - }; - - let result_id = instr - .result_id - .as_ref() - .and_then(|idref| match idref { - IdRef::Id(id) => Some(*id), - _ => None, - }) - .ok_or_else(|| anyhow!("OpTypeFloat expected result id"))?; - - match self.scalar_tys.entry(result_id) { - Entry::Vacant(entry) => { - let scalar_ty = ScalarType::Float { bits: width }; - entry.insert(scalar_ty); - } - Entry::Occupied(_) => bail!("OpTypeFloat result id already exists"), - } - - let instr = InstructionBuilder::new(Op::TypeFloat) - .push(result_id) - .push(width) - .build(); - Ok(instr.into_words()) - } - fn assemble_op_constant(&mut self, instr: &Instruction) -> Result> { - if instr.operands.len() != 2 { - bail!("OpConstant expected 2 operands"); - } - let result_type_id = match instr.operands[0] { - Operand::IdRef(IdRef::Id(id)) => id, - _ => bail!("OpConstant expected result type id"), - }; - let result_id = match instr.result_id.as_ref() { - Some(IdRef::Id(id)) => *id, - _ => bail!("OpConstant expected result id"), - }; - - let scalar_ty = self - .scalar_tys - .get(&result_type_id) - .ok_or_else(|| anyhow!("OpConstant result type id not found"))?; - - fn lit2int(lit: &Lit) -> Result { - match lit { - Lit::Int(i) => Ok(*i), - Lit::Float(f) => { - let f = *f as f32; - Ok(f as i64) - } - Lit::String(_) => bail!("OpConstant expected a int or float literal"), - } - } - fn lit2float(lit: &Lit) -> Result { - match lit { - Lit::Int(i) => Ok(*i as f64), - Lit::Float(f) => { - let f = *f as f32; - Ok(f as f64) - } - Lit::String(_) => bail!("OpConstant expected a int or float literal"), - } - } - - let value = match &instr.operands[1] { - Operand::Literal(lit) => lit, - _ => bail!("OpConstant expected a literal value"), - }; - - let mut value_buf = [0u32; 2]; - let value: &[u32] = match scalar_ty { - ScalarType::Integer { - bits: 8, - is_signed: true, - } => { - let value = lit2int(value)?; - if let Some(value) = i8::from_i64(value) { - value_buf[0] = value as u32; - &value_buf[..1] - } else { - bail!("expected a i8 literal in range [-128, 127]"); - } - } - ScalarType::Integer { - bits: 16, - is_signed: true, - } => { - let value = lit2int(value)?; - if let Some(value) = i16::from_i64(value) { - value_buf[0] = value as u32; - &value_buf[..1] - } else { - bail!("expected a i16 literal in range [-32768, 32767]"); - } - } - ScalarType::Integer { - bits: 32, - is_signed: true, - } => { - let value = lit2int(value)?; - if let Some(value) = i32::from_i64(value) { - value_buf[0] = value as u32; - &value_buf[..1] - } else { - bail!("expected a i32 literal in range [-2147483648, 2147483647]"); - } - } - ScalarType::Integer { - bits: 64, - is_signed: true, - } => { - let value = lit2int(value)?; - let x = value.to_le_bytes(); - value_buf[0] = u32::from_le_bytes([x[0], x[1], x[2], x[3]]); - value_buf[1] = u32::from_le_bytes([x[4], x[5], x[6], x[7]]); - &value_buf[..2] - } - ScalarType::Integer { - bits: 8, - is_signed: false, - } => { - let value = lit2int(value)?; - if let Some(value) = u8::from_i64(value) { - value_buf[0] = value as u32; - &value_buf[..1] - } else { - bail!("expected a u8 literal in range [0, 255]"); - } - } - ScalarType::Integer { - bits: 16, - is_signed: false, - } => { - let value = lit2int(value)?; - if let Some(value) = u16::from_i64(value) { - value_buf[0] = value as u32; - &value_buf[..1] - } else { - bail!("expected a u16 literal in range [0, 65535]"); - } - } - ScalarType::Integer { - bits: 32, - is_signed: false, - } => { - let value = lit2int(value)?; - if let Some(value) = u32::from_i64(value) { - value_buf[0] = value as u32; - &value_buf[..1] - } else { - bail!("expected a u32 literal in range [0, 4294967295]"); - } - } - ScalarType::Integer { - bits: 64, - is_signed: false, - } => { - let value = lit2int(value)?; - let x = value.to_le_bytes(); - value_buf[0] = u32::from_le_bytes([x[0], x[1], x[2], x[3]]); - value_buf[1] = u32::from_le_bytes([x[4], x[5], x[6], x[7]]); - &value_buf[..2] - } - ScalarType::Float { bits: 16 } => { - let value = f16::from_f64(lit2float(value)?); - let x = value.to_bits(); - value_buf[0] = x as u32; - &value_buf[..1] - } - ScalarType::Float { bits: 32 } => { - let value = lit2float(value)? as f32; - let x = value.to_bits(); - value_buf[0] = x; - &value_buf[..1] - } - ScalarType::Float { bits: 64 } => { - let value = lit2float(value)?; - let x = value.to_bits().to_le_bytes(); - value_buf[0] = u32::from_le_bytes([x[0], x[1], x[2], x[3]]); - value_buf[1] = u32::from_le_bytes([x[4], x[5], x[6], x[7]]); - &value_buf[..2] - } - _ => bail!("OpConstant unsupported result type"), - }; - - let instr = InstructionBuilder::new(Op::Constant) - .push(result_type_id) - .push(result_id) - .push_list(value) - .build(); - Ok(instr.into_words()) - } - fn assemble_op_decorate(&mut self, instr: &Instruction) -> Result> { - if instr.operands.len() < 2 { - bail!("OpDecorate expected at least 2 operands"); - } - let target_id = match &instr.operands[0] { - Operand::IdRef(IdRef::Id(id)) => *id, - _ => bail!("OpDecorate expected target id"), - }; - let decoration = match &instr.operands[1] { - Operand::Ident(ident) => generated::enum_from_str("Decoration", &ident)?, - Operand::Literal(Lit::Int(i)) => *i as u32, - _ => bail!("OpDecorate expected decoration"), - }; - let mut parameters = Vec::new(); - for (i, parameter) in instr.operands[2..].iter().enumerate() { - let parameter = match parameter { - Operand::IdRef(IdRef::Id(id)) => *id, - Operand::Literal(Lit::Int(i)) => *i as u32, - Operand::Ident(ident) => { - let ety = generated::decorate_parameter_enum_type(decoration, i)?; - let e = generated::enum_from_str(ety, &ident)?; - e - } - _ => bail!("OpDecorate expected parameter"), - }; - parameters.push(parameter); - } - - let instr = InstructionBuilder::new(Op::Decorate) - .push(target_id) - .push(decoration) - .push_list(¶meters[..]) - .build(); - Ok(instr.into_words()) - } - fn assemble_op_member_decorate(&mut self, instr: &Instruction) -> Result> { - if instr.operands.len() < 3 { - bail!("OpMemberDecorate expected at least 3 operands"); - } - let target_id = match &instr.operands[0] { - Operand::IdRef(IdRef::Id(id)) => *id, - _ => bail!("OpMemberDecorate expected target id"), - }; - let member = match &instr.operands[1] { - Operand::Literal(Lit::Int(i)) => *i as u32, - _ => bail!("OpMemberDecorate expected member"), - }; - let decoration = match &instr.operands[2] { - Operand::Ident(ident) => generated::enum_from_str("Decoration", &ident)?, - Operand::Literal(Lit::Int(i)) => *i as u32, - _ => bail!("OpMemberDecorate expected decoration"), - }; - let mut parameters = Vec::new(); - for (i, parameter) in instr.operands[3..].iter().enumerate() { - let parameter = match parameter { - Operand::IdRef(IdRef::Id(id)) => *id, - Operand::Literal(Lit::Int(i)) => *i as u32, - Operand::Ident(ident) => { - let ety = generated::decorate_parameter_enum_type(decoration, i)?; - let e = generated::enum_from_str(ety, &ident)?; - e - } - _ => bail!("OpMemberDecorate expected parameter"), - }; - parameters.push(parameter); - } - - let instr = InstructionBuilder::new(Op::MemberDecorate) - .push(target_id) - .push(member) - .push(decoration) - .push_list(¶meters[..]) - .build(); - Ok(instr.into_words()) - } - - // Call this after you sanitized named refs to ID refs. - fn assemble_special_instr(&mut self, instr: &Instruction) -> Result>> { - const OP_TYPE_INT: u32 = Op::TypeInt as u32; - const OP_TYPE_FLOAT: u32 = Op::TypeFloat as u32; - const OP_CONSTANT: u32 = Op::Constant as u32; - const OP_DECORATE: u32 = Op::Decorate as u32; - const OP_MEMBER_DECORATE: u32 = Op::MemberDecorate as u32; - - let out = match instr.opcode { - OP_TYPE_INT => Some(self.assemble_op_type_int(instr)?), - OP_TYPE_FLOAT => Some(self.assemble_op_type_float(instr)?), - OP_CONSTANT => Some(self.assemble_op_constant(instr)?), - OP_DECORATE => Some(self.assemble_op_decorate(instr)?), - OP_MEMBER_DECORATE => Some(self.assemble_op_member_decorate(instr)?), - _ => None, - }; - Ok(out) - } - fn assemble_general_instr(&mut self, instr: &Instruction) -> Result> { - let opcode = - Op::from_u32(instr.opcode).ok_or_else(|| anyhow!("unknown opcode {}", instr.opcode))?; - let mut builder = InstructionBuilder::new(opcode); - - let mut operands = instr.operands.iter(); - if generated::op_has_result_type_id(instr.opcode)? { - // The first operand in spvasm is the result type id (if the op - // has one). - match operands.next() { - Some(Operand::IdRef(IdRef::Id(id))) => { - builder = builder.push(*id); - self.bound = self.bound.max(*id + 1); - } - _ => bail!("expected result type id"), - } - } - - if generated::op_has_result_id(instr.opcode)? { - // The second operand in spvasm is the result id (if the op has one). - match instr.result_id { - Some(IdRef::Id(id)) => { - builder = builder.push(id); - } - _ => bail!("expected result id"), - } - } else { - if instr.result_id.is_some() { - bail!("unexpected result id"); - } - } - - for (i, operand) in operands.enumerate() { - match operand { - Operand::IdRef(IdRef::Name(_)) => unreachable!(), - Operand::IdRef(IdRef::Id(id)) => { - builder = builder.push(*id); - } - Operand::Literal(lit) => { - match lit { - Lit::Int(i) => { - if *i < 0 { - if let Some(i) = i32::from_i64(*i) { - builder = builder.push(i as u32); - } else { - bail!("literal integer out of range"); - } - } else { - if let Some(i) = u32::from_i64(*i) { - builder = builder.push(i); - } else { - bail!("literal integer out of range"); - } - } - } - Lit::Float(f) => { - // First cast to f32. - let f = *f as f32; - // Then bit cast to u32. - let u = f.to_bits(); - builder = builder.push(u); - } - Lit::String(s) => { - builder = builder.push_str(&s); - } - } - } - Operand::Ident(ident) => { - let ety = generated::operand_enum_type(instr.opcode, i)?; - let e = generated::enum_from_str(ety, &ident)?; - builder = builder.push(e); - } - } - } - - let instr = builder.build(); - Ok(instr.into_words()) - } - - fn assemble_instr(&mut self, instr: &Instruction) -> Result> { - if let Some(buf) = self.assemble_special_instr(instr)? { - return Ok(buf); - } - let buf = self.assemble_general_instr(instr)?; - Ok(buf) - } - - /// Assemble a SPIR-V binary from the given SPIR-V assembly and header. - pub fn assemble(&mut self, input: &str, header: SpirvHeader) -> Result { - let mut instrs = self.parse(input)?; - - // Mark all used IDs. - for instr in &instrs { - if let Some(result_id) = &instr.result_id { - match result_id { - IdRef::Id(id) => { - self.mark_id(*id); - } - IdRef::Name(_) => {} - } - } - for operand in &instr.operands { - match operand { - Operand::IdRef(IdRef::Id(id)) => { - self.mark_id(*id); - } - _ => {} - } - } - } - - // Transform name refs to id refs. - for instr in &mut instrs { - if let Some(result_id) = &mut instr.result_id { - *result_id = self.process_idref(&result_id)?; - }; - - for operand in &mut instr.operands { - match operand { - Operand::IdRef(idref) => { - let idref = self.process_idref(idref)?; - *operand = Operand::IdRef(idref); - } - _ => {} - } - } - } - - // Collect instructions. - let mut buf = Vec::new(); - for instr in instrs { - let instr = self.assemble_instr(&instr)?; - buf.extend(instr); - } - - self.bound = self.bound.max(self.next_id); - - let mut spv = vec![ - 0x07230203, // Magic number - header.version, // Version - header.generator, // Generator - self.bound, // Bound - 0, // Reserved word - ]; - spv.extend(buf); - - let out = SpirvBinary::from(spv); - Ok(out) - } -} diff --git a/spirq-spvasm/src/asm/mod.rs b/spirq-spvasm/src/asm/mod.rs deleted file mode 100644 index d26e5db..0000000 --- a/spirq-spvasm/src/asm/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -mod assembler; -mod tokenizer; - -pub use assembler::Assembler; diff --git a/spirq-spvasm/src/asm/tokenizer.rs b/spirq-spvasm/src/asm/tokenizer.rs deleted file mode 100644 index 69f47a5..0000000 --- a/spirq-spvasm/src/asm/tokenizer.rs +++ /dev/null @@ -1,554 +0,0 @@ -use std::iter::Peekable; -use std::str::Chars; -use std::str::FromStr; - -use anyhow::{anyhow, bail, Result}; - -#[derive(Debug, Clone)] -pub enum Lit { - Int(i64), - // Base numeric and the exponent bias. The effect of the bias depends on the - // actual floating-point type it casts to. - Float(f64), - String(String), -} - -#[derive(Debug)] -pub enum Token { - Comment(String), - Literal(Lit), - Ident(String), - IdRef(String), - Eq, - NewLine, -} - -pub struct Tokenizer<'a> { - chars: Box>>, -} -impl<'a> Tokenizer<'a> { - pub fn new(code: &'a str) -> Self { - Tokenizer { - chars: Box::new(code.chars().peekable()), - } - } - - pub fn tokenize_comment(&mut self) -> Result { - self.chars.next(); // Consume the initial ';'. - - let mut comment = String::new(); - while let Some(c) = self.chars.peek() { - if *c == '\n' { - break; - } - comment.push(*c); - self.chars.next(); - } - return Ok(Token::Comment(comment)); - } - - pub fn tokenize_idref(&mut self) -> Result { - self.chars.next(); // Consume the '%'. - - let mut buf = String::new(); - while let Some(c) = self.chars.peek() { - if c.is_ascii_alphanumeric() || c == &'_' { - buf.push(*c); - self.chars.next(); - } else { - break; - } - } - return Ok(Token::IdRef(buf)); - } - - pub fn tokenize_numeric_literal_decimal(&mut self) -> Result { - let mut buf = String::new(); - buf.push('0'); // So that we can tolerate numerics failed from hexadecimal parsing. - while let Some(c) = self.chars.peek() { - if c.is_ascii_digit() { - buf.push(*c); - self.chars.next(); - } else { - break; - } - } - let lit = match self.chars.peek() { - Some('.') => { - // Float. - buf.push('.'); - self.chars.next(); - while let Some(c) = self.chars.peek() { - if c.is_ascii_digit() { - buf.push(*c); - self.chars.next(); - } else { - break; - } - } - if let Some(c) = self.chars.peek() { - if c == &'e' || c == &'E' { - // Float with exponent. - buf.push(*c); - self.chars.next(); - while let Some(c) = self.chars.peek() { - if c.is_ascii_digit() || c == &'+' || c == &'-' { - buf.push(*c); - self.chars.next(); - } else { - break; - } - } - } - } - Lit::Float(f64::from_str(buf.as_str())?) - } - _ => { - // Integer. - Lit::Int(i64::from_str(buf.as_str())?) - } - }; - Ok(lit) - } - - pub fn tokenize_numeric_literal_hexadecimal(&mut self) -> Result { - let mut int_buf = String::new(); - while let Some(c) = self.chars.peek() { - if c.is_ascii_hexdigit() { - int_buf.push(*c); - self.chars.next(); - } else { - break; - } - } - - // Fraction without the dot. - let mut fraction_buf = String::new(); - if (int_buf == "0" || int_buf == "1") && (self.chars.peek() == Some(&'.')) { - self.chars.next(); // Consume the '.'. - - while let Some(c) = self.chars.peek() { - if c.is_ascii_hexdigit() { - fraction_buf.push(*c); - self.chars.next(); - } else { - break; - } - } - } - - let mut exponent_buf = String::new(); - if let Some('p') = self.chars.peek().map(|x| x.to_ascii_lowercase()) { - self.chars.next(); // Consume the 'p' or 'P'. - - // Float with exponent. - match self.chars.peek() { - Some('+') => { - self.chars.next(); - } - Some('-') => { - exponent_buf.push('-'); - self.chars.next(); - } - _ => {} - } - while let Some(c) = self.chars.peek() { - if c.is_ascii_digit() { - exponent_buf.push(*c); - self.chars.next(); - } else { - break; - } - } - } - - let is_hexadecimal_float = fraction_buf.len() > 0 || exponent_buf.len() > 0; - if !fraction_buf.is_empty() { - if exponent_buf.is_empty() { - bail!("hexadecimal value with fraction part but the exponent bias is missing"); - } - } - - let lit = if is_hexadecimal_float { - // Assemble hexadecimal floating point numbers. - let int = i64::from_str_radix(&int_buf, 16)?; - let fraction = match fraction_buf.is_empty() { - true => 0, - false => i64::from_str_radix(&fraction_buf, 16)?, - }; - let exponent = i32::from_str(&exponent_buf)?; - - fraction_buf = fraction_buf.trim_start_matches('0').to_string(); - let f = ((int as f64) + (fraction as f64) / 16f64.powi(fraction_buf.len() as i32)) - * 2f64.powi(exponent); - Lit::Float(f) - } else { - let i = i64::from_str_radix(&int_buf, 16)?; - Lit::Int(i) - }; - - Ok(lit) - } - - /// Tokenize a SPIR-V assembly numeric literal that can be decimal, hexadecimal, - /// decimal and hexadecimal numbers. - pub fn tokenize_numeric_literal(&mut self) -> Result { - let mut c = *self - .chars - .peek() - .ok_or_else(|| anyhow!("unexpected end of input"))?; - - let mantissa_sign = match c { - '-' => { - self.chars.next(); - c = *self - .chars - .peek() - .ok_or_else(|| anyhow!("unexpected end of input"))?; - -1 - } - _ => 1, - }; - - let lit = if c == '0' { - self.chars.next(); // Consume the initial '0'. - match self.chars.peek() { - Some('x') | Some('X') => { - // Hexadecimal. - self.chars.next(); // Consume the 'x' or 'X'. - self.tokenize_numeric_literal_hexadecimal()? - } - _ => { - // Decimal. - self.tokenize_numeric_literal_decimal()? - } - } - } else { - // Decimal. - self.tokenize_numeric_literal_decimal()? - }; - - // Weird special case of image `Dim`, in which there are `1D``, `2D`` - // and `3D` as identifiers. This it rather annoying. - if let Lit::Int(i) = lit { - if self.chars.peek() == Some(&'D') { - self.chars.next(); // Consume the 'D'. - return Ok(Token::Ident(format!("{}D", i))); - } - } - - let lit = match lit { - Lit::Int(i) => Lit::Int(i * mantissa_sign), - Lit::Float(f) => Lit::Float(f * mantissa_sign as f64), - Lit::String(_) => unreachable!(), - }; - - let token = Token::Literal(lit); - Ok(token) - } - - pub fn tokenize_string_literal(&mut self) -> Result { - self.chars.next(); // Consume the initial '"'. - - let mut string = String::new(); - let mut escape = false; - - while let Some(c) = self.chars.next() { - if escape { - // Escaped character. - escape = false; - string.push(c) - } else { - match c { - '\\' => { - escape = true; - continue; - } - '"' => break, - _ => string.push(c), - } - } - } - let lit = Lit::String(string); - let token = Token::Literal(lit); - - return Ok(token); - } - - pub fn tokenize_ident(&mut self) -> Result { - let mut ident = String::new(); - while let Some(c) = self.chars.peek() { - if c.is_ascii_alphanumeric() || c == &'_' { - ident.push(*c); - self.chars.next(); - } else { - break; - } - } - return Ok(Token::Ident(ident)); - } - - pub fn tokenize(&mut self) -> Result> { - if let Some(c) = self.chars.peek() { - // Ignore LWS. - if c.is_ascii_whitespace() { - while let Some(c) = self.chars.peek() { - if *c == '\n' { - self.chars.next(); - return Ok(Some(Token::NewLine)); - } else if c.is_ascii_whitespace() { - self.chars.next(); - } else { - break; - } - } - return self.tokenize(); - } - - // Comments. - if c == &';' { - let token = self.tokenize_comment()?; - return Ok(Some(token)); - } - - // Punctuations. - if c == &'=' { - self.chars.next(); // Consume the '='. - let token = Token::Eq; - return Ok(Some(token)); - } - - // IdRefs. - if c == &'%' { - let token = self.tokenize_idref()?; - return Ok(Some(token)); - } - - // Literal numerics. - if c == &'-' || c.is_ascii_digit() { - let token = self.tokenize_numeric_literal(); - return Ok(Some(token?)); - } - - // Literal string. - if c == &'"' { - let token = self.tokenize_string_literal()?; - return Ok(Some(token)); - } - - // Identifiers. - if c.is_ascii_alphabetic() || c == &'_' { - let token = self.tokenize_ident()?; - return Ok(Some(token)); - } - - bail!("unexpected character: {}", c); - } else { - return Ok(None); - } - } -} -impl<'a> Iterator for Tokenizer<'a> { - type Item = Result; - - fn next(&mut self) -> Option { - self.tokenize().transpose() - } -} - -#[cfg(test)] -mod test { - use super::*; - - pub fn tokenize(code: &str) -> Result> { - let tokenizer = Tokenizer::new(code); - let tokens = tokenizer.collect::>>(); - tokens - } - - #[test] - fn test_tokenize_nothing() { - let code = ""; - let tokens = tokenize(code).unwrap(); - assert_eq!(tokens.len(), 0); - } - - #[test] - fn test_tokenize_integers() { - let code = "0 1 2 3 4 5 6 7 8 9"; - let tokens = tokenize(code).unwrap(); - assert_eq!(tokens.len(), 10); - for (i, token) in tokens.iter().enumerate() { - match token { - Token::Literal(Lit::Int(n)) => assert_eq!(*n, i as i64), - _ => panic!("unexpected token: {:?}", token), - } - } - } - - #[test] - fn test_tokenize_floats() { - let code = "0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0"; - let tokens = tokenize(code).unwrap(); - assert_eq!(tokens.len(), 8); - for (i, token) in tokens.iter().enumerate() { - match token { - Token::Literal(Lit::Float(n)) => assert_eq!(*n, i as f64), - _ => panic!("unexpected token: {:?}", token), - } - } - } - - #[test] - fn test_tokenize_floats_with_exponent() { - let code = "0.0e0 1.0e1 2.0e2 3.0e3 4.0e4 5.0e5 6.0e6 7.0e7"; - let tokens = tokenize(code).unwrap(); - assert_eq!(tokens.len(), 8); - for (i, token) in tokens.iter().enumerate() { - match token { - Token::Literal(Lit::Float(n)) => { - assert_eq!(*n, (i as f64) * 10.0f64.powi(i as i32)) - } - _ => panic!("unexpected token: {:?}", token), - } - } - } - - #[test] - fn test_tokenize_floats_with_exponent_and_sign() { - let code = "0.0e+0 1.0e-1 2.0e+2 3.0e-3 4.0e+4 5.0e-5 6.0e+6 7.0e-7"; - let tokens = tokenize(code).unwrap(); - assert_eq!(tokens.len(), 8); - for (i, token) in tokens.iter().enumerate() { - match token { - Token::Literal(Lit::Float(n)) => assert_eq!( - *n, - (i as f64) * 10.0f64.powi((i as i32) * (if i % 2 == 0 { 1 } else { -1 })) - ), - _ => panic!("unexpected token: {:?}", token), - } - } - } - - #[test] - fn test_tokenize_hexadecimal_integers() { - let code = "0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7"; - let tokens = tokenize(code).unwrap(); - assert_eq!(tokens.len(), 8); - for (i, token) in tokens.iter().enumerate() { - match token { - Token::Literal(Lit::Int(n)) => assert_eq!(*n, i as i64), - _ => panic!("unexpected token: {:?}", token), - } - } - } - - #[test] - fn test_tokenize_hexadecimal_floats() { - let code = "0x1.0p0 -0x1.8p-1"; - let tokens = tokenize(code).unwrap(); - assert_eq!(tokens.len(), 2); - for (mantissa, token) in [1.0, -0.75].iter().zip(tokens.iter()) { - match token { - Token::Literal(Lit::Float(n)) => assert_eq!(*n, *mantissa), - _ => panic!("unexpected token: {:?}", token), - } - } - } - - #[test] - fn test_tokenize_string_literals() { - let code = r#""" "a" "ab" "abc" "abcd""#; - let tokens = tokenize(code).unwrap(); - assert_eq!(tokens.len(), 5); - let expected = ["", "a", "ab", "abc", "abcd"]; - for (i, token) in tokens.iter().enumerate() { - match token { - Token::Literal(Lit::String(s)) => assert_eq!(s, expected[i]), - _ => panic!("unexpected token: {:?}", token), - } - } - } - - #[test] - fn test_tokenize_string_literals_escape() { - let code = r#""\"\\\""#; - let tokens = tokenize(code).unwrap(); - assert_eq!(tokens.len(), 1); - let expected = r#""\""#; - for (_, token) in tokens.iter().enumerate() { - match token { - Token::Literal(Lit::String(s)) => assert_eq!(s, expected), - _ => panic!("unexpected token: {:?}", token), - } - } - } - - #[test] - fn test_tokenize_identifiers() { - let code = r#"a ab abc abcd abcd1 abcd12 abcd123"#; - let tokens = tokenize(code).unwrap(); - assert_eq!(tokens.len(), 7); - let expected = ["a", "ab", "abc", "abcd", "abcd1", "abcd12", "abcd123"]; - for (i, token) in tokens.iter().enumerate() { - match token { - Token::Ident(s) => assert_eq!(s, expected[i]), - _ => panic!("unexpected token: {:?}", token), - } - } - } - - #[test] - fn test_tokenize_comments() { - let code = r#"; a -; ab -; abc -; abcd -; abcd1 -; abcd12 -; abcd123"#; - let tokens = tokenize(code).unwrap(); - assert_eq!(tokens.len(), 13); - let expected = [ - " a", " ab", " abc", " abcd", " abcd1", " abcd12", " abcd123", - ]; - for (i, token) in tokens.iter().enumerate() { - if i % 2 == 0 { - match token { - Token::Comment(s) => assert_eq!(s, expected[i / 2]), - _ => panic!("unexpected token: {:?}", token), - } - } else { - match token { - Token::NewLine => {} - _ => panic!("unexpected token: {:?}", token), - } - } - } - } - - #[test] - fn test_tokenize_idref() { - let code = r#"%1 %123 %abc %abc123"#; - let tokens = tokenize(code).unwrap(); - assert_eq!(tokens.len(), 4); - let expected = ["1", "123", "abc", "abc123"]; - for (i, token) in tokens.iter().enumerate() { - match token { - Token::IdRef(s) => assert_eq!(s, expected[i]), - _ => panic!("unexpected token: {:?}", token), - } - } - } - - #[test] - fn test_tokenize_eq() { - let code = r#"="#; - let tokens = tokenize(code).unwrap(); - assert_eq!(tokens.len(), 1); - match tokens[0] { - Token::Eq => {} - _ => panic!("unexpected token: {:?}", tokens[0]), - } - } -} diff --git a/spirq-spvasm/src/dis/auto_name.rs b/spirq-spvasm/src/dis/auto_name.rs deleted file mode 100644 index 7cbc9f8..0000000 --- a/spirq-spvasm/src/dis/auto_name.rs +++ /dev/null @@ -1,240 +0,0 @@ -use anyhow::Result; -use std::collections::HashMap; - -use spirq::reflect::ReflectIntermediate; -use spirq_core::{ - constant::ConstantValue, - ty::{ArrayType, MatrixType, PointerType, ScalarType, StructType, Type, VectorType}, -}; - -use super::utils::to_hexadecimal_float; - -fn sanitize_name(name: &str) -> String { - name.chars() - .map(|c| if c == '-' { 'n' } else { c }) - .map(|c| if c.is_ascii_punctuation() { '_' } else { c }) - .collect::() -} - -struct AutoNamer { - names: HashMap, - cache: HashMap, - name_counter: HashMap, -} -impl AutoNamer { - fn assign_name(&mut self, id: u32, name: String) { - // Ignore second assignment. - if self.names.contains_key(&id) { - return; - } - match self.name_counter.entry(name.clone()) { - std::collections::hash_map::Entry::Vacant(e) => { - e.insert(0); - self.names.entry(id).or_insert(name.clone()); - } - std::collections::hash_map::Entry::Occupied(e) => { - let counter = e.into_mut(); - let name = format!("{}_{}", name, counter); - *counter += 1; - self.names.entry(id).or_insert(name); - } - } - } - - fn collect_annotated_names(&mut self, itm: &ReflectIntermediate) -> Result<()> { - for (name_key, name) in itm.name_reg.iter() { - if name_key.member_idx.is_none() { - // Sanitize name. Convert all punctuations to underscore. - let name = sanitize_name(name); - self.assign_name(name_key.id, name); - } - } - Ok(()) - } - - // Make type names. - - fn make_scalar_ty_name(&mut self, scalar_ty: &ScalarType) -> Option { - let out = match scalar_ty { - ScalarType::Void => "void".to_string(), - ScalarType::Boolean => "bool".to_string(), - ScalarType::Integer { - bits: 8, - is_signed: true, - } => "char".to_string(), - ScalarType::Integer { - bits: 16, - is_signed: true, - } => "short".to_string(), - ScalarType::Integer { - bits: 32, - is_signed: true, - } => "int".to_string(), - ScalarType::Integer { - bits: 64, - is_signed: true, - } => "long".to_string(), - ScalarType::Integer { - bits: 8, - is_signed: false, - } => "uchar".to_string(), - ScalarType::Integer { - bits: 16, - is_signed: false, - } => "ushort".to_string(), - ScalarType::Integer { - bits: 32, - is_signed: false, - } => "uint".to_string(), - ScalarType::Integer { - bits: 64, - is_signed: false, - } => "ulong".to_string(), - ScalarType::Float { bits: 16 } => "half".to_string(), - ScalarType::Float { bits: 32 } => "float".to_string(), - ScalarType::Float { bits: 64 } => "double".to_string(), - _ => return None, - }; - Some(out) - } - fn make_vector_ty_name(&mut self, vector_ty: &VectorType) -> Option { - let out = format!( - "v{}{}", - vector_ty.nscalar, - self.make_scalar_ty_name(&vector_ty.scalar_ty)? - ); - Some(out) - } - fn make_matrix_ty_name(&mut self, matrix_ty: &MatrixType) -> Option { - let out = format!( - "mat{}{}", - matrix_ty.nvector, - self.make_vector_ty_name(&matrix_ty.vector_ty)? - ); - Some(out) - } - - fn make_arr_ty_name(&mut self, arr_ty: &ArrayType) -> Option { - let out = if let Some(nelement) = arr_ty.nelement { - format!( - "_arr_{}_uint_{}", - self.make_ty_name(&arr_ty.element_ty)?, - nelement - ) - } else { - format!("_runtimearr_{}", self.make_ty_name(&arr_ty.element_ty)?) - }; - Some(out) - } - - fn make_pointer_ty_name(&mut self, pointer_ty: &PointerType) -> Option { - let out = if let Some(pointee_name) = self.make_ty_name(&pointer_ty.pointee_ty) { - format!("_ptr_{:?}_{}", pointer_ty.store_cls, pointee_name) - } else { - if let Some(id) = self.cache.get(&pointer_ty.pointee_ty) { - format!("_ptr_{:?}_{}", pointer_ty.store_cls, id) - } else { - return None; - } - }; - Some(out) - } - - fn make_ty_name(&mut self, ty: &Type) -> Option { - if let Some(cached_id) = self.cache.get(ty) { - if let Some(cached_name) = self.names.get(cached_id) { - return Some(cached_name.clone()); - } - } - - let out = match ty { - Type::Scalar(scalar_ty) => self.make_scalar_ty_name(scalar_ty), - Type::Vector(vector_ty) => self.make_vector_ty_name(vector_ty), - Type::Matrix(matrix_ty) => self.make_matrix_ty_name(matrix_ty), - Type::Array(arr_ty) => self.make_arr_ty_name(arr_ty), - Type::Struct(StructType { name, .. }) => name.as_ref().map(|x| sanitize_name(x)), - Type::DevicePointer(pointer_ty) => self.make_pointer_ty_name(pointer_ty), - _ => None, - }; - - out - } - - fn collect_ty_names(&mut self, itm: &ReflectIntermediate) -> Result<()> { - let mut tys = itm.ty_reg.iter().collect::>(); - tys.sort_by_key(|(id, _)| *id); - for (id, ty) in tys { - if let Some(name) = self.make_ty_name(ty) { - self.assign_name(*id, name); - self.cache.entry(ty.clone()).or_insert(*id); - } else { - self.cache.insert(ty.clone(), *id); - } - } - - Ok(()) - } - - fn make_const_name(&mut self, value: &ConstantValue) -> Option { - let mut out = match value { - ConstantValue::Bool(true) => "true".to_owned(), - ConstantValue::Bool(false) => "false".to_owned(), - ConstantValue::S8(x) => format!("char_{}", x), - ConstantValue::S16(x) => format!("short_{}", x), - ConstantValue::S32(x) => format!("int_{}", x), - ConstantValue::S64(x) => format!("long_{}", x), - ConstantValue::U8(x) => format!("uchar_{}", x), - ConstantValue::U16(x) => format!("ushort_{}", x), - ConstantValue::U32(x) => format!("uint_{}", x), - ConstantValue::U64(x) => format!("ulong_{}", x), - ConstantValue::F16(x) => format!("half_{}", to_hexadecimal_float(*x)), - ConstantValue::F32(x) => format!("float_{}", x), - ConstantValue::F64(x) => format!("double_{}", x), - _ => return None, - }; - out = sanitize_name(&out); - Some(out) - } - - fn collect_const_names(&mut self, itm: &ReflectIntermediate) -> Result<()> { - for (id, constant) in itm.interp.iter() { - if let Some(name) = constant.name.as_ref() { - self.assign_name(*id, name.clone()); - } else if let Some(name) = self.make_const_name(&constant.value) { - self.assign_name(*id, name); - } - } - Ok(()) - } -} - -pub fn collect_names( - itm: &ReflectIntermediate, - name_ids: bool, - name_type_ids: bool, - name_const_ids: bool, -) -> Result> { - let mut auto_namer = AutoNamer { - names: HashMap::new(), - cache: HashMap::new(), - name_counter: HashMap::new(), - }; - - // Infer type names. - if name_type_ids { - auto_namer.collect_ty_names(&itm)?; - auto_namer.collect_ty_names(&itm)?; - } - - // Infer constant names. - if name_const_ids { - auto_namer.collect_const_names(&itm)?; - } - - // Manually annotated ID by OpName. - if name_ids { - auto_namer.collect_annotated_names(&itm)?; - } - - Ok(auto_namer.names) -} diff --git a/spirq-spvasm/src/dis/disassembler.rs b/spirq-spvasm/src/dis/disassembler.rs deleted file mode 100644 index 8056d7e..0000000 --- a/spirq-spvasm/src/dis/disassembler.rs +++ /dev/null @@ -1,381 +0,0 @@ -use std::collections::HashMap; - -use super::auto_name; -use crate::{dis::utils::to_hexadecimal_float, generated}; -use anyhow::{bail, Result}; -use half::f16; -use spirq::{reflect::ReflectIntermediate, ReflectConfig}; -use spirq_core::{ - parse::{Instr, Instrs, Operands, SpirvBinary}, - spirv::Op, - ty::{self, Type}, -}; - -/// SPIR-V disassembler. -pub struct Disassembler { - print_header: bool, - name_ids: bool, - name_type_ids: bool, - name_const_ids: bool, - indent: bool, -} -impl Disassembler { - /// Create a new SPIR-V disassembler. - pub fn new() -> Self { - Self { - print_header: true, - name_ids: false, - name_type_ids: false, - name_const_ids: false, - indent: false, - } - } - - /// Print the metadata in SPIR-V header which looks like this: - /// - /// ```plaintext - /// ; SPIR-V - /// ; Version: 1.5 - /// ; Generator: Khronos Glslang Reference Front End; 11 - /// ; Bound: 406 - /// ; Schema: 0 - /// ``` - pub fn print_header(mut self, value: bool) -> Self { - self.print_header = value; - return self; - } - /// Reference intermediate values by their names rather than numeric IDs if - /// it has been annotated by OpName. - /// - /// If enabled, the input SPIR-V MUST follow the standard physical layout as - /// described in Section 2.3 in SPIR-V specification. - pub fn name_ids(mut self, value: bool) -> Self { - self.name_ids = value; - self - } - /// Reference type definitions by their names rather than numeric IDs. A - /// human-friendly name will be generated if it's not annotated by OpName. - /// - /// If enabled, the input SPIR-V MUST follow the standard physical layout as - /// described in Section 2.3 in SPIR-V specification. - pub fn name_type_ids(mut self, value: bool) -> Self { - self.name_type_ids = value; - self - } - /// Reference constant value by names rather than numeric IDs. A human- - /// friendly name will be generated if it's not annotated by OpName. - /// - /// If enabled, the input SPIR-V MUST follow the standard physical layout as - /// described in Section 2.3 in SPIR-V specification. - pub fn name_const_ids(mut self, value: bool) -> Self { - self.name_const_ids = value; - self - } - /// Indent the output. - pub fn indent(mut self, value: bool) -> Self { - self.indent = value; - self - } - - fn print_id(&self, id: u32, id_names: &HashMap) -> Result { - if let Some(name) = id_names.get(&id) { - return Ok(format!("%{}", name)); - } - Ok(format!("%{}", id)) - } - fn print_operands( - &self, - opcode: u32, - operands: &mut Operands<'_>, - id_names: &HashMap, - ) -> Result { - let out = generated::print_operand(opcode, operands, id_names)?.join(" "); - assert_eq!(operands.len(), 0); - Ok(out) - } - fn print_opcode(&self, opcode: u32) -> Result { - let opname = generated::op_to_str(opcode)?.to_owned(); - Ok(opname) - } - - // SPIR-V Tools emit numbers of any length as a single context dependent - // literal for OpConstant. But don't fail if we failed to make a guess - // of the type. - fn print_constant_op_operand<'a>( - &self, - result_type_id: Option, - operands: &mut Operands<'a>, - itm: &ReflectIntermediate, - ) -> Result { - let mut operands2 = operands.clone(); - - let out = if let Some(result_type_id) = result_type_id { - let ty = itm.ty_reg.get(result_type_id)?; - match ty { - Type::Scalar(scalar_ty) => match scalar_ty { - ty::ScalarType::Integer { - bits: 8, - is_signed: true, - } => { - let x = operands2.read_u32()?.to_le_bytes(); - format!(" {}", i8::from_le_bytes([x[0]])) - } - ty::ScalarType::Integer { - bits: 16, - is_signed: true, - } => { - let x = operands2.read_u32()?.to_le_bytes(); - format!(" {}", i16::from_le_bytes([x[0], x[1]])) - } - ty::ScalarType::Integer { - bits: 32, - is_signed: true, - } => { - let x = operands2.read_u32()?.to_le_bytes(); - format!(" {}", i32::from_le_bytes([x[0], x[1], x[2], x[3]])) - } - ty::ScalarType::Integer { - bits: 64, - is_signed: true, - } => { - let x = operands2.read_u32()?.to_le_bytes(); - let y = operands2.read_u32()?.to_le_bytes(); - format!( - " {}", - i64::from_le_bytes([x[0], x[1], x[2], x[3], y[0], y[1], y[2], y[3]]) - ) - } - ty::ScalarType::Integer { - bits: 8, - is_signed: false, - } => { - let x = operands2.read_u32()?.to_le_bytes(); - format!(" {}", u8::from_le_bytes([x[0]])) - } - ty::ScalarType::Integer { - bits: 16, - is_signed: false, - } => { - let x = operands2.read_u32()?.to_le_bytes(); - format!(" {}", u16::from_le_bytes([x[0], x[1]])) - } - ty::ScalarType::Integer { - bits: 32, - is_signed: false, - } => { - let x = operands2.read_u32()?.to_le_bytes(); - format!(" {}", u32::from_le_bytes([x[0], x[1], x[2], x[3]])) - } - ty::ScalarType::Integer { - bits: 64, - is_signed: false, - } => { - let x = operands2.read_u32()?.to_le_bytes(); - let y = operands2.read_u32()?.to_le_bytes(); - format!( - " {}", - u64::from_le_bytes([x[0], x[1], x[2], x[3], y[0], y[1], y[2], y[3]]) - ) - } - ty::ScalarType::Float { bits: 16 } => { - let x = operands2.read_u32()?.to_le_bytes(); - let f = f16::from_bits(u16::from_le_bytes([x[0], x[1]])); - format!(" {}", to_hexadecimal_float(f)) - } - ty::ScalarType::Float { bits: 32 } => { - let x = operands2.read_u32()?.to_le_bytes(); - format!(" {}", f32::from_le_bytes([x[0], x[1], x[2], x[3]])) - } - ty::ScalarType::Float { bits: 64 } => { - let x0 = operands2.read_u32()?.to_le_bytes(); - let x1 = operands2.read_u32()?.to_le_bytes(); - format!( - " {}", - f64::from_le_bytes([ - x0[0], x0[1], x0[2], x0[3], x1[0], x1[1], x1[2], x1[3] - ]) - ) - } - _ => bail!("unsupported scalar type for opconstant"), - }, - _ => bail!("opconstant cannot have a non-scalar type"), - } - } else { - bail!("opconstant must have a result type") - }; - - *operands = operands2; - Ok(out) - } - - fn print_line<'a>( - &self, - instr: &'a Instr, - itm: &ReflectIntermediate, - id_names: &HashMap, - ) -> Result { - let mut operands = instr.operands(); - let opcode = instr.opcode(); - let result_type_id = if generated::op_has_result_type_id(opcode)? { - Some(operands.read_id()?) - } else { - None - }; - let result_id = if generated::op_has_result_id(opcode)? { - Some(operands.read_id()?) - } else { - None - }; - - let mut out = String::new(); - if let Some(result_id) = result_id { - out.push_str(&self.print_id(result_id, id_names)?); - out.push_str(" = "); - } - out.push_str(&self.print_opcode(opcode)?); - if let Some(result_type_id) = result_type_id { - out.push_str(&format!(" {}", &self.print_id(result_type_id, id_names)?)); - } - - if opcode == (Op::Constant as u32) { - if let Ok(operand) = self.print_constant_op_operand(result_type_id, &mut operands, itm) - { - out.push_str(&operand); - } else { - // Tolerate the error and print the operands as usual. - } - } - - let operands_ = self.print_operands(opcode, &mut operands, id_names)?; - if !operands_.is_empty() { - out.push(' '); - out.push_str(&operands_); - } - - Ok(out) - } - fn print_lines<'a>( - &self, - instrs: &'a mut Instrs, - itm: &ReflectIntermediate, - id_names: HashMap, - ) -> Result> { - let mut out = Vec::new(); - while let Some(instr) = instrs.next()? { - out.push(self.print_line(instr, itm, &id_names)?); - } - Ok(out) - } - - fn print<'a>( - &self, - spv: &'a SpirvBinary, - itm: &ReflectIntermediate, - id_names: HashMap, - ) -> Result> { - self.print_lines(&mut spv.instrs()?, itm, id_names) - } - - /// Disamble SPIR-V binary into SPIR-V assembly code. - pub fn disassemble(&self, spv: &SpirvBinary) -> Result { - let mut out = Vec::new(); - - if self.print_header { - if let Some(header) = spv.header() { - out.push(format!("; SPIR-V")); - let major_version = header.version >> 16; - let minor_version = (header.version >> 8) & 0xff; - out.push(format!("; Version: {}.{}", major_version, minor_version)); - // FIXME: (penguinliong) This is a hack to match the spirv-dis - // output. - let generator = header.generator >> 16; - let generator_version = header.generator & 0xffff; - if generator == 8 { - out.push(format!( - "; Generator: Khronos Glslang Reference Front End; {}", - generator_version - )); - } else { - out.push(format!("; Generator: {}; {}", generator, generator_version)); - } - out.push(format!("; Bound: {}", header.bound)); - out.push(format!("; Schema: {:x}", header.schema)); - } - } - - let cfg = ReflectConfig::default(); - let itm = { - let mut itm = ReflectIntermediate::new(&cfg)?; - let mut instrs = spv.instrs()?; - itm.parse_global_declrs(&mut instrs)?; - itm - }; - - let id_names = if self.name_ids || self.name_type_ids || self.name_const_ids { - auto_name::collect_names(&itm, self.name_ids, self.name_type_ids, self.name_const_ids)? - } else { - HashMap::new() - }; - - let mut instrs = self.print(spv, &itm, id_names)?; - - if self.indent { - let max_eq_pos = instrs - .iter() - .filter_map(|instr| instr.find('=')) // Skip lines without an assignment. - .max() - .unwrap_or(0) - .min(15); - let mut instrs2 = Vec::new(); - for instr in instrs { - let indent = if let Some(eq_pos) = instr.find('=') { - max_eq_pos - eq_pos.min(max_eq_pos) - } else { - max_eq_pos + 2 - }; - instrs2.push(format!("{}{}", " ".repeat(indent), instr)); - } - instrs = instrs2; - } - - out.extend(instrs); - out.push(String::new()); // Add a trailing zero to align with spirv-dis. - - Ok(out.join("\n")) - } -} - -#[cfg(test)] -mod test { - use super::*; - - #[test] - fn test_simple() { - let spv = [0x07230203, 0x00010000, 0x00000000, 0x0000001, 0x00000000] - .iter() - .map(|x| *x as u32) - .collect::>(); - let spv = SpirvBinary::from(spv); - let out = Disassembler::new().disassemble(&spv).unwrap(); - assert_eq!( - out, - "; SPIR-V\n; Version: 1.0\n; Generator: 0; 0\n; Bound: 1\n; Schema: 0\n" - ); - } - - #[test] - fn test_nop() { - let spv = [ - 0x07230203, 0x00010000, 0x00000000, 0x0000001, 0x00000000, 0x00010000, - ] - .iter() - .map(|x| *x as u32) - .collect::>(); - let spv = SpirvBinary::from(spv); - let out = Disassembler::new().disassemble(&spv).unwrap(); - assert_eq!( - out, - "; SPIR-V\n; Version: 1.0\n; Generator: 0; 0\n; Bound: 1\n; Schema: 0\nOpNop\n" - ); - } -} diff --git a/spirq-spvasm/src/dis/mod.rs b/spirq-spvasm/src/dis/mod.rs deleted file mode 100644 index 897ea1f..0000000 --- a/spirq-spvasm/src/dis/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -mod auto_name; -mod disassembler; -#[cfg(test)] -mod test; -mod utils; - -pub use disassembler::Disassembler; diff --git a/spirq-spvasm/src/dis/test.rs b/spirq-spvasm/src/dis/test.rs deleted file mode 100644 index e071b97..0000000 --- a/spirq-spvasm/src/dis/test.rs +++ /dev/null @@ -1,21 +0,0 @@ -use super::Disassembler; -use pretty_assertions::assert_eq; -use spirq_core::parse::SpirvBinary; - -#[test] -fn test_disassembler() { - let actual = Disassembler::new(); - let spv = include_bytes!("../../../assets/gallery.frag.spv"); - let spvasm = actual - .name_ids(true) - .name_type_ids(true) - .name_const_ids(true) - .disassemble(&SpirvBinary::from(spv.as_ref())) - .unwrap(); - let expect = include_str!("../../../assets/gallery.frag.spvasm") - .lines() - .map(|x| x.trim().to_owned() + "\n") - .collect::>() - .concat(); - assert_eq!(expect, spvasm); -} diff --git a/spirq-spvasm/src/dis/utils.rs b/spirq-spvasm/src/dis/utils.rs deleted file mode 100644 index d5fb0c1..0000000 --- a/spirq-spvasm/src/dis/utils.rs +++ /dev/null @@ -1,51 +0,0 @@ -use num_traits::Float; - -pub fn to_hexadecimal_float(f: F) -> String { - let (mut mantissa, exponent, sign) = f.integer_decode(); - let mut exponent = exponent as i64; - - // Extract the sign bit. - let sign = if sign >= 0 { "" } else { "-" }; - - // Special case for zero. - if mantissa == 0 { - return format!("{}0x0p0", sign); - } - - // Remove the leading zeros and the implicit one. - let nleading_zero = mantissa.leading_zeros(); - mantissa <<= nleading_zero + 1; - exponent -= nleading_zero as i64 + 1; - - // Adjust for the exponent bias. - exponent += 64; - - let mut mantissa_str = String::new(); - while mantissa != 0 { - let digit = mantissa >> 60; - mantissa_str.push_str(&format!("{:x}", digit)); - mantissa <<= 4; - } - - if mantissa_str.is_empty() { - format!("{}0x1p{}", sign, exponent) - } else { - format!("{}0x1.{}p{}", sign, mantissa_str, exponent) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_print_hex_float() { - assert_eq!(to_hexadecimal_float(1.0), "0x1p0"); - assert_eq!(to_hexadecimal_float(2.0), "0x1p1"); - assert_eq!(to_hexadecimal_float(0.5), "0x1p-1"); - assert_eq!(to_hexadecimal_float(-0.5), "-0x1p-1"); - assert_eq!(to_hexadecimal_float(-0.75), "-0x1.8p-1"); - assert_eq!(to_hexadecimal_float(-0.875), "-0x1.cp-1"); - assert_eq!(to_hexadecimal_float(0.25), "0x1p-2"); - } -} diff --git a/spirq-spvasm/src/generated/decorate_parameter_enum_type.rs b/spirq-spvasm/src/generated/decorate_parameter_enum_type.rs deleted file mode 100644 index b608ed6..0000000 --- a/spirq-spvasm/src/generated/decorate_parameter_enum_type.rs +++ /dev/null @@ -1,77 +0,0 @@ -use anyhow::{bail, Result}; -use spirq_core::spirv::Op; - -fn unknown_decorate_parameter_index(decoration: u32, i: usize) -> Result<&'static str> { - let opname = Op::from_u32(decoration) - .map(|op| format!("{:?}", op)) - .unwrap_or("".to_owned()); - bail!( - "Unknown op {} ({}) parameter index: {}", - opname, - decoration, - i - ) -} - -pub fn decorate_parameter_enum_type(decoration: u32, i: usize) -> Result<&'static str> { - let out: &'static str = match decoration { - 11 => match i { - 0 => "BuiltIn", - _ => return unknown_decorate_parameter_index(decoration, i), - }, - 38 => match i { - 0 => "FunctionParameterAttribute", - _ => return unknown_decorate_parameter_index(decoration, i), - }, - 39 => match i { - 0 => "FPRoundingMode", - _ => return unknown_decorate_parameter_index(decoration, i), - }, - 40 => match i { - 0 => "FPFastMathMode", - _ => return unknown_decorate_parameter_index(decoration, i), - }, - 41 => match i { - 1 => "LinkageType", - _ => return unknown_decorate_parameter_index(decoration, i), - }, - 5822 => match i { - 1 => "FPRoundingMode", - _ => return unknown_decorate_parameter_index(decoration, i), - }, - 5823 => match i { - 1 => "FPDenormMode", - _ => return unknown_decorate_parameter_index(decoration, i), - }, - 6080 => match i { - 1 => "FPOperationMode", - _ => return unknown_decorate_parameter_index(decoration, i), - }, - 6180 => match i { - 0 => "AccessQualifier", - _ => return unknown_decorate_parameter_index(decoration, i), - }, - 6188 => match i { - 0 => "HostAccessQualifier", - _ => return unknown_decorate_parameter_index(decoration, i), - }, - 6190 => match i { - 0 => "InitializationModeQualifier", - _ => return unknown_decorate_parameter_index(decoration, i), - }, - 6442 => match i { - 1 => "LoadCacheControl", - _ => return unknown_decorate_parameter_index(decoration, i), - }, - 6443 => match i { - 1 => "StoreCacheControl", - _ => return unknown_decorate_parameter_index(decoration, i), - }, - _ => bail!( - "{}-th parameter of decoration {} is not a enum", - i, - decoration - ), - }; - Ok(out) -} diff --git a/spirq-spvasm/src/generated/enum_from_str.rs b/spirq-spvasm/src/generated/enum_from_str.rs deleted file mode 100644 index 8124fc5..0000000 --- a/spirq-spvasm/src/generated/enum_from_str.rs +++ /dev/null @@ -1,1142 +0,0 @@ -use anyhow::{bail, Result}; - -pub fn enum_from_str(ety: &str, name: &str) -> Result { - let out: u32 = match ety { - "SourceLanguage" => match name { - "Unknown" => 0, - "ESSL" => 1, - "GLSL" => 2, - "OpenCL_C" => 3, - "OpenCL_CPP" => 4, - "HLSL" => 5, - "CPP_for_OpenCL" => 6, - "SYCL" => 7, - "HERO_C" => 8, - "NZSL" => 9, - "WGSL" => 10, - "Slang" => 11, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "ExecutionModel" => match name { - "Vertex" => 0, - "TessellationControl" => 1, - "TessellationEvaluation" => 2, - "Geometry" => 3, - "Fragment" => 4, - "GLCompute" => 5, - "Kernel" => 6, - "TaskNV" => 5267, - "MeshNV" => 5268, - "RayGenerationNV" => 5313, - "RayGenerationKHR" => 5313, - "IntersectionNV" => 5314, - "IntersectionKHR" => 5314, - "AnyHitNV" => 5315, - "AnyHitKHR" => 5315, - "ClosestHitNV" => 5316, - "ClosestHitKHR" => 5316, - "MissNV" => 5317, - "MissKHR" => 5317, - "CallableNV" => 5318, - "CallableKHR" => 5318, - "TaskEXT" => 5364, - "MeshEXT" => 5365, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "AddressingModel" => match name { - "Logical" => 0, - "Physical32" => 1, - "Physical64" => 2, - "PhysicalStorageBuffer64" => 5348, - "PhysicalStorageBuffer64EXT" => 5348, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "MemoryModel" => match name { - "Simple" => 0, - "GLSL450" => 1, - "OpenCL" => 2, - "Vulkan" => 3, - "VulkanKHR" => 3, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "ExecutionMode" => match name { - "Invocations" => 0, - "SpacingEqual" => 1, - "SpacingFractionalEven" => 2, - "SpacingFractionalOdd" => 3, - "VertexOrderCw" => 4, - "VertexOrderCcw" => 5, - "PixelCenterInteger" => 6, - "OriginUpperLeft" => 7, - "OriginLowerLeft" => 8, - "EarlyFragmentTests" => 9, - "PointMode" => 10, - "Xfb" => 11, - "DepthReplacing" => 12, - "DepthGreater" => 14, - "DepthLess" => 15, - "DepthUnchanged" => 16, - "LocalSize" => 17, - "LocalSizeHint" => 18, - "InputPoints" => 19, - "InputLines" => 20, - "InputLinesAdjacency" => 21, - "Triangles" => 22, - "InputTrianglesAdjacency" => 23, - "Quads" => 24, - "Isolines" => 25, - "OutputVertices" => 26, - "OutputPoints" => 27, - "OutputLineStrip" => 28, - "OutputTriangleStrip" => 29, - "VecTypeHint" => 30, - "ContractionOff" => 31, - "Initializer" => 33, - "Finalizer" => 34, - "SubgroupSize" => 35, - "SubgroupsPerWorkgroup" => 36, - "SubgroupsPerWorkgroupId" => 37, - "LocalSizeId" => 38, - "LocalSizeHintId" => 39, - "NonCoherentColorAttachmentReadEXT" => 4169, - "NonCoherentDepthAttachmentReadEXT" => 4170, - "NonCoherentStencilAttachmentReadEXT" => 4171, - "SubgroupUniformControlFlowKHR" => 4421, - "PostDepthCoverage" => 4446, - "DenormPreserve" => 4459, - "DenormFlushToZero" => 4460, - "SignedZeroInfNanPreserve" => 4461, - "RoundingModeRTE" => 4462, - "RoundingModeRTZ" => 4463, - "EarlyAndLateFragmentTestsAMD" => 5017, - "StencilRefReplacingEXT" => 5027, - "CoalescingAMDX" => 5069, - "MaxNodeRecursionAMDX" => 5071, - "StaticNumWorkgroupsAMDX" => 5072, - "ShaderIndexAMDX" => 5073, - "MaxNumWorkgroupsAMDX" => 5077, - "StencilRefUnchangedFrontAMD" => 5079, - "StencilRefGreaterFrontAMD" => 5080, - "StencilRefLessFrontAMD" => 5081, - "StencilRefUnchangedBackAMD" => 5082, - "StencilRefGreaterBackAMD" => 5083, - "StencilRefLessBackAMD" => 5084, - "OutputLinesNV" => 5269, - "OutputLinesEXT" => 5269, - "OutputPrimitivesNV" => 5270, - "OutputPrimitivesEXT" => 5270, - "DerivativeGroupQuadsNV" => 5289, - "DerivativeGroupLinearNV" => 5290, - "OutputTrianglesNV" => 5298, - "OutputTrianglesEXT" => 5298, - "PixelInterlockOrderedEXT" => 5366, - "PixelInterlockUnorderedEXT" => 5367, - "SampleInterlockOrderedEXT" => 5368, - "SampleInterlockUnorderedEXT" => 5369, - "ShadingRateInterlockOrderedEXT" => 5370, - "ShadingRateInterlockUnorderedEXT" => 5371, - "SharedLocalMemorySizeINTEL" => 5618, - "RoundingModeRTPINTEL" => 5620, - "RoundingModeRTNINTEL" => 5621, - "FloatingPointModeALTINTEL" => 5622, - "FloatingPointModeIEEEINTEL" => 5623, - "MaxWorkgroupSizeINTEL" => 5893, - "MaxWorkDimINTEL" => 5894, - "NoGlobalOffsetINTEL" => 5895, - "NumSIMDWorkitemsINTEL" => 5896, - "SchedulerTargetFmaxMhzINTEL" => 5903, - "StreamingInterfaceINTEL" => 6154, - "RegisterMapInterfaceINTEL" => 6160, - "NamedBarrierCountINTEL" => 6417, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "StorageClass" => match name { - "UniformConstant" => 0, - "Input" => 1, - "Uniform" => 2, - "Output" => 3, - "Workgroup" => 4, - "CrossWorkgroup" => 5, - "Private" => 6, - "Function" => 7, - "Generic" => 8, - "PushConstant" => 9, - "AtomicCounter" => 10, - "Image" => 11, - "StorageBuffer" => 12, - "TileImageEXT" => 4172, - "NodePayloadAMDX" => 5068, - "NodeOutputPayloadAMDX" => 5076, - "CallableDataNV" => 5328, - "CallableDataKHR" => 5328, - "IncomingCallableDataNV" => 5329, - "IncomingCallableDataKHR" => 5329, - "RayPayloadNV" => 5338, - "RayPayloadKHR" => 5338, - "HitAttributeNV" => 5339, - "HitAttributeKHR" => 5339, - "IncomingRayPayloadNV" => 5342, - "IncomingRayPayloadKHR" => 5342, - "ShaderRecordBufferNV" => 5343, - "ShaderRecordBufferKHR" => 5343, - "PhysicalStorageBuffer" => 5349, - "PhysicalStorageBufferEXT" => 5349, - "HitObjectAttributeNV" => 5385, - "TaskPayloadWorkgroupEXT" => 5402, - "CodeSectionINTEL" => 5605, - "DeviceOnlyINTEL" => 5936, - "HostOnlyINTEL" => 5937, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "Dim" => match name { - "1D" => 0, - "2D" => 1, - "3D" => 2, - "Cube" => 3, - "Rect" => 4, - "Buffer" => 5, - "SubpassData" => 6, - "TileImageDataEXT" => 4173, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "SamplerAddressingMode" => match name { - "None" => 0, - "ClampToEdge" => 1, - "Clamp" => 2, - "Repeat" => 3, - "RepeatMirrored" => 4, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "SamplerFilterMode" => match name { - "Nearest" => 0, - "Linear" => 1, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "ImageFormat" => match name { - "Unknown" => 0, - "Rgba32f" => 1, - "Rgba16f" => 2, - "R32f" => 3, - "Rgba8" => 4, - "Rgba8Snorm" => 5, - "Rg32f" => 6, - "Rg16f" => 7, - "R11fG11fB10f" => 8, - "R16f" => 9, - "Rgba16" => 10, - "Rgb10A2" => 11, - "Rg16" => 12, - "Rg8" => 13, - "R16" => 14, - "R8" => 15, - "Rgba16Snorm" => 16, - "Rg16Snorm" => 17, - "Rg8Snorm" => 18, - "R16Snorm" => 19, - "R8Snorm" => 20, - "Rgba32i" => 21, - "Rgba16i" => 22, - "Rgba8i" => 23, - "R32i" => 24, - "Rg32i" => 25, - "Rg16i" => 26, - "Rg8i" => 27, - "R16i" => 28, - "R8i" => 29, - "Rgba32ui" => 30, - "Rgba16ui" => 31, - "Rgba8ui" => 32, - "R32ui" => 33, - "Rgb10a2ui" => 34, - "Rg32ui" => 35, - "Rg16ui" => 36, - "Rg8ui" => 37, - "R16ui" => 38, - "R8ui" => 39, - "R64ui" => 40, - "R64i" => 41, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "ImageChannelOrder" => match name { - "R" => 0, - "A" => 1, - "RG" => 2, - "RA" => 3, - "RGB" => 4, - "RGBA" => 5, - "BGRA" => 6, - "ARGB" => 7, - "Intensity" => 8, - "Luminance" => 9, - "Rx" => 10, - "RGx" => 11, - "RGBx" => 12, - "Depth" => 13, - "DepthStencil" => 14, - "sRGB" => 15, - "sRGBx" => 16, - "sRGBA" => 17, - "sBGRA" => 18, - "ABGR" => 19, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "ImageChannelDataType" => match name { - "SnormInt8" => 0, - "SnormInt16" => 1, - "UnormInt8" => 2, - "UnormInt16" => 3, - "UnormShort565" => 4, - "UnormShort555" => 5, - "UnormInt101010" => 6, - "SignedInt8" => 7, - "SignedInt16" => 8, - "SignedInt32" => 9, - "UnsignedInt8" => 10, - "UnsignedInt16" => 11, - "UnsignedInt32" => 12, - "HalfFloat" => 13, - "Float" => 14, - "UnormInt24" => 15, - "UnormInt101010_2" => 16, - "UnsignedIntRaw10EXT" => 19, - "UnsignedIntRaw12EXT" => 20, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "FPRoundingMode" => match name { - "RTE" => 0, - "RTZ" => 1, - "RTP" => 2, - "RTN" => 3, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "FPDenormMode" => match name { - "Preserve" => 0, - "FlushToZero" => 1, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "QuantizationModes" => match name { - "TRN" => 0, - "TRN_ZERO" => 1, - "RND" => 2, - "RND_ZERO" => 3, - "RND_INF" => 4, - "RND_MIN_INF" => 5, - "RND_CONV" => 6, - "RND_CONV_ODD" => 7, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "FPOperationMode" => match name { - "IEEE" => 0, - "ALT" => 1, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "OverflowModes" => match name { - "WRAP" => 0, - "SAT" => 1, - "SAT_ZERO" => 2, - "SAT_SYM" => 3, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "LinkageType" => match name { - "Export" => 0, - "Import" => 1, - "LinkOnceODR" => 2, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "AccessQualifier" => match name { - "ReadOnly" => 0, - "WriteOnly" => 1, - "ReadWrite" => 2, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "HostAccessQualifier" => match name { - "NoneINTEL" => 0, - "ReadINTEL" => 1, - "WriteINTEL" => 2, - "ReadWriteINTEL" => 3, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "FunctionParameterAttribute" => match name { - "Zext" => 0, - "Sext" => 1, - "ByVal" => 2, - "Sret" => 3, - "NoAlias" => 4, - "NoCapture" => 5, - "NoWrite" => 6, - "NoReadWrite" => 7, - "RuntimeAlignedINTEL" => 5940, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "Decoration" => match name { - "RelaxedPrecision" => 0, - "SpecId" => 1, - "Block" => 2, - "BufferBlock" => 3, - "RowMajor" => 4, - "ColMajor" => 5, - "ArrayStride" => 6, - "MatrixStride" => 7, - "GLSLShared" => 8, - "GLSLPacked" => 9, - "CPacked" => 10, - "BuiltIn" => 11, - "NoPerspective" => 13, - "Flat" => 14, - "Patch" => 15, - "Centroid" => 16, - "Sample" => 17, - "Invariant" => 18, - "Restrict" => 19, - "Aliased" => 20, - "Volatile" => 21, - "Constant" => 22, - "Coherent" => 23, - "NonWritable" => 24, - "NonReadable" => 25, - "Uniform" => 26, - "UniformId" => 27, - "SaturatedConversion" => 28, - "Stream" => 29, - "Location" => 30, - "Component" => 31, - "Index" => 32, - "Binding" => 33, - "DescriptorSet" => 34, - "Offset" => 35, - "XfbBuffer" => 36, - "XfbStride" => 37, - "FuncParamAttr" => 38, - "FPRoundingMode" => 39, - "FPFastMathMode" => 40, - "LinkageAttributes" => 41, - "NoContraction" => 42, - "InputAttachmentIndex" => 43, - "Alignment" => 44, - "MaxByteOffset" => 45, - "AlignmentId" => 46, - "MaxByteOffsetId" => 47, - "NoSignedWrap" => 4469, - "NoUnsignedWrap" => 4470, - "WeightTextureQCOM" => 4487, - "BlockMatchTextureQCOM" => 4488, - "ExplicitInterpAMD" => 4999, - "NodeSharesPayloadLimitsWithAMDX" => 5019, - "NodeMaxPayloadsAMDX" => 5020, - "TrackFinishWritingAMDX" => 5078, - "PayloadNodeNameAMDX" => 5091, - "OverrideCoverageNV" => 5248, - "PassthroughNV" => 5250, - "ViewportRelativeNV" => 5252, - "SecondaryViewportRelativeNV" => 5256, - "PerPrimitiveNV" => 5271, - "PerPrimitiveEXT" => 5271, - "PerViewNV" => 5272, - "PerTaskNV" => 5273, - "PerVertexKHR" => 5285, - "PerVertexNV" => 5285, - "NonUniform" => 5300, - "NonUniformEXT" => 5300, - "RestrictPointer" => 5355, - "RestrictPointerEXT" => 5355, - "AliasedPointer" => 5356, - "AliasedPointerEXT" => 5356, - "HitObjectShaderRecordBufferNV" => 5386, - "BindlessSamplerNV" => 5398, - "BindlessImageNV" => 5399, - "BoundSamplerNV" => 5400, - "BoundImageNV" => 5401, - "SIMTCallINTEL" => 5599, - "ReferencedIndirectlyINTEL" => 5602, - "ClobberINTEL" => 5607, - "SideEffectsINTEL" => 5608, - "VectorComputeVariableINTEL" => 5624, - "FuncParamIOKindINTEL" => 5625, - "VectorComputeFunctionINTEL" => 5626, - "StackCallINTEL" => 5627, - "GlobalVariableOffsetINTEL" => 5628, - "CounterBuffer" => 5634, - "HlslCounterBufferGOOGLE" => 5634, - "UserSemantic" => 5635, - "HlslSemanticGOOGLE" => 5635, - "UserTypeGOOGLE" => 5636, - "FunctionRoundingModeINTEL" => 5822, - "FunctionDenormModeINTEL" => 5823, - "RegisterINTEL" => 5825, - "MemoryINTEL" => 5826, - "NumbanksINTEL" => 5827, - "BankwidthINTEL" => 5828, - "MaxPrivateCopiesINTEL" => 5829, - "SinglepumpINTEL" => 5830, - "DoublepumpINTEL" => 5831, - "MaxReplicatesINTEL" => 5832, - "SimpleDualPortINTEL" => 5833, - "MergeINTEL" => 5834, - "BankBitsINTEL" => 5835, - "ForcePow2DepthINTEL" => 5836, - "StridesizeINTEL" => 5883, - "WordsizeINTEL" => 5884, - "TrueDualPortINTEL" => 5885, - "BurstCoalesceINTEL" => 5899, - "CacheSizeINTEL" => 5900, - "DontStaticallyCoalesceINTEL" => 5901, - "PrefetchINTEL" => 5902, - "StallEnableINTEL" => 5905, - "FuseLoopsInFunctionINTEL" => 5907, - "MathOpDSPModeINTEL" => 5909, - "AliasScopeINTEL" => 5914, - "NoAliasINTEL" => 5915, - "InitiationIntervalINTEL" => 5917, - "MaxConcurrencyINTEL" => 5918, - "PipelineEnableINTEL" => 5919, - "BufferLocationINTEL" => 5921, - "IOPipeStorageINTEL" => 5944, - "FunctionFloatingPointModeINTEL" => 6080, - "SingleElementVectorINTEL" => 6085, - "VectorComputeCallableFunctionINTEL" => 6087, - "MediaBlockIOINTEL" => 6140, - "StallFreeINTEL" => 6151, - "FPMaxErrorDecorationINTEL" => 6170, - "LatencyControlLabelINTEL" => 6172, - "LatencyControlConstraintINTEL" => 6173, - "ConduitKernelArgumentINTEL" => 6175, - "RegisterMapKernelArgumentINTEL" => 6176, - "MMHostInterfaceAddressWidthINTEL" => 6177, - "MMHostInterfaceDataWidthINTEL" => 6178, - "MMHostInterfaceLatencyINTEL" => 6179, - "MMHostInterfaceReadWriteModeINTEL" => 6180, - "MMHostInterfaceMaxBurstINTEL" => 6181, - "MMHostInterfaceWaitRequestINTEL" => 6182, - "StableKernelArgumentINTEL" => 6183, - "HostAccessINTEL" => 6188, - "InitModeINTEL" => 6190, - "ImplementInRegisterMapINTEL" => 6191, - "CacheControlLoadINTEL" => 6442, - "CacheControlStoreINTEL" => 6443, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "BuiltIn" => match name { - "Position" => 0, - "PointSize" => 1, - "ClipDistance" => 3, - "CullDistance" => 4, - "VertexId" => 5, - "InstanceId" => 6, - "PrimitiveId" => 7, - "InvocationId" => 8, - "Layer" => 9, - "ViewportIndex" => 10, - "TessLevelOuter" => 11, - "TessLevelInner" => 12, - "TessCoord" => 13, - "PatchVertices" => 14, - "FragCoord" => 15, - "PointCoord" => 16, - "FrontFacing" => 17, - "SampleId" => 18, - "SamplePosition" => 19, - "SampleMask" => 20, - "FragDepth" => 22, - "HelperInvocation" => 23, - "NumWorkgroups" => 24, - "WorkgroupSize" => 25, - "WorkgroupId" => 26, - "LocalInvocationId" => 27, - "GlobalInvocationId" => 28, - "LocalInvocationIndex" => 29, - "WorkDim" => 30, - "GlobalSize" => 31, - "EnqueuedWorkgroupSize" => 32, - "GlobalOffset" => 33, - "GlobalLinearId" => 34, - "SubgroupSize" => 36, - "SubgroupMaxSize" => 37, - "NumSubgroups" => 38, - "NumEnqueuedSubgroups" => 39, - "SubgroupId" => 40, - "SubgroupLocalInvocationId" => 41, - "VertexIndex" => 42, - "InstanceIndex" => 43, - "CoreIDARM" => 4160, - "CoreCountARM" => 4161, - "CoreMaxIDARM" => 4162, - "WarpIDARM" => 4163, - "WarpMaxIDARM" => 4164, - "SubgroupEqMask" => 4416, - "SubgroupEqMaskKHR" => 4416, - "SubgroupGeMask" => 4417, - "SubgroupGeMaskKHR" => 4417, - "SubgroupGtMask" => 4418, - "SubgroupGtMaskKHR" => 4418, - "SubgroupLeMask" => 4419, - "SubgroupLeMaskKHR" => 4419, - "SubgroupLtMask" => 4420, - "SubgroupLtMaskKHR" => 4420, - "BaseVertex" => 4424, - "BaseInstance" => 4425, - "DrawIndex" => 4426, - "PrimitiveShadingRateKHR" => 4432, - "DeviceIndex" => 4438, - "ViewIndex" => 4440, - "ShadingRateKHR" => 4444, - "BaryCoordNoPerspAMD" => 4992, - "BaryCoordNoPerspCentroidAMD" => 4993, - "BaryCoordNoPerspSampleAMD" => 4994, - "BaryCoordSmoothAMD" => 4995, - "BaryCoordSmoothCentroidAMD" => 4996, - "BaryCoordSmoothSampleAMD" => 4997, - "BaryCoordPullModelAMD" => 4998, - "FragStencilRefEXT" => 5014, - "CoalescedInputCountAMDX" => 5021, - "ShaderIndexAMDX" => 5073, - "ViewportMaskNV" => 5253, - "SecondaryPositionNV" => 5257, - "SecondaryViewportMaskNV" => 5258, - "PositionPerViewNV" => 5261, - "ViewportMaskPerViewNV" => 5262, - "FullyCoveredEXT" => 5264, - "TaskCountNV" => 5274, - "PrimitiveCountNV" => 5275, - "PrimitiveIndicesNV" => 5276, - "ClipDistancePerViewNV" => 5277, - "CullDistancePerViewNV" => 5278, - "LayerPerViewNV" => 5279, - "MeshViewCountNV" => 5280, - "MeshViewIndicesNV" => 5281, - "BaryCoordKHR" => 5286, - "BaryCoordNV" => 5286, - "BaryCoordNoPerspKHR" => 5287, - "BaryCoordNoPerspNV" => 5287, - "FragSizeEXT" => 5292, - "FragmentSizeNV" => 5292, - "FragInvocationCountEXT" => 5293, - "InvocationsPerPixelNV" => 5293, - "PrimitivePointIndicesEXT" => 5294, - "PrimitiveLineIndicesEXT" => 5295, - "PrimitiveTriangleIndicesEXT" => 5296, - "CullPrimitiveEXT" => 5299, - "LaunchIdNV" => 5319, - "LaunchIdKHR" => 5319, - "LaunchSizeNV" => 5320, - "LaunchSizeKHR" => 5320, - "WorldRayOriginNV" => 5321, - "WorldRayOriginKHR" => 5321, - "WorldRayDirectionNV" => 5322, - "WorldRayDirectionKHR" => 5322, - "ObjectRayOriginNV" => 5323, - "ObjectRayOriginKHR" => 5323, - "ObjectRayDirectionNV" => 5324, - "ObjectRayDirectionKHR" => 5324, - "RayTminNV" => 5325, - "RayTminKHR" => 5325, - "RayTmaxNV" => 5326, - "RayTmaxKHR" => 5326, - "InstanceCustomIndexNV" => 5327, - "InstanceCustomIndexKHR" => 5327, - "ObjectToWorldNV" => 5330, - "ObjectToWorldKHR" => 5330, - "WorldToObjectNV" => 5331, - "WorldToObjectKHR" => 5331, - "HitTNV" => 5332, - "HitKindNV" => 5333, - "HitKindKHR" => 5333, - "CurrentRayTimeNV" => 5334, - "HitTriangleVertexPositionsKHR" => 5335, - "HitMicroTriangleVertexPositionsNV" => 5337, - "HitMicroTriangleVertexBarycentricsNV" => 5344, - "IncomingRayFlagsNV" => 5351, - "IncomingRayFlagsKHR" => 5351, - "RayGeometryIndexKHR" => 5352, - "WarpsPerSMNV" => 5374, - "SMCountNV" => 5375, - "WarpIDNV" => 5376, - "SMIDNV" => 5377, - "HitKindFrontFacingMicroTriangleNV" => 5405, - "HitKindBackFacingMicroTriangleNV" => 5406, - "CullMaskKHR" => 6021, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "Scope" => match name { - "CrossDevice" => 0, - "Device" => 1, - "Workgroup" => 2, - "Subgroup" => 3, - "Invocation" => 4, - "QueueFamily" => 5, - "QueueFamilyKHR" => 5, - "ShaderCallKHR" => 6, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "GroupOperation" => match name { - "Reduce" => 0, - "InclusiveScan" => 1, - "ExclusiveScan" => 2, - "ClusteredReduce" => 3, - "PartitionedReduceNV" => 6, - "PartitionedInclusiveScanNV" => 7, - "PartitionedExclusiveScanNV" => 8, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "KernelEnqueueFlags" => match name { - "NoWait" => 0, - "WaitKernel" => 1, - "WaitWorkGroup" => 2, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "Capability" => match name { - "Matrix" => 0, - "Shader" => 1, - "Geometry" => 2, - "Tessellation" => 3, - "Addresses" => 4, - "Linkage" => 5, - "Kernel" => 6, - "Vector16" => 7, - "Float16Buffer" => 8, - "Float16" => 9, - "Float64" => 10, - "Int64" => 11, - "Int64Atomics" => 12, - "ImageBasic" => 13, - "ImageReadWrite" => 14, - "ImageMipmap" => 15, - "Pipes" => 17, - "Groups" => 18, - "DeviceEnqueue" => 19, - "LiteralSampler" => 20, - "AtomicStorage" => 21, - "Int16" => 22, - "TessellationPointSize" => 23, - "GeometryPointSize" => 24, - "ImageGatherExtended" => 25, - "StorageImageMultisample" => 27, - "UniformBufferArrayDynamicIndexing" => 28, - "SampledImageArrayDynamicIndexing" => 29, - "StorageBufferArrayDynamicIndexing" => 30, - "StorageImageArrayDynamicIndexing" => 31, - "ClipDistance" => 32, - "CullDistance" => 33, - "ImageCubeArray" => 34, - "SampleRateShading" => 35, - "ImageRect" => 36, - "SampledRect" => 37, - "GenericPointer" => 38, - "Int8" => 39, - "InputAttachment" => 40, - "SparseResidency" => 41, - "MinLod" => 42, - "Sampled1D" => 43, - "Image1D" => 44, - "SampledCubeArray" => 45, - "SampledBuffer" => 46, - "ImageBuffer" => 47, - "ImageMSArray" => 48, - "StorageImageExtendedFormats" => 49, - "ImageQuery" => 50, - "DerivativeControl" => 51, - "InterpolationFunction" => 52, - "TransformFeedback" => 53, - "GeometryStreams" => 54, - "StorageImageReadWithoutFormat" => 55, - "StorageImageWriteWithoutFormat" => 56, - "MultiViewport" => 57, - "SubgroupDispatch" => 58, - "NamedBarrier" => 59, - "PipeStorage" => 60, - "GroupNonUniform" => 61, - "GroupNonUniformVote" => 62, - "GroupNonUniformArithmetic" => 63, - "GroupNonUniformBallot" => 64, - "GroupNonUniformShuffle" => 65, - "GroupNonUniformShuffleRelative" => 66, - "GroupNonUniformClustered" => 67, - "GroupNonUniformQuad" => 68, - "ShaderLayer" => 69, - "ShaderViewportIndex" => 70, - "UniformDecoration" => 71, - "CoreBuiltinsARM" => 4165, - "TileImageColorReadAccessEXT" => 4166, - "TileImageDepthReadAccessEXT" => 4167, - "TileImageStencilReadAccessEXT" => 4168, - "FragmentShadingRateKHR" => 4422, - "SubgroupBallotKHR" => 4423, - "DrawParameters" => 4427, - "WorkgroupMemoryExplicitLayoutKHR" => 4428, - "WorkgroupMemoryExplicitLayout8BitAccessKHR" => 4429, - "WorkgroupMemoryExplicitLayout16BitAccessKHR" => 4430, - "SubgroupVoteKHR" => 4431, - "StorageBuffer16BitAccess" => 4433, - "StorageUniformBufferBlock16" => 4433, - "UniformAndStorageBuffer16BitAccess" => 4434, - "StorageUniform16" => 4434, - "StoragePushConstant16" => 4435, - "StorageInputOutput16" => 4436, - "DeviceGroup" => 4437, - "MultiView" => 4439, - "VariablePointersStorageBuffer" => 4441, - "VariablePointers" => 4442, - "AtomicStorageOps" => 4445, - "SampleMaskPostDepthCoverage" => 4447, - "StorageBuffer8BitAccess" => 4448, - "UniformAndStorageBuffer8BitAccess" => 4449, - "StoragePushConstant8" => 4450, - "DenormPreserve" => 4464, - "DenormFlushToZero" => 4465, - "SignedZeroInfNanPreserve" => 4466, - "RoundingModeRTE" => 4467, - "RoundingModeRTZ" => 4468, - "RayQueryProvisionalKHR" => 4471, - "RayQueryKHR" => 4472, - "RayTraversalPrimitiveCullingKHR" => 4478, - "RayTracingKHR" => 4479, - "TextureSampleWeightedQCOM" => 4484, - "TextureBoxFilterQCOM" => 4485, - "TextureBlockMatchQCOM" => 4486, - "Float16ImageAMD" => 5008, - "ImageGatherBiasLodAMD" => 5009, - "FragmentMaskAMD" => 5010, - "StencilExportEXT" => 5013, - "ImageReadWriteLodAMD" => 5015, - "Int64ImageEXT" => 5016, - "ShaderClockKHR" => 5055, - "ShaderEnqueueAMDX" => 5067, - "SampleMaskOverrideCoverageNV" => 5249, - "GeometryShaderPassthroughNV" => 5251, - "ShaderViewportIndexLayerEXT" => 5254, - "ShaderViewportIndexLayerNV" => 5254, - "ShaderViewportMaskNV" => 5255, - "ShaderStereoViewNV" => 5259, - "PerViewAttributesNV" => 5260, - "FragmentFullyCoveredEXT" => 5265, - "MeshShadingNV" => 5266, - "ImageFootprintNV" => 5282, - "MeshShadingEXT" => 5283, - "FragmentBarycentricKHR" => 5284, - "FragmentBarycentricNV" => 5284, - "ComputeDerivativeGroupQuadsNV" => 5288, - "FragmentDensityEXT" => 5291, - "ShadingRateNV" => 5291, - "GroupNonUniformPartitionedNV" => 5297, - "ShaderNonUniform" => 5301, - "ShaderNonUniformEXT" => 5301, - "RuntimeDescriptorArray" => 5302, - "RuntimeDescriptorArrayEXT" => 5302, - "InputAttachmentArrayDynamicIndexing" => 5303, - "InputAttachmentArrayDynamicIndexingEXT" => 5303, - "UniformTexelBufferArrayDynamicIndexing" => 5304, - "UniformTexelBufferArrayDynamicIndexingEXT" => 5304, - "StorageTexelBufferArrayDynamicIndexing" => 5305, - "StorageTexelBufferArrayDynamicIndexingEXT" => 5305, - "UniformBufferArrayNonUniformIndexing" => 5306, - "UniformBufferArrayNonUniformIndexingEXT" => 5306, - "SampledImageArrayNonUniformIndexing" => 5307, - "SampledImageArrayNonUniformIndexingEXT" => 5307, - "StorageBufferArrayNonUniformIndexing" => 5308, - "StorageBufferArrayNonUniformIndexingEXT" => 5308, - "StorageImageArrayNonUniformIndexing" => 5309, - "StorageImageArrayNonUniformIndexingEXT" => 5309, - "InputAttachmentArrayNonUniformIndexing" => 5310, - "InputAttachmentArrayNonUniformIndexingEXT" => 5310, - "UniformTexelBufferArrayNonUniformIndexing" => 5311, - "UniformTexelBufferArrayNonUniformIndexingEXT" => 5311, - "StorageTexelBufferArrayNonUniformIndexing" => 5312, - "StorageTexelBufferArrayNonUniformIndexingEXT" => 5312, - "RayTracingPositionFetchKHR" => 5336, - "RayTracingNV" => 5340, - "RayTracingMotionBlurNV" => 5341, - "VulkanMemoryModel" => 5345, - "VulkanMemoryModelKHR" => 5345, - "VulkanMemoryModelDeviceScope" => 5346, - "VulkanMemoryModelDeviceScopeKHR" => 5346, - "PhysicalStorageBufferAddresses" => 5347, - "PhysicalStorageBufferAddressesEXT" => 5347, - "ComputeDerivativeGroupLinearNV" => 5350, - "RayTracingProvisionalKHR" => 5353, - "CooperativeMatrixNV" => 5357, - "FragmentShaderSampleInterlockEXT" => 5363, - "FragmentShaderShadingRateInterlockEXT" => 5372, - "ShaderSMBuiltinsNV" => 5373, - "FragmentShaderPixelInterlockEXT" => 5378, - "DemoteToHelperInvocation" => 5379, - "DemoteToHelperInvocationEXT" => 5379, - "DisplacementMicromapNV" => 5380, - "RayTracingOpacityMicromapEXT" => 5381, - "ShaderInvocationReorderNV" => 5383, - "BindlessTextureNV" => 5390, - "RayQueryPositionFetchKHR" => 5391, - "RayTracingDisplacementMicromapNV" => 5409, - "SubgroupShuffleINTEL" => 5568, - "SubgroupBufferBlockIOINTEL" => 5569, - "SubgroupImageBlockIOINTEL" => 5570, - "SubgroupImageMediaBlockIOINTEL" => 5579, - "RoundToInfinityINTEL" => 5582, - "FloatingPointModeINTEL" => 5583, - "IntegerFunctions2INTEL" => 5584, - "FunctionPointersINTEL" => 5603, - "IndirectReferencesINTEL" => 5604, - "AsmINTEL" => 5606, - "AtomicFloat32MinMaxEXT" => 5612, - "AtomicFloat64MinMaxEXT" => 5613, - "AtomicFloat16MinMaxEXT" => 5616, - "VectorComputeINTEL" => 5617, - "VectorAnyINTEL" => 5619, - "ExpectAssumeKHR" => 5629, - "SubgroupAvcMotionEstimationINTEL" => 5696, - "SubgroupAvcMotionEstimationIntraINTEL" => 5697, - "SubgroupAvcMotionEstimationChromaINTEL" => 5698, - "VariableLengthArrayINTEL" => 5817, - "FunctionFloatControlINTEL" => 5821, - "FPGAMemoryAttributesINTEL" => 5824, - "FPFastMathModeINTEL" => 5837, - "ArbitraryPrecisionIntegersINTEL" => 5844, - "ArbitraryPrecisionFloatingPointINTEL" => 5845, - "UnstructuredLoopControlsINTEL" => 5886, - "FPGALoopControlsINTEL" => 5888, - "KernelAttributesINTEL" => 5892, - "FPGAKernelAttributesINTEL" => 5897, - "FPGAMemoryAccessesINTEL" => 5898, - "FPGAClusterAttributesINTEL" => 5904, - "LoopFuseINTEL" => 5906, - "FPGADSPControlINTEL" => 5908, - "MemoryAccessAliasingINTEL" => 5910, - "FPGAInvocationPipeliningAttributesINTEL" => 5916, - "FPGABufferLocationINTEL" => 5920, - "ArbitraryPrecisionFixedPointINTEL" => 5922, - "USMStorageClassesINTEL" => 5935, - "RuntimeAlignedAttributeINTEL" => 5939, - "IOPipesINTEL" => 5943, - "BlockingPipesINTEL" => 5945, - "FPGARegINTEL" => 5948, - "DotProductInputAll" => 6016, - "DotProductInputAllKHR" => 6016, - "DotProductInput4x8Bit" => 6017, - "DotProductInput4x8BitKHR" => 6017, - "DotProductInput4x8BitPacked" => 6018, - "DotProductInput4x8BitPackedKHR" => 6018, - "DotProduct" => 6019, - "DotProductKHR" => 6019, - "RayCullMaskKHR" => 6020, - "CooperativeMatrixKHR" => 6022, - "BitInstructions" => 6025, - "GroupNonUniformRotateKHR" => 6026, - "AtomicFloat32AddEXT" => 6033, - "AtomicFloat64AddEXT" => 6034, - "LongCompositesINTEL" => 6089, - "OptNoneINTEL" => 6094, - "AtomicFloat16AddEXT" => 6095, - "DebugInfoModuleINTEL" => 6114, - "BFloat16ConversionINTEL" => 6115, - "SplitBarrierINTEL" => 6141, - "FPGAClusterAttributesV2INTEL" => 6150, - "FPGAKernelAttributesv2INTEL" => 6161, - "FPMaxErrorINTEL" => 6169, - "FPGALatencyControlINTEL" => 6171, - "FPGAArgumentInterfacesINTEL" => 6174, - "GlobalVariableHostAccessINTEL" => 6187, - "GlobalVariableFPGADecorationsINTEL" => 6189, - "GroupUniformArithmeticKHR" => 6400, - "CacheControlsINTEL" => 6441, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "RayQueryIntersection" => match name { - "RayQueryCandidateIntersectionKHR" => 0, - "RayQueryCommittedIntersectionKHR" => 1, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "RayQueryCommittedIntersectionType" => match name { - "RayQueryCommittedIntersectionNoneKHR" => 0, - "RayQueryCommittedIntersectionTriangleKHR" => 1, - "RayQueryCommittedIntersectionGeneratedKHR" => 2, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "RayQueryCandidateIntersectionType" => match name { - "RayQueryCandidateIntersectionTriangleKHR" => 0, - "RayQueryCandidateIntersectionAABBKHR" => 1, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "PackedVectorFormat" => match name { - "PackedVectorFormat4x8Bit" => 0, - "PackedVectorFormat4x8BitKHR" => 0, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "CooperativeMatrixLayout" => match name { - "RowMajorKHR" => 0, - "ColumnMajorKHR" => 1, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "CooperativeMatrixUse" => match name { - "MatrixAKHR" => 0, - "MatrixBKHR" => 1, - "MatrixAccumulatorKHR" => 2, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "InitializationModeQualifier" => match name { - "InitOnDeviceReprogramINTEL" => 0, - "InitOnDeviceResetINTEL" => 1, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "LoadCacheControl" => match name { - "UncachedINTEL" => 0, - "CachedINTEL" => 1, - "StreamingINTEL" => 2, - "InvalidateAfterReadINTEL" => 3, - "ConstCachedINTEL" => 4, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "StoreCacheControl" => match name { - "UncachedINTEL" => 0, - "WriteThroughINTEL" => 1, - "WriteBackINTEL" => 2, - "StreamingINTEL" => 3, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "ImageOperands" => match name { - "None" => 0x0000, - "Bias" => 0x0001, - "Lod" => 0x0002, - "Grad" => 0x0004, - "ConstOffset" => 0x0008, - "Offset" => 0x0010, - "ConstOffsets" => 0x0020, - "Sample" => 0x0040, - "MinLod" => 0x0080, - "MakeTexelAvailable" => 0x0100, - "MakeTexelAvailableKHR" => 0x0100, - "MakeTexelVisible" => 0x0200, - "MakeTexelVisibleKHR" => 0x0200, - "NonPrivateTexel" => 0x0400, - "NonPrivateTexelKHR" => 0x0400, - "VolatileTexel" => 0x0800, - "VolatileTexelKHR" => 0x0800, - "SignExtend" => 0x1000, - "ZeroExtend" => 0x2000, - "Nontemporal" => 0x4000, - "Offsets" => 0x10000, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "FPFastMathMode" => match name { - "None" => 0x0000, - "NotNaN" => 0x0001, - "NotInf" => 0x0002, - "NSZ" => 0x0004, - "AllowRecip" => 0x0008, - "Fast" => 0x0010, - "AllowContractFastINTEL" => 0x10000, - "AllowReassocINTEL" => 0x20000, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "SelectionControl" => match name { - "None" => 0x0000, - "Flatten" => 0x0001, - "DontFlatten" => 0x0002, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "LoopControl" => match name { - "None" => 0x0000, - "Unroll" => 0x0001, - "DontUnroll" => 0x0002, - "DependencyInfinite" => 0x0004, - "DependencyLength" => 0x0008, - "MinIterations" => 0x0010, - "MaxIterations" => 0x0020, - "IterationMultiple" => 0x0040, - "PeelCount" => 0x0080, - "PartialCount" => 0x0100, - "InitiationIntervalINTEL" => 0x10000, - "MaxConcurrencyINTEL" => 0x20000, - "DependencyArrayINTEL" => 0x40000, - "PipelineEnableINTEL" => 0x80000, - "LoopCoalesceINTEL" => 0x100000, - "MaxInterleavingINTEL" => 0x200000, - "SpeculatedIterationsINTEL" => 0x400000, - "NoFusionINTEL" => 0x800000, - "LoopCountINTEL" => 0x1000000, - "MaxReinvocationDelayINTEL" => 0x2000000, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "FunctionControl" => match name { - "None" => 0x0000, - "Inline" => 0x0001, - "DontInline" => 0x0002, - "Pure" => 0x0004, - "Const" => 0x0008, - "OptNoneINTEL" => 0x10000, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "MemorySemantics" => match name { - "Relaxed" => 0x0000, - "None" => 0x0000, - "Acquire" => 0x0002, - "Release" => 0x0004, - "AcquireRelease" => 0x0008, - "SequentiallyConsistent" => 0x0010, - "UniformMemory" => 0x0040, - "SubgroupMemory" => 0x0080, - "WorkgroupMemory" => 0x0100, - "CrossWorkgroupMemory" => 0x0200, - "AtomicCounterMemory" => 0x0400, - "ImageMemory" => 0x0800, - "OutputMemory" => 0x1000, - "OutputMemoryKHR" => 0x1000, - "MakeAvailable" => 0x2000, - "MakeAvailableKHR" => 0x2000, - "MakeVisible" => 0x4000, - "MakeVisibleKHR" => 0x4000, - "Volatile" => 0x8000, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "MemoryAccess" => match name { - "None" => 0x0000, - "Volatile" => 0x0001, - "Aligned" => 0x0002, - "Nontemporal" => 0x0004, - "MakePointerAvailable" => 0x0008, - "MakePointerAvailableKHR" => 0x0008, - "MakePointerVisible" => 0x0010, - "MakePointerVisibleKHR" => 0x0010, - "NonPrivatePointer" => 0x0020, - "NonPrivatePointerKHR" => 0x0020, - "AliasScopeINTELMask" => 0x10000, - "NoAliasINTELMask" => 0x20000, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "KernelProfilingInfo" => match name { - "None" => 0x0000, - "CmdExecTime" => 0x0001, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "RayFlags" => match name { - "NoneKHR" => 0x0000, - "OpaqueKHR" => 0x0001, - "NoOpaqueKHR" => 0x0002, - "TerminateOnFirstHitKHR" => 0x0004, - "SkipClosestHitShaderKHR" => 0x0008, - "CullBackFacingTrianglesKHR" => 0x0010, - "CullFrontFacingTrianglesKHR" => 0x0020, - "CullOpaqueKHR" => 0x0040, - "CullNoOpaqueKHR" => 0x0080, - "SkipTrianglesKHR" => 0x0100, - "SkipAABBsKHR" => 0x0200, - "ForceOpacityMicromap2StateEXT" => 0x0400, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "FragmentShadingRate" => match name { - "Vertical2Pixels" => 0x0001, - "Vertical4Pixels" => 0x0002, - "Horizontal2Pixels" => 0x0004, - "Horizontal4Pixels" => 0x0008, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - "CooperativeMatrixOperands" => match name { - "NoneKHR" => 0x0000, - "MatrixASignedComponentsKHR" => 0x0001, - "MatrixBSignedComponentsKHR" => 0x0002, - "MatrixCSignedComponentsKHR" => 0x0004, - "MatrixResultSignedComponentsKHR" => 0x0008, - "SaturatingAccumulationKHR" => 0x0010, - _ => bail!("unknown enum: {}::{}", ety, name), - }, - _ => bail!("unknown enum: {}::{}", ety, name), - }; - Ok(out) -} diff --git a/spirq-spvasm/src/generated/enum_to_str.rs b/spirq-spvasm/src/generated/enum_to_str.rs deleted file mode 100644 index f6d750b..0000000 --- a/spirq-spvasm/src/generated/enum_to_str.rs +++ /dev/null @@ -1,1041 +0,0 @@ -#![allow(unreachable_patterns)] -use anyhow::{bail, Result}; - -pub fn enum_to_str(ety: &str, value: u32) -> Result { - let out: String = match ety { - "SourceLanguage" => match value { - 0 => "Unknown".to_owned(), - 1 => "ESSL".to_owned(), - 2 => "GLSL".to_owned(), - 3 => "OpenCL_C".to_owned(), - 4 => "OpenCL_CPP".to_owned(), - 5 => "HLSL".to_owned(), - 6 => "CPP_for_OpenCL".to_owned(), - 7 => "SYCL".to_owned(), - 8 => "HERO_C".to_owned(), - 9 => "NZSL".to_owned(), - 10 => "WGSL".to_owned(), - 11 => "Slang".to_owned(), - _ => value.to_string(), - }, - "ExecutionModel" => match value { - 0 => "Vertex".to_owned(), - 1 => "TessellationControl".to_owned(), - 2 => "TessellationEvaluation".to_owned(), - 3 => "Geometry".to_owned(), - 4 => "Fragment".to_owned(), - 5 => "GLCompute".to_owned(), - 6 => "Kernel".to_owned(), - 5267 => "TaskNV".to_owned(), - 5268 => "MeshNV".to_owned(), - 5313 => "RayGenerationNV".to_owned(), - 5313 => "RayGenerationKHR".to_owned(), - 5314 => "IntersectionNV".to_owned(), - 5314 => "IntersectionKHR".to_owned(), - 5315 => "AnyHitNV".to_owned(), - 5315 => "AnyHitKHR".to_owned(), - 5316 => "ClosestHitNV".to_owned(), - 5316 => "ClosestHitKHR".to_owned(), - 5317 => "MissNV".to_owned(), - 5317 => "MissKHR".to_owned(), - 5318 => "CallableNV".to_owned(), - 5318 => "CallableKHR".to_owned(), - 5364 => "TaskEXT".to_owned(), - 5365 => "MeshEXT".to_owned(), - _ => value.to_string(), - }, - "AddressingModel" => match value { - 0 => "Logical".to_owned(), - 1 => "Physical32".to_owned(), - 2 => "Physical64".to_owned(), - 5348 => "PhysicalStorageBuffer64".to_owned(), - 5348 => "PhysicalStorageBuffer64EXT".to_owned(), - _ => value.to_string(), - }, - "MemoryModel" => match value { - 0 => "Simple".to_owned(), - 1 => "GLSL450".to_owned(), - 2 => "OpenCL".to_owned(), - 3 => "Vulkan".to_owned(), - 3 => "VulkanKHR".to_owned(), - _ => value.to_string(), - }, - "ExecutionMode" => match value { - 0 => "Invocations".to_owned(), - 1 => "SpacingEqual".to_owned(), - 2 => "SpacingFractionalEven".to_owned(), - 3 => "SpacingFractionalOdd".to_owned(), - 4 => "VertexOrderCw".to_owned(), - 5 => "VertexOrderCcw".to_owned(), - 6 => "PixelCenterInteger".to_owned(), - 7 => "OriginUpperLeft".to_owned(), - 8 => "OriginLowerLeft".to_owned(), - 9 => "EarlyFragmentTests".to_owned(), - 10 => "PointMode".to_owned(), - 11 => "Xfb".to_owned(), - 12 => "DepthReplacing".to_owned(), - 14 => "DepthGreater".to_owned(), - 15 => "DepthLess".to_owned(), - 16 => "DepthUnchanged".to_owned(), - 17 => "LocalSize".to_owned(), - 18 => "LocalSizeHint".to_owned(), - 19 => "InputPoints".to_owned(), - 20 => "InputLines".to_owned(), - 21 => "InputLinesAdjacency".to_owned(), - 22 => "Triangles".to_owned(), - 23 => "InputTrianglesAdjacency".to_owned(), - 24 => "Quads".to_owned(), - 25 => "Isolines".to_owned(), - 26 => "OutputVertices".to_owned(), - 27 => "OutputPoints".to_owned(), - 28 => "OutputLineStrip".to_owned(), - 29 => "OutputTriangleStrip".to_owned(), - 30 => "VecTypeHint".to_owned(), - 31 => "ContractionOff".to_owned(), - 33 => "Initializer".to_owned(), - 34 => "Finalizer".to_owned(), - 35 => "SubgroupSize".to_owned(), - 36 => "SubgroupsPerWorkgroup".to_owned(), - 37 => "SubgroupsPerWorkgroupId".to_owned(), - 38 => "LocalSizeId".to_owned(), - 39 => "LocalSizeHintId".to_owned(), - 4169 => "NonCoherentColorAttachmentReadEXT".to_owned(), - 4170 => "NonCoherentDepthAttachmentReadEXT".to_owned(), - 4171 => "NonCoherentStencilAttachmentReadEXT".to_owned(), - 4421 => "SubgroupUniformControlFlowKHR".to_owned(), - 4446 => "PostDepthCoverage".to_owned(), - 4459 => "DenormPreserve".to_owned(), - 4460 => "DenormFlushToZero".to_owned(), - 4461 => "SignedZeroInfNanPreserve".to_owned(), - 4462 => "RoundingModeRTE".to_owned(), - 4463 => "RoundingModeRTZ".to_owned(), - 5017 => "EarlyAndLateFragmentTestsAMD".to_owned(), - 5027 => "StencilRefReplacingEXT".to_owned(), - 5069 => "CoalescingAMDX".to_owned(), - 5071 => "MaxNodeRecursionAMDX".to_owned(), - 5072 => "StaticNumWorkgroupsAMDX".to_owned(), - 5073 => "ShaderIndexAMDX".to_owned(), - 5077 => "MaxNumWorkgroupsAMDX".to_owned(), - 5079 => "StencilRefUnchangedFrontAMD".to_owned(), - 5080 => "StencilRefGreaterFrontAMD".to_owned(), - 5081 => "StencilRefLessFrontAMD".to_owned(), - 5082 => "StencilRefUnchangedBackAMD".to_owned(), - 5083 => "StencilRefGreaterBackAMD".to_owned(), - 5084 => "StencilRefLessBackAMD".to_owned(), - 5269 => "OutputLinesNV".to_owned(), - 5269 => "OutputLinesEXT".to_owned(), - 5270 => "OutputPrimitivesNV".to_owned(), - 5270 => "OutputPrimitivesEXT".to_owned(), - 5289 => "DerivativeGroupQuadsNV".to_owned(), - 5290 => "DerivativeGroupLinearNV".to_owned(), - 5298 => "OutputTrianglesNV".to_owned(), - 5298 => "OutputTrianglesEXT".to_owned(), - 5366 => "PixelInterlockOrderedEXT".to_owned(), - 5367 => "PixelInterlockUnorderedEXT".to_owned(), - 5368 => "SampleInterlockOrderedEXT".to_owned(), - 5369 => "SampleInterlockUnorderedEXT".to_owned(), - 5370 => "ShadingRateInterlockOrderedEXT".to_owned(), - 5371 => "ShadingRateInterlockUnorderedEXT".to_owned(), - 5618 => "SharedLocalMemorySizeINTEL".to_owned(), - 5620 => "RoundingModeRTPINTEL".to_owned(), - 5621 => "RoundingModeRTNINTEL".to_owned(), - 5622 => "FloatingPointModeALTINTEL".to_owned(), - 5623 => "FloatingPointModeIEEEINTEL".to_owned(), - 5893 => "MaxWorkgroupSizeINTEL".to_owned(), - 5894 => "MaxWorkDimINTEL".to_owned(), - 5895 => "NoGlobalOffsetINTEL".to_owned(), - 5896 => "NumSIMDWorkitemsINTEL".to_owned(), - 5903 => "SchedulerTargetFmaxMhzINTEL".to_owned(), - 6154 => "StreamingInterfaceINTEL".to_owned(), - 6160 => "RegisterMapInterfaceINTEL".to_owned(), - 6417 => "NamedBarrierCountINTEL".to_owned(), - _ => value.to_string(), - }, - "StorageClass" => match value { - 0 => "UniformConstant".to_owned(), - 1 => "Input".to_owned(), - 2 => "Uniform".to_owned(), - 3 => "Output".to_owned(), - 4 => "Workgroup".to_owned(), - 5 => "CrossWorkgroup".to_owned(), - 6 => "Private".to_owned(), - 7 => "Function".to_owned(), - 8 => "Generic".to_owned(), - 9 => "PushConstant".to_owned(), - 10 => "AtomicCounter".to_owned(), - 11 => "Image".to_owned(), - 12 => "StorageBuffer".to_owned(), - 4172 => "TileImageEXT".to_owned(), - 5068 => "NodePayloadAMDX".to_owned(), - 5076 => "NodeOutputPayloadAMDX".to_owned(), - 5328 => "CallableDataNV".to_owned(), - 5328 => "CallableDataKHR".to_owned(), - 5329 => "IncomingCallableDataNV".to_owned(), - 5329 => "IncomingCallableDataKHR".to_owned(), - 5338 => "RayPayloadNV".to_owned(), - 5338 => "RayPayloadKHR".to_owned(), - 5339 => "HitAttributeNV".to_owned(), - 5339 => "HitAttributeKHR".to_owned(), - 5342 => "IncomingRayPayloadNV".to_owned(), - 5342 => "IncomingRayPayloadKHR".to_owned(), - 5343 => "ShaderRecordBufferNV".to_owned(), - 5343 => "ShaderRecordBufferKHR".to_owned(), - 5349 => "PhysicalStorageBuffer".to_owned(), - 5349 => "PhysicalStorageBufferEXT".to_owned(), - 5385 => "HitObjectAttributeNV".to_owned(), - 5402 => "TaskPayloadWorkgroupEXT".to_owned(), - 5605 => "CodeSectionINTEL".to_owned(), - 5936 => "DeviceOnlyINTEL".to_owned(), - 5937 => "HostOnlyINTEL".to_owned(), - _ => value.to_string(), - }, - "Dim" => match value { - 0 => "1D".to_owned(), - 1 => "2D".to_owned(), - 2 => "3D".to_owned(), - 3 => "Cube".to_owned(), - 4 => "Rect".to_owned(), - 5 => "Buffer".to_owned(), - 6 => "SubpassData".to_owned(), - 4173 => "TileImageDataEXT".to_owned(), - _ => value.to_string(), - }, - "SamplerAddressingMode" => match value { - 0 => "None".to_owned(), - 1 => "ClampToEdge".to_owned(), - 2 => "Clamp".to_owned(), - 3 => "Repeat".to_owned(), - 4 => "RepeatMirrored".to_owned(), - _ => value.to_string(), - }, - "SamplerFilterMode" => match value { - 0 => "Nearest".to_owned(), - 1 => "Linear".to_owned(), - _ => value.to_string(), - }, - "ImageFormat" => match value { - 0 => "Unknown".to_owned(), - 1 => "Rgba32f".to_owned(), - 2 => "Rgba16f".to_owned(), - 3 => "R32f".to_owned(), - 4 => "Rgba8".to_owned(), - 5 => "Rgba8Snorm".to_owned(), - 6 => "Rg32f".to_owned(), - 7 => "Rg16f".to_owned(), - 8 => "R11fG11fB10f".to_owned(), - 9 => "R16f".to_owned(), - 10 => "Rgba16".to_owned(), - 11 => "Rgb10A2".to_owned(), - 12 => "Rg16".to_owned(), - 13 => "Rg8".to_owned(), - 14 => "R16".to_owned(), - 15 => "R8".to_owned(), - 16 => "Rgba16Snorm".to_owned(), - 17 => "Rg16Snorm".to_owned(), - 18 => "Rg8Snorm".to_owned(), - 19 => "R16Snorm".to_owned(), - 20 => "R8Snorm".to_owned(), - 21 => "Rgba32i".to_owned(), - 22 => "Rgba16i".to_owned(), - 23 => "Rgba8i".to_owned(), - 24 => "R32i".to_owned(), - 25 => "Rg32i".to_owned(), - 26 => "Rg16i".to_owned(), - 27 => "Rg8i".to_owned(), - 28 => "R16i".to_owned(), - 29 => "R8i".to_owned(), - 30 => "Rgba32ui".to_owned(), - 31 => "Rgba16ui".to_owned(), - 32 => "Rgba8ui".to_owned(), - 33 => "R32ui".to_owned(), - 34 => "Rgb10a2ui".to_owned(), - 35 => "Rg32ui".to_owned(), - 36 => "Rg16ui".to_owned(), - 37 => "Rg8ui".to_owned(), - 38 => "R16ui".to_owned(), - 39 => "R8ui".to_owned(), - 40 => "R64ui".to_owned(), - 41 => "R64i".to_owned(), - _ => value.to_string(), - }, - "ImageChannelOrder" => match value { - 0 => "R".to_owned(), - 1 => "A".to_owned(), - 2 => "RG".to_owned(), - 3 => "RA".to_owned(), - 4 => "RGB".to_owned(), - 5 => "RGBA".to_owned(), - 6 => "BGRA".to_owned(), - 7 => "ARGB".to_owned(), - 8 => "Intensity".to_owned(), - 9 => "Luminance".to_owned(), - 10 => "Rx".to_owned(), - 11 => "RGx".to_owned(), - 12 => "RGBx".to_owned(), - 13 => "Depth".to_owned(), - 14 => "DepthStencil".to_owned(), - 15 => "sRGB".to_owned(), - 16 => "sRGBx".to_owned(), - 17 => "sRGBA".to_owned(), - 18 => "sBGRA".to_owned(), - 19 => "ABGR".to_owned(), - _ => value.to_string(), - }, - "ImageChannelDataType" => match value { - 0 => "SnormInt8".to_owned(), - 1 => "SnormInt16".to_owned(), - 2 => "UnormInt8".to_owned(), - 3 => "UnormInt16".to_owned(), - 4 => "UnormShort565".to_owned(), - 5 => "UnormShort555".to_owned(), - 6 => "UnormInt101010".to_owned(), - 7 => "SignedInt8".to_owned(), - 8 => "SignedInt16".to_owned(), - 9 => "SignedInt32".to_owned(), - 10 => "UnsignedInt8".to_owned(), - 11 => "UnsignedInt16".to_owned(), - 12 => "UnsignedInt32".to_owned(), - 13 => "HalfFloat".to_owned(), - 14 => "Float".to_owned(), - 15 => "UnormInt24".to_owned(), - 16 => "UnormInt101010_2".to_owned(), - 19 => "UnsignedIntRaw10EXT".to_owned(), - 20 => "UnsignedIntRaw12EXT".to_owned(), - _ => value.to_string(), - }, - "FPRoundingMode" => match value { - 0 => "RTE".to_owned(), - 1 => "RTZ".to_owned(), - 2 => "RTP".to_owned(), - 3 => "RTN".to_owned(), - _ => value.to_string(), - }, - "FPDenormMode" => match value { - 0 => "Preserve".to_owned(), - 1 => "FlushToZero".to_owned(), - _ => value.to_string(), - }, - "QuantizationModes" => match value { - 0 => "TRN".to_owned(), - 1 => "TRN_ZERO".to_owned(), - 2 => "RND".to_owned(), - 3 => "RND_ZERO".to_owned(), - 4 => "RND_INF".to_owned(), - 5 => "RND_MIN_INF".to_owned(), - 6 => "RND_CONV".to_owned(), - 7 => "RND_CONV_ODD".to_owned(), - _ => value.to_string(), - }, - "FPOperationMode" => match value { - 0 => "IEEE".to_owned(), - 1 => "ALT".to_owned(), - _ => value.to_string(), - }, - "OverflowModes" => match value { - 0 => "WRAP".to_owned(), - 1 => "SAT".to_owned(), - 2 => "SAT_ZERO".to_owned(), - 3 => "SAT_SYM".to_owned(), - _ => value.to_string(), - }, - "LinkageType" => match value { - 0 => "Export".to_owned(), - 1 => "Import".to_owned(), - 2 => "LinkOnceODR".to_owned(), - _ => value.to_string(), - }, - "AccessQualifier" => match value { - 0 => "ReadOnly".to_owned(), - 1 => "WriteOnly".to_owned(), - 2 => "ReadWrite".to_owned(), - _ => value.to_string(), - }, - "HostAccessQualifier" => match value { - 0 => "NoneINTEL".to_owned(), - 1 => "ReadINTEL".to_owned(), - 2 => "WriteINTEL".to_owned(), - 3 => "ReadWriteINTEL".to_owned(), - _ => value.to_string(), - }, - "FunctionParameterAttribute" => match value { - 0 => "Zext".to_owned(), - 1 => "Sext".to_owned(), - 2 => "ByVal".to_owned(), - 3 => "Sret".to_owned(), - 4 => "NoAlias".to_owned(), - 5 => "NoCapture".to_owned(), - 6 => "NoWrite".to_owned(), - 7 => "NoReadWrite".to_owned(), - 5940 => "RuntimeAlignedINTEL".to_owned(), - _ => value.to_string(), - }, - "Decoration" => match value { - 0 => "RelaxedPrecision".to_owned(), - 1 => "SpecId".to_owned(), - 2 => "Block".to_owned(), - 3 => "BufferBlock".to_owned(), - 4 => "RowMajor".to_owned(), - 5 => "ColMajor".to_owned(), - 6 => "ArrayStride".to_owned(), - 7 => "MatrixStride".to_owned(), - 8 => "GLSLShared".to_owned(), - 9 => "GLSLPacked".to_owned(), - 10 => "CPacked".to_owned(), - 11 => "BuiltIn".to_owned(), - 13 => "NoPerspective".to_owned(), - 14 => "Flat".to_owned(), - 15 => "Patch".to_owned(), - 16 => "Centroid".to_owned(), - 17 => "Sample".to_owned(), - 18 => "Invariant".to_owned(), - 19 => "Restrict".to_owned(), - 20 => "Aliased".to_owned(), - 21 => "Volatile".to_owned(), - 22 => "Constant".to_owned(), - 23 => "Coherent".to_owned(), - 24 => "NonWritable".to_owned(), - 25 => "NonReadable".to_owned(), - 26 => "Uniform".to_owned(), - 27 => "UniformId".to_owned(), - 28 => "SaturatedConversion".to_owned(), - 29 => "Stream".to_owned(), - 30 => "Location".to_owned(), - 31 => "Component".to_owned(), - 32 => "Index".to_owned(), - 33 => "Binding".to_owned(), - 34 => "DescriptorSet".to_owned(), - 35 => "Offset".to_owned(), - 36 => "XfbBuffer".to_owned(), - 37 => "XfbStride".to_owned(), - 38 => "FuncParamAttr".to_owned(), - 39 => "FPRoundingMode".to_owned(), - 40 => "FPFastMathMode".to_owned(), - 41 => "LinkageAttributes".to_owned(), - 42 => "NoContraction".to_owned(), - 43 => "InputAttachmentIndex".to_owned(), - 44 => "Alignment".to_owned(), - 45 => "MaxByteOffset".to_owned(), - 46 => "AlignmentId".to_owned(), - 47 => "MaxByteOffsetId".to_owned(), - 4469 => "NoSignedWrap".to_owned(), - 4470 => "NoUnsignedWrap".to_owned(), - 4487 => "WeightTextureQCOM".to_owned(), - 4488 => "BlockMatchTextureQCOM".to_owned(), - 4999 => "ExplicitInterpAMD".to_owned(), - 5019 => "NodeSharesPayloadLimitsWithAMDX".to_owned(), - 5020 => "NodeMaxPayloadsAMDX".to_owned(), - 5078 => "TrackFinishWritingAMDX".to_owned(), - 5091 => "PayloadNodeNameAMDX".to_owned(), - 5248 => "OverrideCoverageNV".to_owned(), - 5250 => "PassthroughNV".to_owned(), - 5252 => "ViewportRelativeNV".to_owned(), - 5256 => "SecondaryViewportRelativeNV".to_owned(), - 5271 => "PerPrimitiveNV".to_owned(), - 5271 => "PerPrimitiveEXT".to_owned(), - 5272 => "PerViewNV".to_owned(), - 5273 => "PerTaskNV".to_owned(), - 5285 => "PerVertexKHR".to_owned(), - 5285 => "PerVertexNV".to_owned(), - 5300 => "NonUniform".to_owned(), - 5300 => "NonUniformEXT".to_owned(), - 5355 => "RestrictPointer".to_owned(), - 5355 => "RestrictPointerEXT".to_owned(), - 5356 => "AliasedPointer".to_owned(), - 5356 => "AliasedPointerEXT".to_owned(), - 5386 => "HitObjectShaderRecordBufferNV".to_owned(), - 5398 => "BindlessSamplerNV".to_owned(), - 5399 => "BindlessImageNV".to_owned(), - 5400 => "BoundSamplerNV".to_owned(), - 5401 => "BoundImageNV".to_owned(), - 5599 => "SIMTCallINTEL".to_owned(), - 5602 => "ReferencedIndirectlyINTEL".to_owned(), - 5607 => "ClobberINTEL".to_owned(), - 5608 => "SideEffectsINTEL".to_owned(), - 5624 => "VectorComputeVariableINTEL".to_owned(), - 5625 => "FuncParamIOKindINTEL".to_owned(), - 5626 => "VectorComputeFunctionINTEL".to_owned(), - 5627 => "StackCallINTEL".to_owned(), - 5628 => "GlobalVariableOffsetINTEL".to_owned(), - 5634 => "CounterBuffer".to_owned(), - 5634 => "HlslCounterBufferGOOGLE".to_owned(), - 5635 => "UserSemantic".to_owned(), - 5635 => "HlslSemanticGOOGLE".to_owned(), - 5636 => "UserTypeGOOGLE".to_owned(), - 5822 => "FunctionRoundingModeINTEL".to_owned(), - 5823 => "FunctionDenormModeINTEL".to_owned(), - 5825 => "RegisterINTEL".to_owned(), - 5826 => "MemoryINTEL".to_owned(), - 5827 => "NumbanksINTEL".to_owned(), - 5828 => "BankwidthINTEL".to_owned(), - 5829 => "MaxPrivateCopiesINTEL".to_owned(), - 5830 => "SinglepumpINTEL".to_owned(), - 5831 => "DoublepumpINTEL".to_owned(), - 5832 => "MaxReplicatesINTEL".to_owned(), - 5833 => "SimpleDualPortINTEL".to_owned(), - 5834 => "MergeINTEL".to_owned(), - 5835 => "BankBitsINTEL".to_owned(), - 5836 => "ForcePow2DepthINTEL".to_owned(), - 5883 => "StridesizeINTEL".to_owned(), - 5884 => "WordsizeINTEL".to_owned(), - 5885 => "TrueDualPortINTEL".to_owned(), - 5899 => "BurstCoalesceINTEL".to_owned(), - 5900 => "CacheSizeINTEL".to_owned(), - 5901 => "DontStaticallyCoalesceINTEL".to_owned(), - 5902 => "PrefetchINTEL".to_owned(), - 5905 => "StallEnableINTEL".to_owned(), - 5907 => "FuseLoopsInFunctionINTEL".to_owned(), - 5909 => "MathOpDSPModeINTEL".to_owned(), - 5914 => "AliasScopeINTEL".to_owned(), - 5915 => "NoAliasINTEL".to_owned(), - 5917 => "InitiationIntervalINTEL".to_owned(), - 5918 => "MaxConcurrencyINTEL".to_owned(), - 5919 => "PipelineEnableINTEL".to_owned(), - 5921 => "BufferLocationINTEL".to_owned(), - 5944 => "IOPipeStorageINTEL".to_owned(), - 6080 => "FunctionFloatingPointModeINTEL".to_owned(), - 6085 => "SingleElementVectorINTEL".to_owned(), - 6087 => "VectorComputeCallableFunctionINTEL".to_owned(), - 6140 => "MediaBlockIOINTEL".to_owned(), - 6151 => "StallFreeINTEL".to_owned(), - 6170 => "FPMaxErrorDecorationINTEL".to_owned(), - 6172 => "LatencyControlLabelINTEL".to_owned(), - 6173 => "LatencyControlConstraintINTEL".to_owned(), - 6175 => "ConduitKernelArgumentINTEL".to_owned(), - 6176 => "RegisterMapKernelArgumentINTEL".to_owned(), - 6177 => "MMHostInterfaceAddressWidthINTEL".to_owned(), - 6178 => "MMHostInterfaceDataWidthINTEL".to_owned(), - 6179 => "MMHostInterfaceLatencyINTEL".to_owned(), - 6180 => "MMHostInterfaceReadWriteModeINTEL".to_owned(), - 6181 => "MMHostInterfaceMaxBurstINTEL".to_owned(), - 6182 => "MMHostInterfaceWaitRequestINTEL".to_owned(), - 6183 => "StableKernelArgumentINTEL".to_owned(), - 6188 => "HostAccessINTEL".to_owned(), - 6190 => "InitModeINTEL".to_owned(), - 6191 => "ImplementInRegisterMapINTEL".to_owned(), - 6442 => "CacheControlLoadINTEL".to_owned(), - 6443 => "CacheControlStoreINTEL".to_owned(), - _ => value.to_string(), - }, - "BuiltIn" => match value { - 0 => "Position".to_owned(), - 1 => "PointSize".to_owned(), - 3 => "ClipDistance".to_owned(), - 4 => "CullDistance".to_owned(), - 5 => "VertexId".to_owned(), - 6 => "InstanceId".to_owned(), - 7 => "PrimitiveId".to_owned(), - 8 => "InvocationId".to_owned(), - 9 => "Layer".to_owned(), - 10 => "ViewportIndex".to_owned(), - 11 => "TessLevelOuter".to_owned(), - 12 => "TessLevelInner".to_owned(), - 13 => "TessCoord".to_owned(), - 14 => "PatchVertices".to_owned(), - 15 => "FragCoord".to_owned(), - 16 => "PointCoord".to_owned(), - 17 => "FrontFacing".to_owned(), - 18 => "SampleId".to_owned(), - 19 => "SamplePosition".to_owned(), - 20 => "SampleMask".to_owned(), - 22 => "FragDepth".to_owned(), - 23 => "HelperInvocation".to_owned(), - 24 => "NumWorkgroups".to_owned(), - 25 => "WorkgroupSize".to_owned(), - 26 => "WorkgroupId".to_owned(), - 27 => "LocalInvocationId".to_owned(), - 28 => "GlobalInvocationId".to_owned(), - 29 => "LocalInvocationIndex".to_owned(), - 30 => "WorkDim".to_owned(), - 31 => "GlobalSize".to_owned(), - 32 => "EnqueuedWorkgroupSize".to_owned(), - 33 => "GlobalOffset".to_owned(), - 34 => "GlobalLinearId".to_owned(), - 36 => "SubgroupSize".to_owned(), - 37 => "SubgroupMaxSize".to_owned(), - 38 => "NumSubgroups".to_owned(), - 39 => "NumEnqueuedSubgroups".to_owned(), - 40 => "SubgroupId".to_owned(), - 41 => "SubgroupLocalInvocationId".to_owned(), - 42 => "VertexIndex".to_owned(), - 43 => "InstanceIndex".to_owned(), - 4160 => "CoreIDARM".to_owned(), - 4161 => "CoreCountARM".to_owned(), - 4162 => "CoreMaxIDARM".to_owned(), - 4163 => "WarpIDARM".to_owned(), - 4164 => "WarpMaxIDARM".to_owned(), - 4416 => "SubgroupEqMask".to_owned(), - 4416 => "SubgroupEqMaskKHR".to_owned(), - 4417 => "SubgroupGeMask".to_owned(), - 4417 => "SubgroupGeMaskKHR".to_owned(), - 4418 => "SubgroupGtMask".to_owned(), - 4418 => "SubgroupGtMaskKHR".to_owned(), - 4419 => "SubgroupLeMask".to_owned(), - 4419 => "SubgroupLeMaskKHR".to_owned(), - 4420 => "SubgroupLtMask".to_owned(), - 4420 => "SubgroupLtMaskKHR".to_owned(), - 4424 => "BaseVertex".to_owned(), - 4425 => "BaseInstance".to_owned(), - 4426 => "DrawIndex".to_owned(), - 4432 => "PrimitiveShadingRateKHR".to_owned(), - 4438 => "DeviceIndex".to_owned(), - 4440 => "ViewIndex".to_owned(), - 4444 => "ShadingRateKHR".to_owned(), - 4992 => "BaryCoordNoPerspAMD".to_owned(), - 4993 => "BaryCoordNoPerspCentroidAMD".to_owned(), - 4994 => "BaryCoordNoPerspSampleAMD".to_owned(), - 4995 => "BaryCoordSmoothAMD".to_owned(), - 4996 => "BaryCoordSmoothCentroidAMD".to_owned(), - 4997 => "BaryCoordSmoothSampleAMD".to_owned(), - 4998 => "BaryCoordPullModelAMD".to_owned(), - 5014 => "FragStencilRefEXT".to_owned(), - 5021 => "CoalescedInputCountAMDX".to_owned(), - 5073 => "ShaderIndexAMDX".to_owned(), - 5253 => "ViewportMaskNV".to_owned(), - 5257 => "SecondaryPositionNV".to_owned(), - 5258 => "SecondaryViewportMaskNV".to_owned(), - 5261 => "PositionPerViewNV".to_owned(), - 5262 => "ViewportMaskPerViewNV".to_owned(), - 5264 => "FullyCoveredEXT".to_owned(), - 5274 => "TaskCountNV".to_owned(), - 5275 => "PrimitiveCountNV".to_owned(), - 5276 => "PrimitiveIndicesNV".to_owned(), - 5277 => "ClipDistancePerViewNV".to_owned(), - 5278 => "CullDistancePerViewNV".to_owned(), - 5279 => "LayerPerViewNV".to_owned(), - 5280 => "MeshViewCountNV".to_owned(), - 5281 => "MeshViewIndicesNV".to_owned(), - 5286 => "BaryCoordKHR".to_owned(), - 5286 => "BaryCoordNV".to_owned(), - 5287 => "BaryCoordNoPerspKHR".to_owned(), - 5287 => "BaryCoordNoPerspNV".to_owned(), - 5292 => "FragSizeEXT".to_owned(), - 5292 => "FragmentSizeNV".to_owned(), - 5293 => "FragInvocationCountEXT".to_owned(), - 5293 => "InvocationsPerPixelNV".to_owned(), - 5294 => "PrimitivePointIndicesEXT".to_owned(), - 5295 => "PrimitiveLineIndicesEXT".to_owned(), - 5296 => "PrimitiveTriangleIndicesEXT".to_owned(), - 5299 => "CullPrimitiveEXT".to_owned(), - 5319 => "LaunchIdNV".to_owned(), - 5319 => "LaunchIdKHR".to_owned(), - 5320 => "LaunchSizeNV".to_owned(), - 5320 => "LaunchSizeKHR".to_owned(), - 5321 => "WorldRayOriginNV".to_owned(), - 5321 => "WorldRayOriginKHR".to_owned(), - 5322 => "WorldRayDirectionNV".to_owned(), - 5322 => "WorldRayDirectionKHR".to_owned(), - 5323 => "ObjectRayOriginNV".to_owned(), - 5323 => "ObjectRayOriginKHR".to_owned(), - 5324 => "ObjectRayDirectionNV".to_owned(), - 5324 => "ObjectRayDirectionKHR".to_owned(), - 5325 => "RayTminNV".to_owned(), - 5325 => "RayTminKHR".to_owned(), - 5326 => "RayTmaxNV".to_owned(), - 5326 => "RayTmaxKHR".to_owned(), - 5327 => "InstanceCustomIndexNV".to_owned(), - 5327 => "InstanceCustomIndexKHR".to_owned(), - 5330 => "ObjectToWorldNV".to_owned(), - 5330 => "ObjectToWorldKHR".to_owned(), - 5331 => "WorldToObjectNV".to_owned(), - 5331 => "WorldToObjectKHR".to_owned(), - 5332 => "HitTNV".to_owned(), - 5333 => "HitKindNV".to_owned(), - 5333 => "HitKindKHR".to_owned(), - 5334 => "CurrentRayTimeNV".to_owned(), - 5335 => "HitTriangleVertexPositionsKHR".to_owned(), - 5337 => "HitMicroTriangleVertexPositionsNV".to_owned(), - 5344 => "HitMicroTriangleVertexBarycentricsNV".to_owned(), - 5351 => "IncomingRayFlagsNV".to_owned(), - 5351 => "IncomingRayFlagsKHR".to_owned(), - 5352 => "RayGeometryIndexKHR".to_owned(), - 5374 => "WarpsPerSMNV".to_owned(), - 5375 => "SMCountNV".to_owned(), - 5376 => "WarpIDNV".to_owned(), - 5377 => "SMIDNV".to_owned(), - 5405 => "HitKindFrontFacingMicroTriangleNV".to_owned(), - 5406 => "HitKindBackFacingMicroTriangleNV".to_owned(), - 6021 => "CullMaskKHR".to_owned(), - _ => value.to_string(), - }, - "Scope" => match value { - 0 => "CrossDevice".to_owned(), - 1 => "Device".to_owned(), - 2 => "Workgroup".to_owned(), - 3 => "Subgroup".to_owned(), - 4 => "Invocation".to_owned(), - 5 => "QueueFamily".to_owned(), - 5 => "QueueFamilyKHR".to_owned(), - 6 => "ShaderCallKHR".to_owned(), - _ => value.to_string(), - }, - "GroupOperation" => match value { - 0 => "Reduce".to_owned(), - 1 => "InclusiveScan".to_owned(), - 2 => "ExclusiveScan".to_owned(), - 3 => "ClusteredReduce".to_owned(), - 6 => "PartitionedReduceNV".to_owned(), - 7 => "PartitionedInclusiveScanNV".to_owned(), - 8 => "PartitionedExclusiveScanNV".to_owned(), - _ => value.to_string(), - }, - "KernelEnqueueFlags" => match value { - 0 => "NoWait".to_owned(), - 1 => "WaitKernel".to_owned(), - 2 => "WaitWorkGroup".to_owned(), - _ => value.to_string(), - }, - "Capability" => match value { - 0 => "Matrix".to_owned(), - 1 => "Shader".to_owned(), - 2 => "Geometry".to_owned(), - 3 => "Tessellation".to_owned(), - 4 => "Addresses".to_owned(), - 5 => "Linkage".to_owned(), - 6 => "Kernel".to_owned(), - 7 => "Vector16".to_owned(), - 8 => "Float16Buffer".to_owned(), - 9 => "Float16".to_owned(), - 10 => "Float64".to_owned(), - 11 => "Int64".to_owned(), - 12 => "Int64Atomics".to_owned(), - 13 => "ImageBasic".to_owned(), - 14 => "ImageReadWrite".to_owned(), - 15 => "ImageMipmap".to_owned(), - 17 => "Pipes".to_owned(), - 18 => "Groups".to_owned(), - 19 => "DeviceEnqueue".to_owned(), - 20 => "LiteralSampler".to_owned(), - 21 => "AtomicStorage".to_owned(), - 22 => "Int16".to_owned(), - 23 => "TessellationPointSize".to_owned(), - 24 => "GeometryPointSize".to_owned(), - 25 => "ImageGatherExtended".to_owned(), - 27 => "StorageImageMultisample".to_owned(), - 28 => "UniformBufferArrayDynamicIndexing".to_owned(), - 29 => "SampledImageArrayDynamicIndexing".to_owned(), - 30 => "StorageBufferArrayDynamicIndexing".to_owned(), - 31 => "StorageImageArrayDynamicIndexing".to_owned(), - 32 => "ClipDistance".to_owned(), - 33 => "CullDistance".to_owned(), - 34 => "ImageCubeArray".to_owned(), - 35 => "SampleRateShading".to_owned(), - 36 => "ImageRect".to_owned(), - 37 => "SampledRect".to_owned(), - 38 => "GenericPointer".to_owned(), - 39 => "Int8".to_owned(), - 40 => "InputAttachment".to_owned(), - 41 => "SparseResidency".to_owned(), - 42 => "MinLod".to_owned(), - 43 => "Sampled1D".to_owned(), - 44 => "Image1D".to_owned(), - 45 => "SampledCubeArray".to_owned(), - 46 => "SampledBuffer".to_owned(), - 47 => "ImageBuffer".to_owned(), - 48 => "ImageMSArray".to_owned(), - 49 => "StorageImageExtendedFormats".to_owned(), - 50 => "ImageQuery".to_owned(), - 51 => "DerivativeControl".to_owned(), - 52 => "InterpolationFunction".to_owned(), - 53 => "TransformFeedback".to_owned(), - 54 => "GeometryStreams".to_owned(), - 55 => "StorageImageReadWithoutFormat".to_owned(), - 56 => "StorageImageWriteWithoutFormat".to_owned(), - 57 => "MultiViewport".to_owned(), - 58 => "SubgroupDispatch".to_owned(), - 59 => "NamedBarrier".to_owned(), - 60 => "PipeStorage".to_owned(), - 61 => "GroupNonUniform".to_owned(), - 62 => "GroupNonUniformVote".to_owned(), - 63 => "GroupNonUniformArithmetic".to_owned(), - 64 => "GroupNonUniformBallot".to_owned(), - 65 => "GroupNonUniformShuffle".to_owned(), - 66 => "GroupNonUniformShuffleRelative".to_owned(), - 67 => "GroupNonUniformClustered".to_owned(), - 68 => "GroupNonUniformQuad".to_owned(), - 69 => "ShaderLayer".to_owned(), - 70 => "ShaderViewportIndex".to_owned(), - 71 => "UniformDecoration".to_owned(), - 4165 => "CoreBuiltinsARM".to_owned(), - 4166 => "TileImageColorReadAccessEXT".to_owned(), - 4167 => "TileImageDepthReadAccessEXT".to_owned(), - 4168 => "TileImageStencilReadAccessEXT".to_owned(), - 4422 => "FragmentShadingRateKHR".to_owned(), - 4423 => "SubgroupBallotKHR".to_owned(), - 4427 => "DrawParameters".to_owned(), - 4428 => "WorkgroupMemoryExplicitLayoutKHR".to_owned(), - 4429 => "WorkgroupMemoryExplicitLayout8BitAccessKHR".to_owned(), - 4430 => "WorkgroupMemoryExplicitLayout16BitAccessKHR".to_owned(), - 4431 => "SubgroupVoteKHR".to_owned(), - 4433 => "StorageBuffer16BitAccess".to_owned(), - 4433 => "StorageUniformBufferBlock16".to_owned(), - 4434 => "UniformAndStorageBuffer16BitAccess".to_owned(), - 4434 => "StorageUniform16".to_owned(), - 4435 => "StoragePushConstant16".to_owned(), - 4436 => "StorageInputOutput16".to_owned(), - 4437 => "DeviceGroup".to_owned(), - 4439 => "MultiView".to_owned(), - 4441 => "VariablePointersStorageBuffer".to_owned(), - 4442 => "VariablePointers".to_owned(), - 4445 => "AtomicStorageOps".to_owned(), - 4447 => "SampleMaskPostDepthCoverage".to_owned(), - 4448 => "StorageBuffer8BitAccess".to_owned(), - 4449 => "UniformAndStorageBuffer8BitAccess".to_owned(), - 4450 => "StoragePushConstant8".to_owned(), - 4464 => "DenormPreserve".to_owned(), - 4465 => "DenormFlushToZero".to_owned(), - 4466 => "SignedZeroInfNanPreserve".to_owned(), - 4467 => "RoundingModeRTE".to_owned(), - 4468 => "RoundingModeRTZ".to_owned(), - 4471 => "RayQueryProvisionalKHR".to_owned(), - 4472 => "RayQueryKHR".to_owned(), - 4478 => "RayTraversalPrimitiveCullingKHR".to_owned(), - 4479 => "RayTracingKHR".to_owned(), - 4484 => "TextureSampleWeightedQCOM".to_owned(), - 4485 => "TextureBoxFilterQCOM".to_owned(), - 4486 => "TextureBlockMatchQCOM".to_owned(), - 5008 => "Float16ImageAMD".to_owned(), - 5009 => "ImageGatherBiasLodAMD".to_owned(), - 5010 => "FragmentMaskAMD".to_owned(), - 5013 => "StencilExportEXT".to_owned(), - 5015 => "ImageReadWriteLodAMD".to_owned(), - 5016 => "Int64ImageEXT".to_owned(), - 5055 => "ShaderClockKHR".to_owned(), - 5067 => "ShaderEnqueueAMDX".to_owned(), - 5249 => "SampleMaskOverrideCoverageNV".to_owned(), - 5251 => "GeometryShaderPassthroughNV".to_owned(), - 5254 => "ShaderViewportIndexLayerEXT".to_owned(), - 5254 => "ShaderViewportIndexLayerNV".to_owned(), - 5255 => "ShaderViewportMaskNV".to_owned(), - 5259 => "ShaderStereoViewNV".to_owned(), - 5260 => "PerViewAttributesNV".to_owned(), - 5265 => "FragmentFullyCoveredEXT".to_owned(), - 5266 => "MeshShadingNV".to_owned(), - 5282 => "ImageFootprintNV".to_owned(), - 5283 => "MeshShadingEXT".to_owned(), - 5284 => "FragmentBarycentricKHR".to_owned(), - 5284 => "FragmentBarycentricNV".to_owned(), - 5288 => "ComputeDerivativeGroupQuadsNV".to_owned(), - 5291 => "FragmentDensityEXT".to_owned(), - 5291 => "ShadingRateNV".to_owned(), - 5297 => "GroupNonUniformPartitionedNV".to_owned(), - 5301 => "ShaderNonUniform".to_owned(), - 5301 => "ShaderNonUniformEXT".to_owned(), - 5302 => "RuntimeDescriptorArray".to_owned(), - 5302 => "RuntimeDescriptorArrayEXT".to_owned(), - 5303 => "InputAttachmentArrayDynamicIndexing".to_owned(), - 5303 => "InputAttachmentArrayDynamicIndexingEXT".to_owned(), - 5304 => "UniformTexelBufferArrayDynamicIndexing".to_owned(), - 5304 => "UniformTexelBufferArrayDynamicIndexingEXT".to_owned(), - 5305 => "StorageTexelBufferArrayDynamicIndexing".to_owned(), - 5305 => "StorageTexelBufferArrayDynamicIndexingEXT".to_owned(), - 5306 => "UniformBufferArrayNonUniformIndexing".to_owned(), - 5306 => "UniformBufferArrayNonUniformIndexingEXT".to_owned(), - 5307 => "SampledImageArrayNonUniformIndexing".to_owned(), - 5307 => "SampledImageArrayNonUniformIndexingEXT".to_owned(), - 5308 => "StorageBufferArrayNonUniformIndexing".to_owned(), - 5308 => "StorageBufferArrayNonUniformIndexingEXT".to_owned(), - 5309 => "StorageImageArrayNonUniformIndexing".to_owned(), - 5309 => "StorageImageArrayNonUniformIndexingEXT".to_owned(), - 5310 => "InputAttachmentArrayNonUniformIndexing".to_owned(), - 5310 => "InputAttachmentArrayNonUniformIndexingEXT".to_owned(), - 5311 => "UniformTexelBufferArrayNonUniformIndexing".to_owned(), - 5311 => "UniformTexelBufferArrayNonUniformIndexingEXT".to_owned(), - 5312 => "StorageTexelBufferArrayNonUniformIndexing".to_owned(), - 5312 => "StorageTexelBufferArrayNonUniformIndexingEXT".to_owned(), - 5336 => "RayTracingPositionFetchKHR".to_owned(), - 5340 => "RayTracingNV".to_owned(), - 5341 => "RayTracingMotionBlurNV".to_owned(), - 5345 => "VulkanMemoryModel".to_owned(), - 5345 => "VulkanMemoryModelKHR".to_owned(), - 5346 => "VulkanMemoryModelDeviceScope".to_owned(), - 5346 => "VulkanMemoryModelDeviceScopeKHR".to_owned(), - 5347 => "PhysicalStorageBufferAddresses".to_owned(), - 5347 => "PhysicalStorageBufferAddressesEXT".to_owned(), - 5350 => "ComputeDerivativeGroupLinearNV".to_owned(), - 5353 => "RayTracingProvisionalKHR".to_owned(), - 5357 => "CooperativeMatrixNV".to_owned(), - 5363 => "FragmentShaderSampleInterlockEXT".to_owned(), - 5372 => "FragmentShaderShadingRateInterlockEXT".to_owned(), - 5373 => "ShaderSMBuiltinsNV".to_owned(), - 5378 => "FragmentShaderPixelInterlockEXT".to_owned(), - 5379 => "DemoteToHelperInvocation".to_owned(), - 5379 => "DemoteToHelperInvocationEXT".to_owned(), - 5380 => "DisplacementMicromapNV".to_owned(), - 5381 => "RayTracingOpacityMicromapEXT".to_owned(), - 5383 => "ShaderInvocationReorderNV".to_owned(), - 5390 => "BindlessTextureNV".to_owned(), - 5391 => "RayQueryPositionFetchKHR".to_owned(), - 5409 => "RayTracingDisplacementMicromapNV".to_owned(), - 5568 => "SubgroupShuffleINTEL".to_owned(), - 5569 => "SubgroupBufferBlockIOINTEL".to_owned(), - 5570 => "SubgroupImageBlockIOINTEL".to_owned(), - 5579 => "SubgroupImageMediaBlockIOINTEL".to_owned(), - 5582 => "RoundToInfinityINTEL".to_owned(), - 5583 => "FloatingPointModeINTEL".to_owned(), - 5584 => "IntegerFunctions2INTEL".to_owned(), - 5603 => "FunctionPointersINTEL".to_owned(), - 5604 => "IndirectReferencesINTEL".to_owned(), - 5606 => "AsmINTEL".to_owned(), - 5612 => "AtomicFloat32MinMaxEXT".to_owned(), - 5613 => "AtomicFloat64MinMaxEXT".to_owned(), - 5616 => "AtomicFloat16MinMaxEXT".to_owned(), - 5617 => "VectorComputeINTEL".to_owned(), - 5619 => "VectorAnyINTEL".to_owned(), - 5629 => "ExpectAssumeKHR".to_owned(), - 5696 => "SubgroupAvcMotionEstimationINTEL".to_owned(), - 5697 => "SubgroupAvcMotionEstimationIntraINTEL".to_owned(), - 5698 => "SubgroupAvcMotionEstimationChromaINTEL".to_owned(), - 5817 => "VariableLengthArrayINTEL".to_owned(), - 5821 => "FunctionFloatControlINTEL".to_owned(), - 5824 => "FPGAMemoryAttributesINTEL".to_owned(), - 5837 => "FPFastMathModeINTEL".to_owned(), - 5844 => "ArbitraryPrecisionIntegersINTEL".to_owned(), - 5845 => "ArbitraryPrecisionFloatingPointINTEL".to_owned(), - 5886 => "UnstructuredLoopControlsINTEL".to_owned(), - 5888 => "FPGALoopControlsINTEL".to_owned(), - 5892 => "KernelAttributesINTEL".to_owned(), - 5897 => "FPGAKernelAttributesINTEL".to_owned(), - 5898 => "FPGAMemoryAccessesINTEL".to_owned(), - 5904 => "FPGAClusterAttributesINTEL".to_owned(), - 5906 => "LoopFuseINTEL".to_owned(), - 5908 => "FPGADSPControlINTEL".to_owned(), - 5910 => "MemoryAccessAliasingINTEL".to_owned(), - 5916 => "FPGAInvocationPipeliningAttributesINTEL".to_owned(), - 5920 => "FPGABufferLocationINTEL".to_owned(), - 5922 => "ArbitraryPrecisionFixedPointINTEL".to_owned(), - 5935 => "USMStorageClassesINTEL".to_owned(), - 5939 => "RuntimeAlignedAttributeINTEL".to_owned(), - 5943 => "IOPipesINTEL".to_owned(), - 5945 => "BlockingPipesINTEL".to_owned(), - 5948 => "FPGARegINTEL".to_owned(), - 6016 => "DotProductInputAll".to_owned(), - 6016 => "DotProductInputAllKHR".to_owned(), - 6017 => "DotProductInput4x8Bit".to_owned(), - 6017 => "DotProductInput4x8BitKHR".to_owned(), - 6018 => "DotProductInput4x8BitPacked".to_owned(), - 6018 => "DotProductInput4x8BitPackedKHR".to_owned(), - 6019 => "DotProduct".to_owned(), - 6019 => "DotProductKHR".to_owned(), - 6020 => "RayCullMaskKHR".to_owned(), - 6022 => "CooperativeMatrixKHR".to_owned(), - 6025 => "BitInstructions".to_owned(), - 6026 => "GroupNonUniformRotateKHR".to_owned(), - 6033 => "AtomicFloat32AddEXT".to_owned(), - 6034 => "AtomicFloat64AddEXT".to_owned(), - 6089 => "LongCompositesINTEL".to_owned(), - 6094 => "OptNoneINTEL".to_owned(), - 6095 => "AtomicFloat16AddEXT".to_owned(), - 6114 => "DebugInfoModuleINTEL".to_owned(), - 6115 => "BFloat16ConversionINTEL".to_owned(), - 6141 => "SplitBarrierINTEL".to_owned(), - 6150 => "FPGAClusterAttributesV2INTEL".to_owned(), - 6161 => "FPGAKernelAttributesv2INTEL".to_owned(), - 6169 => "FPMaxErrorINTEL".to_owned(), - 6171 => "FPGALatencyControlINTEL".to_owned(), - 6174 => "FPGAArgumentInterfacesINTEL".to_owned(), - 6187 => "GlobalVariableHostAccessINTEL".to_owned(), - 6189 => "GlobalVariableFPGADecorationsINTEL".to_owned(), - 6400 => "GroupUniformArithmeticKHR".to_owned(), - 6441 => "CacheControlsINTEL".to_owned(), - _ => value.to_string(), - }, - "RayQueryIntersection" => match value { - 0 => "RayQueryCandidateIntersectionKHR".to_owned(), - 1 => "RayQueryCommittedIntersectionKHR".to_owned(), - _ => value.to_string(), - }, - "RayQueryCommittedIntersectionType" => match value { - 0 => "RayQueryCommittedIntersectionNoneKHR".to_owned(), - 1 => "RayQueryCommittedIntersectionTriangleKHR".to_owned(), - 2 => "RayQueryCommittedIntersectionGeneratedKHR".to_owned(), - _ => value.to_string(), - }, - "RayQueryCandidateIntersectionType" => match value { - 0 => "RayQueryCandidateIntersectionTriangleKHR".to_owned(), - 1 => "RayQueryCandidateIntersectionAABBKHR".to_owned(), - _ => value.to_string(), - }, - "PackedVectorFormat" => match value { - 0 => "PackedVectorFormat4x8Bit".to_owned(), - 0 => "PackedVectorFormat4x8BitKHR".to_owned(), - _ => value.to_string(), - }, - "CooperativeMatrixLayout" => match value { - 0 => "RowMajorKHR".to_owned(), - 1 => "ColumnMajorKHR".to_owned(), - _ => value.to_string(), - }, - "CooperativeMatrixUse" => match value { - 0 => "MatrixAKHR".to_owned(), - 1 => "MatrixBKHR".to_owned(), - 2 => "MatrixAccumulatorKHR".to_owned(), - _ => value.to_string(), - }, - "InitializationModeQualifier" => match value { - 0 => "InitOnDeviceReprogramINTEL".to_owned(), - 1 => "InitOnDeviceResetINTEL".to_owned(), - _ => value.to_string(), - }, - "LoadCacheControl" => match value { - 0 => "UncachedINTEL".to_owned(), - 1 => "CachedINTEL".to_owned(), - 2 => "StreamingINTEL".to_owned(), - 3 => "InvalidateAfterReadINTEL".to_owned(), - 4 => "ConstCachedINTEL".to_owned(), - _ => value.to_string(), - }, - "StoreCacheControl" => match value { - 0 => "UncachedINTEL".to_owned(), - 1 => "WriteThroughINTEL".to_owned(), - 2 => "WriteBackINTEL".to_owned(), - 3 => "StreamingINTEL".to_owned(), - _ => value.to_string(), - }, - "ImageOperands" => match value { - 0 => "None".to_owned(), - _ => value.to_string(), - }, - "FPFastMathMode" => match value { - 0 => "None".to_owned(), - _ => value.to_string(), - }, - "SelectionControl" => match value { - 0 => "None".to_owned(), - _ => value.to_string(), - }, - "LoopControl" => match value { - 0 => "None".to_owned(), - _ => value.to_string(), - }, - "FunctionControl" => match value { - 0 => "None".to_owned(), - _ => value.to_string(), - }, - "MemorySemantics" => match value { - 0 => "None".to_owned(), - _ => value.to_string(), - }, - "MemoryAccess" => match value { - 0 => "None".to_owned(), - _ => value.to_string(), - }, - "KernelProfilingInfo" => match value { - 0 => "None".to_owned(), - _ => value.to_string(), - }, - "RayFlags" => match value { - 0 => "None".to_owned(), - _ => value.to_string(), - }, - "FragmentShadingRate" => match value { - 0 => "None".to_owned(), - _ => value.to_string(), - }, - "CooperativeMatrixOperands" => match value { - 0 => "None".to_owned(), - _ => value.to_string(), - }, - _ => bail!("unknown enum: {}", ety), - }; - Ok(out) -} diff --git a/spirq-spvasm/src/generated/mod.rs b/spirq-spvasm/src/generated/mod.rs deleted file mode 100644 index 456d2cf..0000000 --- a/spirq-spvasm/src/generated/mod.rs +++ /dev/null @@ -1,19 +0,0 @@ -mod decorate_parameter_enum_type; -mod enum_from_str; -mod enum_to_str; -mod op_from_str; -mod op_has_result_id; -mod op_has_result_type_id; -mod op_to_str; -mod operand_enum_type; -mod print_operand; - -pub use decorate_parameter_enum_type::decorate_parameter_enum_type; -pub use enum_from_str::enum_from_str; -//pub use enum_to_str::enum_to_str; -pub use op_from_str::op_from_str; -pub use op_has_result_id::op_has_result_id; -pub use op_has_result_type_id::op_has_result_type_id; -pub use op_to_str::op_to_str; -pub use operand_enum_type::operand_enum_type; -pub use print_operand::print_operand; diff --git a/spirq-spvasm/src/generated/op_from_str.rs b/spirq-spvasm/src/generated/op_from_str.rs deleted file mode 100644 index 3fcbb37..0000000 --- a/spirq-spvasm/src/generated/op_from_str.rs +++ /dev/null @@ -1,732 +0,0 @@ -use anyhow::{bail, Result}; - -pub fn op_from_str(opname: &str) -> Result { - let out: u32 = match opname { - "OpNop" => 0, - "OpUndef" => 1, - "OpSourceContinued" => 2, - "OpSource" => 3, - "OpSourceExtension" => 4, - "OpName" => 5, - "OpMemberName" => 6, - "OpString" => 7, - "OpLine" => 8, - "OpExtension" => 10, - "OpExtInstImport" => 11, - "OpExtInst" => 12, - "OpMemoryModel" => 14, - "OpEntryPoint" => 15, - "OpExecutionMode" => 16, - "OpCapability" => 17, - "OpTypeVoid" => 19, - "OpTypeBool" => 20, - "OpTypeInt" => 21, - "OpTypeFloat" => 22, - "OpTypeVector" => 23, - "OpTypeMatrix" => 24, - "OpTypeImage" => 25, - "OpTypeSampler" => 26, - "OpTypeSampledImage" => 27, - "OpTypeArray" => 28, - "OpTypeRuntimeArray" => 29, - "OpTypeStruct" => 30, - "OpTypeOpaque" => 31, - "OpTypePointer" => 32, - "OpTypeFunction" => 33, - "OpTypeEvent" => 34, - "OpTypeDeviceEvent" => 35, - "OpTypeReserveId" => 36, - "OpTypeQueue" => 37, - "OpTypePipe" => 38, - "OpTypeForwardPointer" => 39, - "OpConstantTrue" => 41, - "OpConstantFalse" => 42, - "OpConstant" => 43, - "OpConstantComposite" => 44, - "OpConstantSampler" => 45, - "OpConstantNull" => 46, - "OpSpecConstantTrue" => 48, - "OpSpecConstantFalse" => 49, - "OpSpecConstant" => 50, - "OpSpecConstantComposite" => 51, - "OpSpecConstantOp" => 52, - "OpFunction" => 54, - "OpFunctionParameter" => 55, - "OpFunctionEnd" => 56, - "OpFunctionCall" => 57, - "OpVariable" => 59, - "OpImageTexelPointer" => 60, - "OpLoad" => 61, - "OpStore" => 62, - "OpCopyMemory" => 63, - "OpCopyMemorySized" => 64, - "OpAccessChain" => 65, - "OpInBoundsAccessChain" => 66, - "OpPtrAccessChain" => 67, - "OpArrayLength" => 68, - "OpGenericPtrMemSemantics" => 69, - "OpInBoundsPtrAccessChain" => 70, - "OpDecorate" => 71, - "OpMemberDecorate" => 72, - "OpDecorationGroup" => 73, - "OpGroupDecorate" => 74, - "OpGroupMemberDecorate" => 75, - "OpVectorExtractDynamic" => 77, - "OpVectorInsertDynamic" => 78, - "OpVectorShuffle" => 79, - "OpCompositeConstruct" => 80, - "OpCompositeExtract" => 81, - "OpCompositeInsert" => 82, - "OpCopyObject" => 83, - "OpTranspose" => 84, - "OpSampledImage" => 86, - "OpImageSampleImplicitLod" => 87, - "OpImageSampleExplicitLod" => 88, - "OpImageSampleDrefImplicitLod" => 89, - "OpImageSampleDrefExplicitLod" => 90, - "OpImageSampleProjImplicitLod" => 91, - "OpImageSampleProjExplicitLod" => 92, - "OpImageSampleProjDrefImplicitLod" => 93, - "OpImageSampleProjDrefExplicitLod" => 94, - "OpImageFetch" => 95, - "OpImageGather" => 96, - "OpImageDrefGather" => 97, - "OpImageRead" => 98, - "OpImageWrite" => 99, - "OpImage" => 100, - "OpImageQueryFormat" => 101, - "OpImageQueryOrder" => 102, - "OpImageQuerySizeLod" => 103, - "OpImageQuerySize" => 104, - "OpImageQueryLod" => 105, - "OpImageQueryLevels" => 106, - "OpImageQuerySamples" => 107, - "OpConvertFToU" => 109, - "OpConvertFToS" => 110, - "OpConvertSToF" => 111, - "OpConvertUToF" => 112, - "OpUConvert" => 113, - "OpSConvert" => 114, - "OpFConvert" => 115, - "OpQuantizeToF16" => 116, - "OpConvertPtrToU" => 117, - "OpSatConvertSToU" => 118, - "OpSatConvertUToS" => 119, - "OpConvertUToPtr" => 120, - "OpPtrCastToGeneric" => 121, - "OpGenericCastToPtr" => 122, - "OpGenericCastToPtrExplicit" => 123, - "OpBitcast" => 124, - "OpSNegate" => 126, - "OpFNegate" => 127, - "OpIAdd" => 128, - "OpFAdd" => 129, - "OpISub" => 130, - "OpFSub" => 131, - "OpIMul" => 132, - "OpFMul" => 133, - "OpUDiv" => 134, - "OpSDiv" => 135, - "OpFDiv" => 136, - "OpUMod" => 137, - "OpSRem" => 138, - "OpSMod" => 139, - "OpFRem" => 140, - "OpFMod" => 141, - "OpVectorTimesScalar" => 142, - "OpMatrixTimesScalar" => 143, - "OpVectorTimesMatrix" => 144, - "OpMatrixTimesVector" => 145, - "OpMatrixTimesMatrix" => 146, - "OpOuterProduct" => 147, - "OpDot" => 148, - "OpIAddCarry" => 149, - "OpISubBorrow" => 150, - "OpUMulExtended" => 151, - "OpSMulExtended" => 152, - "OpAny" => 154, - "OpAll" => 155, - "OpIsNan" => 156, - "OpIsInf" => 157, - "OpIsFinite" => 158, - "OpIsNormal" => 159, - "OpSignBitSet" => 160, - "OpLessOrGreater" => 161, - "OpOrdered" => 162, - "OpUnordered" => 163, - "OpLogicalEqual" => 164, - "OpLogicalNotEqual" => 165, - "OpLogicalOr" => 166, - "OpLogicalAnd" => 167, - "OpLogicalNot" => 168, - "OpSelect" => 169, - "OpIEqual" => 170, - "OpINotEqual" => 171, - "OpUGreaterThan" => 172, - "OpSGreaterThan" => 173, - "OpUGreaterThanEqual" => 174, - "OpSGreaterThanEqual" => 175, - "OpULessThan" => 176, - "OpSLessThan" => 177, - "OpULessThanEqual" => 178, - "OpSLessThanEqual" => 179, - "OpFOrdEqual" => 180, - "OpFUnordEqual" => 181, - "OpFOrdNotEqual" => 182, - "OpFUnordNotEqual" => 183, - "OpFOrdLessThan" => 184, - "OpFUnordLessThan" => 185, - "OpFOrdGreaterThan" => 186, - "OpFUnordGreaterThan" => 187, - "OpFOrdLessThanEqual" => 188, - "OpFUnordLessThanEqual" => 189, - "OpFOrdGreaterThanEqual" => 190, - "OpFUnordGreaterThanEqual" => 191, - "OpShiftRightLogical" => 194, - "OpShiftRightArithmetic" => 195, - "OpShiftLeftLogical" => 196, - "OpBitwiseOr" => 197, - "OpBitwiseXor" => 198, - "OpBitwiseAnd" => 199, - "OpNot" => 200, - "OpBitFieldInsert" => 201, - "OpBitFieldSExtract" => 202, - "OpBitFieldUExtract" => 203, - "OpBitReverse" => 204, - "OpBitCount" => 205, - "OpDPdx" => 207, - "OpDPdy" => 208, - "OpFwidth" => 209, - "OpDPdxFine" => 210, - "OpDPdyFine" => 211, - "OpFwidthFine" => 212, - "OpDPdxCoarse" => 213, - "OpDPdyCoarse" => 214, - "OpFwidthCoarse" => 215, - "OpEmitVertex" => 218, - "OpEndPrimitive" => 219, - "OpEmitStreamVertex" => 220, - "OpEndStreamPrimitive" => 221, - "OpControlBarrier" => 224, - "OpMemoryBarrier" => 225, - "OpAtomicLoad" => 227, - "OpAtomicStore" => 228, - "OpAtomicExchange" => 229, - "OpAtomicCompareExchange" => 230, - "OpAtomicCompareExchangeWeak" => 231, - "OpAtomicIIncrement" => 232, - "OpAtomicIDecrement" => 233, - "OpAtomicIAdd" => 234, - "OpAtomicISub" => 235, - "OpAtomicSMin" => 236, - "OpAtomicUMin" => 237, - "OpAtomicSMax" => 238, - "OpAtomicUMax" => 239, - "OpAtomicAnd" => 240, - "OpAtomicOr" => 241, - "OpAtomicXor" => 242, - "OpPhi" => 245, - "OpLoopMerge" => 246, - "OpSelectionMerge" => 247, - "OpLabel" => 248, - "OpBranch" => 249, - "OpBranchConditional" => 250, - "OpSwitch" => 251, - "OpKill" => 252, - "OpReturn" => 253, - "OpReturnValue" => 254, - "OpUnreachable" => 255, - "OpLifetimeStart" => 256, - "OpLifetimeStop" => 257, - "OpGroupAsyncCopy" => 259, - "OpGroupWaitEvents" => 260, - "OpGroupAll" => 261, - "OpGroupAny" => 262, - "OpGroupBroadcast" => 263, - "OpGroupIAdd" => 264, - "OpGroupFAdd" => 265, - "OpGroupFMin" => 266, - "OpGroupUMin" => 267, - "OpGroupSMin" => 268, - "OpGroupFMax" => 269, - "OpGroupUMax" => 270, - "OpGroupSMax" => 271, - "OpReadPipe" => 274, - "OpWritePipe" => 275, - "OpReservedReadPipe" => 276, - "OpReservedWritePipe" => 277, - "OpReserveReadPipePackets" => 278, - "OpReserveWritePipePackets" => 279, - "OpCommitReadPipe" => 280, - "OpCommitWritePipe" => 281, - "OpIsValidReserveId" => 282, - "OpGetNumPipePackets" => 283, - "OpGetMaxPipePackets" => 284, - "OpGroupReserveReadPipePackets" => 285, - "OpGroupReserveWritePipePackets" => 286, - "OpGroupCommitReadPipe" => 287, - "OpGroupCommitWritePipe" => 288, - "OpEnqueueMarker" => 291, - "OpEnqueueKernel" => 292, - "OpGetKernelNDrangeSubGroupCount" => 293, - "OpGetKernelNDrangeMaxSubGroupSize" => 294, - "OpGetKernelWorkGroupSize" => 295, - "OpGetKernelPreferredWorkGroupSizeMultiple" => 296, - "OpRetainEvent" => 297, - "OpReleaseEvent" => 298, - "OpCreateUserEvent" => 299, - "OpIsValidEvent" => 300, - "OpSetUserEventStatus" => 301, - "OpCaptureEventProfilingInfo" => 302, - "OpGetDefaultQueue" => 303, - "OpBuildNDRange" => 304, - "OpImageSparseSampleImplicitLod" => 305, - "OpImageSparseSampleExplicitLod" => 306, - "OpImageSparseSampleDrefImplicitLod" => 307, - "OpImageSparseSampleDrefExplicitLod" => 308, - "OpImageSparseSampleProjImplicitLod" => 309, - "OpImageSparseSampleProjExplicitLod" => 310, - "OpImageSparseSampleProjDrefImplicitLod" => 311, - "OpImageSparseSampleProjDrefExplicitLod" => 312, - "OpImageSparseFetch" => 313, - "OpImageSparseGather" => 314, - "OpImageSparseDrefGather" => 315, - "OpImageSparseTexelsResident" => 316, - "OpNoLine" => 317, - "OpAtomicFlagTestAndSet" => 318, - "OpAtomicFlagClear" => 319, - "OpImageSparseRead" => 320, - "OpSizeOf" => 321, - "OpTypePipeStorage" => 322, - "OpConstantPipeStorage" => 323, - "OpCreatePipeFromPipeStorage" => 324, - "OpGetKernelLocalSizeForSubgroupCount" => 325, - "OpGetKernelMaxNumSubgroups" => 326, - "OpTypeNamedBarrier" => 327, - "OpNamedBarrierInitialize" => 328, - "OpMemoryNamedBarrier" => 329, - "OpModuleProcessed" => 330, - "OpExecutionModeId" => 331, - "OpDecorateId" => 332, - "OpGroupNonUniformElect" => 333, - "OpGroupNonUniformAll" => 334, - "OpGroupNonUniformAny" => 335, - "OpGroupNonUniformAllEqual" => 336, - "OpGroupNonUniformBroadcast" => 337, - "OpGroupNonUniformBroadcastFirst" => 338, - "OpGroupNonUniformBallot" => 339, - "OpGroupNonUniformInverseBallot" => 340, - "OpGroupNonUniformBallotBitExtract" => 341, - "OpGroupNonUniformBallotBitCount" => 342, - "OpGroupNonUniformBallotFindLSB" => 343, - "OpGroupNonUniformBallotFindMSB" => 344, - "OpGroupNonUniformShuffle" => 345, - "OpGroupNonUniformShuffleXor" => 346, - "OpGroupNonUniformShuffleUp" => 347, - "OpGroupNonUniformShuffleDown" => 348, - "OpGroupNonUniformIAdd" => 349, - "OpGroupNonUniformFAdd" => 350, - "OpGroupNonUniformIMul" => 351, - "OpGroupNonUniformFMul" => 352, - "OpGroupNonUniformSMin" => 353, - "OpGroupNonUniformUMin" => 354, - "OpGroupNonUniformFMin" => 355, - "OpGroupNonUniformSMax" => 356, - "OpGroupNonUniformUMax" => 357, - "OpGroupNonUniformFMax" => 358, - "OpGroupNonUniformBitwiseAnd" => 359, - "OpGroupNonUniformBitwiseOr" => 360, - "OpGroupNonUniformBitwiseXor" => 361, - "OpGroupNonUniformLogicalAnd" => 362, - "OpGroupNonUniformLogicalOr" => 363, - "OpGroupNonUniformLogicalXor" => 364, - "OpGroupNonUniformQuadBroadcast" => 365, - "OpGroupNonUniformQuadSwap" => 366, - "OpCopyLogical" => 400, - "OpPtrEqual" => 401, - "OpPtrNotEqual" => 402, - "OpPtrDiff" => 403, - "OpColorAttachmentReadEXT" => 4160, - "OpDepthAttachmentReadEXT" => 4161, - "OpStencilAttachmentReadEXT" => 4162, - "OpTerminateInvocation" => 4416, - "OpSubgroupBallotKHR" => 4421, - "OpSubgroupFirstInvocationKHR" => 4422, - "OpSubgroupAllKHR" => 4428, - "OpSubgroupAnyKHR" => 4429, - "OpSubgroupAllEqualKHR" => 4430, - "OpGroupNonUniformRotateKHR" => 4431, - "OpSubgroupReadInvocationKHR" => 4432, - "OpTraceRayKHR" => 4445, - "OpExecuteCallableKHR" => 4446, - "OpConvertUToAccelerationStructureKHR" => 4447, - "OpIgnoreIntersectionKHR" => 4448, - "OpTerminateRayKHR" => 4449, - "OpSDot" => 4450, - "OpSDotKHR" => 4450, - "OpUDot" => 4451, - "OpUDotKHR" => 4451, - "OpSUDot" => 4452, - "OpSUDotKHR" => 4452, - "OpSDotAccSat" => 4453, - "OpSDotAccSatKHR" => 4453, - "OpUDotAccSat" => 4454, - "OpUDotAccSatKHR" => 4454, - "OpSUDotAccSat" => 4455, - "OpSUDotAccSatKHR" => 4455, - "OpTypeCooperativeMatrixKHR" => 4456, - "OpCooperativeMatrixLoadKHR" => 4457, - "OpCooperativeMatrixStoreKHR" => 4458, - "OpCooperativeMatrixMulAddKHR" => 4459, - "OpCooperativeMatrixLengthKHR" => 4460, - "OpTypeRayQueryKHR" => 4472, - "OpRayQueryInitializeKHR" => 4473, - "OpRayQueryTerminateKHR" => 4474, - "OpRayQueryGenerateIntersectionKHR" => 4475, - "OpRayQueryConfirmIntersectionKHR" => 4476, - "OpRayQueryProceedKHR" => 4477, - "OpRayQueryGetIntersectionTypeKHR" => 4479, - "OpImageSampleWeightedQCOM" => 4480, - "OpImageBoxFilterQCOM" => 4481, - "OpImageBlockMatchSSDQCOM" => 4482, - "OpImageBlockMatchSADQCOM" => 4483, - "OpGroupIAddNonUniformAMD" => 5000, - "OpGroupFAddNonUniformAMD" => 5001, - "OpGroupFMinNonUniformAMD" => 5002, - "OpGroupUMinNonUniformAMD" => 5003, - "OpGroupSMinNonUniformAMD" => 5004, - "OpGroupFMaxNonUniformAMD" => 5005, - "OpGroupUMaxNonUniformAMD" => 5006, - "OpGroupSMaxNonUniformAMD" => 5007, - "OpFragmentMaskFetchAMD" => 5011, - "OpFragmentFetchAMD" => 5012, - "OpReadClockKHR" => 5056, - "OpFinalizeNodePayloadsAMDX" => 5075, - "OpFinishWritingNodePayloadAMDX" => 5078, - "OpInitializeNodePayloadsAMDX" => 5090, - "OpHitObjectRecordHitMotionNV" => 5249, - "OpHitObjectRecordHitWithIndexMotionNV" => 5250, - "OpHitObjectRecordMissMotionNV" => 5251, - "OpHitObjectGetWorldToObjectNV" => 5252, - "OpHitObjectGetObjectToWorldNV" => 5253, - "OpHitObjectGetObjectRayDirectionNV" => 5254, - "OpHitObjectGetObjectRayOriginNV" => 5255, - "OpHitObjectTraceRayMotionNV" => 5256, - "OpHitObjectGetShaderRecordBufferHandleNV" => 5257, - "OpHitObjectGetShaderBindingTableRecordIndexNV" => 5258, - "OpHitObjectRecordEmptyNV" => 5259, - "OpHitObjectTraceRayNV" => 5260, - "OpHitObjectRecordHitNV" => 5261, - "OpHitObjectRecordHitWithIndexNV" => 5262, - "OpHitObjectRecordMissNV" => 5263, - "OpHitObjectExecuteShaderNV" => 5264, - "OpHitObjectGetCurrentTimeNV" => 5265, - "OpHitObjectGetAttributesNV" => 5266, - "OpHitObjectGetHitKindNV" => 5267, - "OpHitObjectGetPrimitiveIndexNV" => 5268, - "OpHitObjectGetGeometryIndexNV" => 5269, - "OpHitObjectGetInstanceIdNV" => 5270, - "OpHitObjectGetInstanceCustomIndexNV" => 5271, - "OpHitObjectGetWorldRayDirectionNV" => 5272, - "OpHitObjectGetWorldRayOriginNV" => 5273, - "OpHitObjectGetRayTMaxNV" => 5274, - "OpHitObjectGetRayTMinNV" => 5275, - "OpHitObjectIsEmptyNV" => 5276, - "OpHitObjectIsHitNV" => 5277, - "OpHitObjectIsMissNV" => 5278, - "OpReorderThreadWithHitObjectNV" => 5279, - "OpReorderThreadWithHintNV" => 5280, - "OpTypeHitObjectNV" => 5281, - "OpImageSampleFootprintNV" => 5283, - "OpEmitMeshTasksEXT" => 5294, - "OpSetMeshOutputsEXT" => 5295, - "OpGroupNonUniformPartitionNV" => 5296, - "OpWritePackedPrimitiveIndices4x8NV" => 5299, - "OpFetchMicroTriangleVertexPositionNV" => 5300, - "OpFetchMicroTriangleVertexBarycentricNV" => 5301, - "OpReportIntersectionNV" => 5334, - "OpReportIntersectionKHR" => 5334, - "OpIgnoreIntersectionNV" => 5335, - "OpTerminateRayNV" => 5336, - "OpTraceNV" => 5337, - "OpTraceMotionNV" => 5338, - "OpTraceRayMotionNV" => 5339, - "OpRayQueryGetIntersectionTriangleVertexPositionsKHR" => 5340, - "OpTypeAccelerationStructureNV" => 5341, - "OpTypeAccelerationStructureKHR" => 5341, - "OpExecuteCallableNV" => 5344, - "OpTypeCooperativeMatrixNV" => 5358, - "OpCooperativeMatrixLoadNV" => 5359, - "OpCooperativeMatrixStoreNV" => 5360, - "OpCooperativeMatrixMulAddNV" => 5361, - "OpCooperativeMatrixLengthNV" => 5362, - "OpBeginInvocationInterlockEXT" => 5364, - "OpEndInvocationInterlockEXT" => 5365, - "OpDemoteToHelperInvocation" => 5380, - "OpDemoteToHelperInvocationEXT" => 5380, - "OpIsHelperInvocationEXT" => 5381, - "OpConvertUToImageNV" => 5391, - "OpConvertUToSamplerNV" => 5392, - "OpConvertImageToUNV" => 5393, - "OpConvertSamplerToUNV" => 5394, - "OpConvertUToSampledImageNV" => 5395, - "OpConvertSampledImageToUNV" => 5396, - "OpSamplerImageAddressingModeNV" => 5397, - "OpSubgroupShuffleINTEL" => 5571, - "OpSubgroupShuffleDownINTEL" => 5572, - "OpSubgroupShuffleUpINTEL" => 5573, - "OpSubgroupShuffleXorINTEL" => 5574, - "OpSubgroupBlockReadINTEL" => 5575, - "OpSubgroupBlockWriteINTEL" => 5576, - "OpSubgroupImageBlockReadINTEL" => 5577, - "OpSubgroupImageBlockWriteINTEL" => 5578, - "OpSubgroupImageMediaBlockReadINTEL" => 5580, - "OpSubgroupImageMediaBlockWriteINTEL" => 5581, - "OpUCountLeadingZerosINTEL" => 5585, - "OpUCountTrailingZerosINTEL" => 5586, - "OpAbsISubINTEL" => 5587, - "OpAbsUSubINTEL" => 5588, - "OpIAddSatINTEL" => 5589, - "OpUAddSatINTEL" => 5590, - "OpIAverageINTEL" => 5591, - "OpUAverageINTEL" => 5592, - "OpIAverageRoundedINTEL" => 5593, - "OpUAverageRoundedINTEL" => 5594, - "OpISubSatINTEL" => 5595, - "OpUSubSatINTEL" => 5596, - "OpIMul32x16INTEL" => 5597, - "OpUMul32x16INTEL" => 5598, - "OpConstantFunctionPointerINTEL" => 5600, - "OpFunctionPointerCallINTEL" => 5601, - "OpAsmTargetINTEL" => 5609, - "OpAsmINTEL" => 5610, - "OpAsmCallINTEL" => 5611, - "OpAtomicFMinEXT" => 5614, - "OpAtomicFMaxEXT" => 5615, - "OpAssumeTrueKHR" => 5630, - "OpExpectKHR" => 5631, - "OpDecorateString" => 5632, - "OpDecorateStringGOOGLE" => 5632, - "OpMemberDecorateString" => 5633, - "OpMemberDecorateStringGOOGLE" => 5633, - "OpVmeImageINTEL" => 5699, - "OpTypeVmeImageINTEL" => 5700, - "OpTypeAvcImePayloadINTEL" => 5701, - "OpTypeAvcRefPayloadINTEL" => 5702, - "OpTypeAvcSicPayloadINTEL" => 5703, - "OpTypeAvcMcePayloadINTEL" => 5704, - "OpTypeAvcMceResultINTEL" => 5705, - "OpTypeAvcImeResultINTEL" => 5706, - "OpTypeAvcImeResultSingleReferenceStreamoutINTEL" => 5707, - "OpTypeAvcImeResultDualReferenceStreamoutINTEL" => 5708, - "OpTypeAvcImeSingleReferenceStreaminINTEL" => 5709, - "OpTypeAvcImeDualReferenceStreaminINTEL" => 5710, - "OpTypeAvcRefResultINTEL" => 5711, - "OpTypeAvcSicResultINTEL" => 5712, - "OpSubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL" => 5713, - "OpSubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL" => 5714, - "OpSubgroupAvcMceGetDefaultInterShapePenaltyINTEL" => 5715, - "OpSubgroupAvcMceSetInterShapePenaltyINTEL" => 5716, - "OpSubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL" => 5717, - "OpSubgroupAvcMceSetInterDirectionPenaltyINTEL" => 5718, - "OpSubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL" => 5719, - "OpSubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL" => 5720, - "OpSubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL" => 5721, - "OpSubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL" => 5722, - "OpSubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL" => 5723, - "OpSubgroupAvcMceSetMotionVectorCostFunctionINTEL" => 5724, - "OpSubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL" => 5725, - "OpSubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL" => 5726, - "OpSubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL" => 5727, - "OpSubgroupAvcMceSetAcOnlyHaarINTEL" => 5728, - "OpSubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL" => 5729, - "OpSubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL" => 5730, - "OpSubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL" => 5731, - "OpSubgroupAvcMceConvertToImePayloadINTEL" => 5732, - "OpSubgroupAvcMceConvertToImeResultINTEL" => 5733, - "OpSubgroupAvcMceConvertToRefPayloadINTEL" => 5734, - "OpSubgroupAvcMceConvertToRefResultINTEL" => 5735, - "OpSubgroupAvcMceConvertToSicPayloadINTEL" => 5736, - "OpSubgroupAvcMceConvertToSicResultINTEL" => 5737, - "OpSubgroupAvcMceGetMotionVectorsINTEL" => 5738, - "OpSubgroupAvcMceGetInterDistortionsINTEL" => 5739, - "OpSubgroupAvcMceGetBestInterDistortionsINTEL" => 5740, - "OpSubgroupAvcMceGetInterMajorShapeINTEL" => 5741, - "OpSubgroupAvcMceGetInterMinorShapeINTEL" => 5742, - "OpSubgroupAvcMceGetInterDirectionsINTEL" => 5743, - "OpSubgroupAvcMceGetInterMotionVectorCountINTEL" => 5744, - "OpSubgroupAvcMceGetInterReferenceIdsINTEL" => 5745, - "OpSubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL" => 5746, - "OpSubgroupAvcImeInitializeINTEL" => 5747, - "OpSubgroupAvcImeSetSingleReferenceINTEL" => 5748, - "OpSubgroupAvcImeSetDualReferenceINTEL" => 5749, - "OpSubgroupAvcImeRefWindowSizeINTEL" => 5750, - "OpSubgroupAvcImeAdjustRefOffsetINTEL" => 5751, - "OpSubgroupAvcImeConvertToMcePayloadINTEL" => 5752, - "OpSubgroupAvcImeSetMaxMotionVectorCountINTEL" => 5753, - "OpSubgroupAvcImeSetUnidirectionalMixDisableINTEL" => 5754, - "OpSubgroupAvcImeSetEarlySearchTerminationThresholdINTEL" => 5755, - "OpSubgroupAvcImeSetWeightedSadINTEL" => 5756, - "OpSubgroupAvcImeEvaluateWithSingleReferenceINTEL" => 5757, - "OpSubgroupAvcImeEvaluateWithDualReferenceINTEL" => 5758, - "OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL" => 5759, - "OpSubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL" => 5760, - "OpSubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL" => 5761, - "OpSubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL" => 5762, - "OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL" => 5763, - "OpSubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL" => 5764, - "OpSubgroupAvcImeConvertToMceResultINTEL" => 5765, - "OpSubgroupAvcImeGetSingleReferenceStreaminINTEL" => 5766, - "OpSubgroupAvcImeGetDualReferenceStreaminINTEL" => 5767, - "OpSubgroupAvcImeStripSingleReferenceStreamoutINTEL" => 5768, - "OpSubgroupAvcImeStripDualReferenceStreamoutINTEL" => 5769, - "OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL" => 5770, - "OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL" => 5771, - "OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL" => 5772, - "OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL" => 5773, - "OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL" => 5774, - "OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL" => 5775, - "OpSubgroupAvcImeGetBorderReachedINTEL" => 5776, - "OpSubgroupAvcImeGetTruncatedSearchIndicationINTEL" => 5777, - "OpSubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL" => 5778, - "OpSubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL" => 5779, - "OpSubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL" => 5780, - "OpSubgroupAvcFmeInitializeINTEL" => 5781, - "OpSubgroupAvcBmeInitializeINTEL" => 5782, - "OpSubgroupAvcRefConvertToMcePayloadINTEL" => 5783, - "OpSubgroupAvcRefSetBidirectionalMixDisableINTEL" => 5784, - "OpSubgroupAvcRefSetBilinearFilterEnableINTEL" => 5785, - "OpSubgroupAvcRefEvaluateWithSingleReferenceINTEL" => 5786, - "OpSubgroupAvcRefEvaluateWithDualReferenceINTEL" => 5787, - "OpSubgroupAvcRefEvaluateWithMultiReferenceINTEL" => 5788, - "OpSubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL" => 5789, - "OpSubgroupAvcRefConvertToMceResultINTEL" => 5790, - "OpSubgroupAvcSicInitializeINTEL" => 5791, - "OpSubgroupAvcSicConfigureSkcINTEL" => 5792, - "OpSubgroupAvcSicConfigureIpeLumaINTEL" => 5793, - "OpSubgroupAvcSicConfigureIpeLumaChromaINTEL" => 5794, - "OpSubgroupAvcSicGetMotionVectorMaskINTEL" => 5795, - "OpSubgroupAvcSicConvertToMcePayloadINTEL" => 5796, - "OpSubgroupAvcSicSetIntraLumaShapePenaltyINTEL" => 5797, - "OpSubgroupAvcSicSetIntraLumaModeCostFunctionINTEL" => 5798, - "OpSubgroupAvcSicSetIntraChromaModeCostFunctionINTEL" => 5799, - "OpSubgroupAvcSicSetBilinearFilterEnableINTEL" => 5800, - "OpSubgroupAvcSicSetSkcForwardTransformEnableINTEL" => 5801, - "OpSubgroupAvcSicSetBlockBasedRawSkipSadINTEL" => 5802, - "OpSubgroupAvcSicEvaluateIpeINTEL" => 5803, - "OpSubgroupAvcSicEvaluateWithSingleReferenceINTEL" => 5804, - "OpSubgroupAvcSicEvaluateWithDualReferenceINTEL" => 5805, - "OpSubgroupAvcSicEvaluateWithMultiReferenceINTEL" => 5806, - "OpSubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL" => 5807, - "OpSubgroupAvcSicConvertToMceResultINTEL" => 5808, - "OpSubgroupAvcSicGetIpeLumaShapeINTEL" => 5809, - "OpSubgroupAvcSicGetBestIpeLumaDistortionINTEL" => 5810, - "OpSubgroupAvcSicGetBestIpeChromaDistortionINTEL" => 5811, - "OpSubgroupAvcSicGetPackedIpeLumaModesINTEL" => 5812, - "OpSubgroupAvcSicGetIpeChromaModeINTEL" => 5813, - "OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL" => 5814, - "OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL" => 5815, - "OpSubgroupAvcSicGetInterRawSadsINTEL" => 5816, - "OpVariableLengthArrayINTEL" => 5818, - "OpSaveMemoryINTEL" => 5819, - "OpRestoreMemoryINTEL" => 5820, - "OpArbitraryFloatSinCosPiINTEL" => 5840, - "OpArbitraryFloatCastINTEL" => 5841, - "OpArbitraryFloatCastFromIntINTEL" => 5842, - "OpArbitraryFloatCastToIntINTEL" => 5843, - "OpArbitraryFloatAddINTEL" => 5846, - "OpArbitraryFloatSubINTEL" => 5847, - "OpArbitraryFloatMulINTEL" => 5848, - "OpArbitraryFloatDivINTEL" => 5849, - "OpArbitraryFloatGTINTEL" => 5850, - "OpArbitraryFloatGEINTEL" => 5851, - "OpArbitraryFloatLTINTEL" => 5852, - "OpArbitraryFloatLEINTEL" => 5853, - "OpArbitraryFloatEQINTEL" => 5854, - "OpArbitraryFloatRecipINTEL" => 5855, - "OpArbitraryFloatRSqrtINTEL" => 5856, - "OpArbitraryFloatCbrtINTEL" => 5857, - "OpArbitraryFloatHypotINTEL" => 5858, - "OpArbitraryFloatSqrtINTEL" => 5859, - "OpArbitraryFloatLogINTEL" => 5860, - "OpArbitraryFloatLog2INTEL" => 5861, - "OpArbitraryFloatLog10INTEL" => 5862, - "OpArbitraryFloatLog1pINTEL" => 5863, - "OpArbitraryFloatExpINTEL" => 5864, - "OpArbitraryFloatExp2INTEL" => 5865, - "OpArbitraryFloatExp10INTEL" => 5866, - "OpArbitraryFloatExpm1INTEL" => 5867, - "OpArbitraryFloatSinINTEL" => 5868, - "OpArbitraryFloatCosINTEL" => 5869, - "OpArbitraryFloatSinCosINTEL" => 5870, - "OpArbitraryFloatSinPiINTEL" => 5871, - "OpArbitraryFloatCosPiINTEL" => 5872, - "OpArbitraryFloatASinINTEL" => 5873, - "OpArbitraryFloatASinPiINTEL" => 5874, - "OpArbitraryFloatACosINTEL" => 5875, - "OpArbitraryFloatACosPiINTEL" => 5876, - "OpArbitraryFloatATanINTEL" => 5877, - "OpArbitraryFloatATanPiINTEL" => 5878, - "OpArbitraryFloatATan2INTEL" => 5879, - "OpArbitraryFloatPowINTEL" => 5880, - "OpArbitraryFloatPowRINTEL" => 5881, - "OpArbitraryFloatPowNINTEL" => 5882, - "OpLoopControlINTEL" => 5887, - "OpAliasDomainDeclINTEL" => 5911, - "OpAliasScopeDeclINTEL" => 5912, - "OpAliasScopeListDeclINTEL" => 5913, - "OpFixedSqrtINTEL" => 5923, - "OpFixedRecipINTEL" => 5924, - "OpFixedRsqrtINTEL" => 5925, - "OpFixedSinINTEL" => 5926, - "OpFixedCosINTEL" => 5927, - "OpFixedSinCosINTEL" => 5928, - "OpFixedSinPiINTEL" => 5929, - "OpFixedCosPiINTEL" => 5930, - "OpFixedSinCosPiINTEL" => 5931, - "OpFixedLogINTEL" => 5932, - "OpFixedExpINTEL" => 5933, - "OpPtrCastToCrossWorkgroupINTEL" => 5934, - "OpCrossWorkgroupCastToPtrINTEL" => 5938, - "OpReadPipeBlockingINTEL" => 5946, - "OpWritePipeBlockingINTEL" => 5947, - "OpFPGARegINTEL" => 5949, - "OpRayQueryGetRayTMinKHR" => 6016, - "OpRayQueryGetRayFlagsKHR" => 6017, - "OpRayQueryGetIntersectionTKHR" => 6018, - "OpRayQueryGetIntersectionInstanceCustomIndexKHR" => 6019, - "OpRayQueryGetIntersectionInstanceIdKHR" => 6020, - "OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR" => 6021, - "OpRayQueryGetIntersectionGeometryIndexKHR" => 6022, - "OpRayQueryGetIntersectionPrimitiveIndexKHR" => 6023, - "OpRayQueryGetIntersectionBarycentricsKHR" => 6024, - "OpRayQueryGetIntersectionFrontFaceKHR" => 6025, - "OpRayQueryGetIntersectionCandidateAABBOpaqueKHR" => 6026, - "OpRayQueryGetIntersectionObjectRayDirectionKHR" => 6027, - "OpRayQueryGetIntersectionObjectRayOriginKHR" => 6028, - "OpRayQueryGetWorldRayDirectionKHR" => 6029, - "OpRayQueryGetWorldRayOriginKHR" => 6030, - "OpRayQueryGetIntersectionObjectToWorldKHR" => 6031, - "OpRayQueryGetIntersectionWorldToObjectKHR" => 6032, - "OpAtomicFAddEXT" => 6035, - "OpTypeBufferSurfaceINTEL" => 6086, - "OpTypeStructContinuedINTEL" => 6090, - "OpConstantCompositeContinuedINTEL" => 6091, - "OpSpecConstantCompositeContinuedINTEL" => 6092, - "OpCompositeConstructContinuedINTEL" => 6096, - "OpConvertFToBF16INTEL" => 6116, - "OpConvertBF16ToFINTEL" => 6117, - "OpControlBarrierArriveINTEL" => 6142, - "OpControlBarrierWaitINTEL" => 6143, - "OpGroupIMulKHR" => 6401, - "OpGroupFMulKHR" => 6402, - "OpGroupBitwiseAndKHR" => 6403, - "OpGroupBitwiseOrKHR" => 6404, - "OpGroupBitwiseXorKHR" => 6405, - "OpGroupLogicalAndKHR" => 6406, - "OpGroupLogicalOrKHR" => 6407, - "OpGroupLogicalXorKHR" => 6408, - _ => bail!("Unknown opname: {}", opname), - }; - Ok(out) -} diff --git a/spirq-spvasm/src/generated/op_has_result_id.rs b/spirq-spvasm/src/generated/op_has_result_id.rs deleted file mode 100644 index bf09615..0000000 --- a/spirq-spvasm/src/generated/op_has_result_id.rs +++ /dev/null @@ -1,721 +0,0 @@ -use anyhow::{bail, Result}; - -pub fn op_has_result_id(opcode: u32) -> Result { - let out: bool = match opcode { - 0 => false, - 1 => true, - 2 => false, - 3 => false, - 4 => false, - 5 => false, - 6 => false, - 7 => true, - 8 => false, - 10 => false, - 11 => true, - 12 => true, - 14 => false, - 15 => false, - 16 => false, - 17 => false, - 19 => true, - 20 => true, - 21 => true, - 22 => true, - 23 => true, - 24 => true, - 25 => true, - 26 => true, - 27 => true, - 28 => true, - 29 => true, - 30 => true, - 31 => true, - 32 => true, - 33 => true, - 34 => true, - 35 => true, - 36 => true, - 37 => true, - 38 => true, - 39 => false, - 41 => true, - 42 => true, - 43 => true, - 44 => true, - 45 => true, - 46 => true, - 48 => true, - 49 => true, - 50 => true, - 51 => true, - 52 => true, - 54 => true, - 55 => true, - 56 => false, - 57 => true, - 59 => true, - 60 => true, - 61 => true, - 62 => false, - 63 => false, - 64 => false, - 65 => true, - 66 => true, - 67 => true, - 68 => true, - 69 => true, - 70 => true, - 71 => false, - 72 => false, - 73 => true, - 74 => false, - 75 => false, - 77 => true, - 78 => true, - 79 => true, - 80 => true, - 81 => true, - 82 => true, - 83 => true, - 84 => true, - 86 => true, - 87 => true, - 88 => true, - 89 => true, - 90 => true, - 91 => true, - 92 => true, - 93 => true, - 94 => true, - 95 => true, - 96 => true, - 97 => true, - 98 => true, - 99 => false, - 100 => true, - 101 => true, - 102 => true, - 103 => true, - 104 => true, - 105 => true, - 106 => true, - 107 => true, - 109 => true, - 110 => true, - 111 => true, - 112 => true, - 113 => true, - 114 => true, - 115 => true, - 116 => true, - 117 => true, - 118 => true, - 119 => true, - 120 => true, - 121 => true, - 122 => true, - 123 => true, - 124 => true, - 126 => true, - 127 => true, - 128 => true, - 129 => true, - 130 => true, - 131 => true, - 132 => true, - 133 => true, - 134 => true, - 135 => true, - 136 => true, - 137 => true, - 138 => true, - 139 => true, - 140 => true, - 141 => true, - 142 => true, - 143 => true, - 144 => true, - 145 => true, - 146 => true, - 147 => true, - 148 => true, - 149 => true, - 150 => true, - 151 => true, - 152 => true, - 154 => true, - 155 => true, - 156 => true, - 157 => true, - 158 => true, - 159 => true, - 160 => true, - 161 => true, - 162 => true, - 163 => true, - 164 => true, - 165 => true, - 166 => true, - 167 => true, - 168 => true, - 169 => true, - 170 => true, - 171 => true, - 172 => true, - 173 => true, - 174 => true, - 175 => true, - 176 => true, - 177 => true, - 178 => true, - 179 => true, - 180 => true, - 181 => true, - 182 => true, - 183 => true, - 184 => true, - 185 => true, - 186 => true, - 187 => true, - 188 => true, - 189 => true, - 190 => true, - 191 => true, - 194 => true, - 195 => true, - 196 => true, - 197 => true, - 198 => true, - 199 => true, - 200 => true, - 201 => true, - 202 => true, - 203 => true, - 204 => true, - 205 => true, - 207 => true, - 208 => true, - 209 => true, - 210 => true, - 211 => true, - 212 => true, - 213 => true, - 214 => true, - 215 => true, - 218 => false, - 219 => false, - 220 => false, - 221 => false, - 224 => false, - 225 => false, - 227 => true, - 228 => false, - 229 => true, - 230 => true, - 231 => true, - 232 => true, - 233 => true, - 234 => true, - 235 => true, - 236 => true, - 237 => true, - 238 => true, - 239 => true, - 240 => true, - 241 => true, - 242 => true, - 245 => true, - 246 => false, - 247 => false, - 248 => true, - 249 => false, - 250 => false, - 251 => false, - 252 => false, - 253 => false, - 254 => false, - 255 => false, - 256 => false, - 257 => false, - 259 => true, - 260 => false, - 261 => true, - 262 => true, - 263 => true, - 264 => true, - 265 => true, - 266 => true, - 267 => true, - 268 => true, - 269 => true, - 270 => true, - 271 => true, - 274 => true, - 275 => true, - 276 => true, - 277 => true, - 278 => true, - 279 => true, - 280 => false, - 281 => false, - 282 => true, - 283 => true, - 284 => true, - 285 => true, - 286 => true, - 287 => false, - 288 => false, - 291 => true, - 292 => true, - 293 => true, - 294 => true, - 295 => true, - 296 => true, - 297 => false, - 298 => false, - 299 => true, - 300 => true, - 301 => false, - 302 => false, - 303 => true, - 304 => true, - 305 => true, - 306 => true, - 307 => true, - 308 => true, - 309 => true, - 310 => true, - 311 => true, - 312 => true, - 313 => true, - 314 => true, - 315 => true, - 316 => true, - 317 => false, - 318 => true, - 319 => false, - 320 => true, - 321 => true, - 322 => true, - 323 => true, - 324 => true, - 325 => true, - 326 => true, - 327 => true, - 328 => true, - 329 => false, - 330 => false, - 331 => false, - 332 => false, - 333 => true, - 334 => true, - 335 => true, - 336 => true, - 337 => true, - 338 => true, - 339 => true, - 340 => true, - 341 => true, - 342 => true, - 343 => true, - 344 => true, - 345 => true, - 346 => true, - 347 => true, - 348 => true, - 349 => true, - 350 => true, - 351 => true, - 352 => true, - 353 => true, - 354 => true, - 355 => true, - 356 => true, - 357 => true, - 358 => true, - 359 => true, - 360 => true, - 361 => true, - 362 => true, - 363 => true, - 364 => true, - 365 => true, - 366 => true, - 400 => true, - 401 => true, - 402 => true, - 403 => true, - 4160 => true, - 4161 => true, - 4162 => true, - 4416 => false, - 4421 => true, - 4422 => true, - 4428 => true, - 4429 => true, - 4430 => true, - 4431 => true, - 4432 => true, - 4445 => false, - 4446 => false, - 4447 => true, - 4448 => false, - 4449 => false, - 4450 => true, - 4451 => true, - 4452 => true, - 4453 => true, - 4454 => true, - 4455 => true, - 4456 => true, - 4457 => true, - 4458 => false, - 4459 => true, - 4460 => true, - 4472 => true, - 4473 => false, - 4474 => false, - 4475 => false, - 4476 => false, - 4477 => true, - 4479 => true, - 4480 => true, - 4481 => true, - 4482 => true, - 4483 => true, - 5000 => true, - 5001 => true, - 5002 => true, - 5003 => true, - 5004 => true, - 5005 => true, - 5006 => true, - 5007 => true, - 5011 => true, - 5012 => true, - 5056 => true, - 5075 => false, - 5078 => true, - 5090 => false, - 5249 => false, - 5250 => false, - 5251 => false, - 5252 => true, - 5253 => true, - 5254 => true, - 5255 => true, - 5256 => false, - 5257 => true, - 5258 => true, - 5259 => false, - 5260 => false, - 5261 => false, - 5262 => false, - 5263 => false, - 5264 => false, - 5265 => true, - 5266 => false, - 5267 => true, - 5268 => true, - 5269 => true, - 5270 => true, - 5271 => true, - 5272 => true, - 5273 => true, - 5274 => true, - 5275 => true, - 5276 => true, - 5277 => true, - 5278 => true, - 5279 => false, - 5280 => false, - 5281 => true, - 5283 => true, - 5294 => false, - 5295 => false, - 5296 => true, - 5299 => false, - 5300 => true, - 5301 => true, - 5334 => true, - 5335 => false, - 5336 => false, - 5337 => false, - 5338 => false, - 5339 => false, - 5340 => true, - 5341 => true, - 5344 => false, - 5358 => true, - 5359 => true, - 5360 => false, - 5361 => true, - 5362 => true, - 5364 => false, - 5365 => false, - 5380 => false, - 5381 => true, - 5391 => true, - 5392 => true, - 5393 => true, - 5394 => true, - 5395 => true, - 5396 => true, - 5397 => false, - 5571 => true, - 5572 => true, - 5573 => true, - 5574 => true, - 5575 => true, - 5576 => false, - 5577 => true, - 5578 => false, - 5580 => true, - 5581 => false, - 5585 => true, - 5586 => true, - 5587 => true, - 5588 => true, - 5589 => true, - 5590 => true, - 5591 => true, - 5592 => true, - 5593 => true, - 5594 => true, - 5595 => true, - 5596 => true, - 5597 => true, - 5598 => true, - 5600 => true, - 5601 => true, - 5609 => true, - 5610 => true, - 5611 => true, - 5614 => true, - 5615 => true, - 5630 => false, - 5631 => true, - 5632 => false, - 5633 => false, - 5699 => true, - 5700 => true, - 5701 => true, - 5702 => true, - 5703 => true, - 5704 => true, - 5705 => true, - 5706 => true, - 5707 => true, - 5708 => true, - 5709 => true, - 5710 => true, - 5711 => true, - 5712 => true, - 5713 => true, - 5714 => true, - 5715 => true, - 5716 => true, - 5717 => true, - 5718 => true, - 5719 => true, - 5720 => true, - 5721 => true, - 5722 => true, - 5723 => true, - 5724 => true, - 5725 => true, - 5726 => true, - 5727 => true, - 5728 => true, - 5729 => true, - 5730 => true, - 5731 => true, - 5732 => true, - 5733 => true, - 5734 => true, - 5735 => true, - 5736 => true, - 5737 => true, - 5738 => true, - 5739 => true, - 5740 => true, - 5741 => true, - 5742 => true, - 5743 => true, - 5744 => true, - 5745 => true, - 5746 => true, - 5747 => true, - 5748 => true, - 5749 => true, - 5750 => true, - 5751 => true, - 5752 => true, - 5753 => true, - 5754 => true, - 5755 => true, - 5756 => true, - 5757 => true, - 5758 => true, - 5759 => true, - 5760 => true, - 5761 => true, - 5762 => true, - 5763 => true, - 5764 => true, - 5765 => true, - 5766 => true, - 5767 => true, - 5768 => true, - 5769 => true, - 5770 => true, - 5771 => true, - 5772 => true, - 5773 => true, - 5774 => true, - 5775 => true, - 5776 => true, - 5777 => true, - 5778 => true, - 5779 => true, - 5780 => true, - 5781 => true, - 5782 => true, - 5783 => true, - 5784 => true, - 5785 => true, - 5786 => true, - 5787 => true, - 5788 => true, - 5789 => true, - 5790 => true, - 5791 => true, - 5792 => true, - 5793 => true, - 5794 => true, - 5795 => true, - 5796 => true, - 5797 => true, - 5798 => true, - 5799 => true, - 5800 => true, - 5801 => true, - 5802 => true, - 5803 => true, - 5804 => true, - 5805 => true, - 5806 => true, - 5807 => true, - 5808 => true, - 5809 => true, - 5810 => true, - 5811 => true, - 5812 => true, - 5813 => true, - 5814 => true, - 5815 => true, - 5816 => true, - 5818 => true, - 5819 => true, - 5820 => false, - 5840 => true, - 5841 => true, - 5842 => true, - 5843 => true, - 5846 => true, - 5847 => true, - 5848 => true, - 5849 => true, - 5850 => true, - 5851 => true, - 5852 => true, - 5853 => true, - 5854 => true, - 5855 => true, - 5856 => true, - 5857 => true, - 5858 => true, - 5859 => true, - 5860 => true, - 5861 => true, - 5862 => true, - 5863 => true, - 5864 => true, - 5865 => true, - 5866 => true, - 5867 => true, - 5868 => true, - 5869 => true, - 5870 => true, - 5871 => true, - 5872 => true, - 5873 => true, - 5874 => true, - 5875 => true, - 5876 => true, - 5877 => true, - 5878 => true, - 5879 => true, - 5880 => true, - 5881 => true, - 5882 => true, - 5887 => false, - 5911 => true, - 5912 => true, - 5913 => true, - 5923 => true, - 5924 => true, - 5925 => true, - 5926 => true, - 5927 => true, - 5928 => true, - 5929 => true, - 5930 => true, - 5931 => true, - 5932 => true, - 5933 => true, - 5934 => true, - 5938 => true, - 5946 => true, - 5947 => true, - 5949 => true, - 6016 => true, - 6017 => true, - 6018 => true, - 6019 => true, - 6020 => true, - 6021 => true, - 6022 => true, - 6023 => true, - 6024 => true, - 6025 => true, - 6026 => true, - 6027 => true, - 6028 => true, - 6029 => true, - 6030 => true, - 6031 => true, - 6032 => true, - 6035 => true, - 6086 => true, - 6090 => false, - 6091 => false, - 6092 => false, - 6096 => true, - 6116 => true, - 6117 => true, - 6142 => false, - 6143 => false, - 6401 => true, - 6402 => true, - 6403 => true, - 6404 => true, - 6405 => true, - 6406 => true, - 6407 => true, - 6408 => true, - _ => bail!("Unknown opcode: {}", opcode), - }; - Ok(out) -} diff --git a/spirq-spvasm/src/generated/op_has_result_type_id.rs b/spirq-spvasm/src/generated/op_has_result_type_id.rs deleted file mode 100644 index fa5d35b..0000000 --- a/spirq-spvasm/src/generated/op_has_result_type_id.rs +++ /dev/null @@ -1,721 +0,0 @@ -use anyhow::{bail, Result}; - -pub fn op_has_result_type_id(opcode: u32) -> Result { - let out: bool = match opcode { - 0 => false, - 1 => true, - 2 => false, - 3 => false, - 4 => false, - 5 => false, - 6 => false, - 7 => false, - 8 => false, - 10 => false, - 11 => false, - 12 => true, - 14 => false, - 15 => false, - 16 => false, - 17 => false, - 19 => false, - 20 => false, - 21 => false, - 22 => false, - 23 => false, - 24 => false, - 25 => false, - 26 => false, - 27 => false, - 28 => false, - 29 => false, - 30 => false, - 31 => false, - 32 => false, - 33 => false, - 34 => false, - 35 => false, - 36 => false, - 37 => false, - 38 => false, - 39 => false, - 41 => true, - 42 => true, - 43 => true, - 44 => true, - 45 => true, - 46 => true, - 48 => true, - 49 => true, - 50 => true, - 51 => true, - 52 => true, - 54 => true, - 55 => true, - 56 => false, - 57 => true, - 59 => true, - 60 => true, - 61 => true, - 62 => false, - 63 => false, - 64 => false, - 65 => true, - 66 => true, - 67 => true, - 68 => true, - 69 => true, - 70 => true, - 71 => false, - 72 => false, - 73 => false, - 74 => false, - 75 => false, - 77 => true, - 78 => true, - 79 => true, - 80 => true, - 81 => true, - 82 => true, - 83 => true, - 84 => true, - 86 => true, - 87 => true, - 88 => true, - 89 => true, - 90 => true, - 91 => true, - 92 => true, - 93 => true, - 94 => true, - 95 => true, - 96 => true, - 97 => true, - 98 => true, - 99 => false, - 100 => true, - 101 => true, - 102 => true, - 103 => true, - 104 => true, - 105 => true, - 106 => true, - 107 => true, - 109 => true, - 110 => true, - 111 => true, - 112 => true, - 113 => true, - 114 => true, - 115 => true, - 116 => true, - 117 => true, - 118 => true, - 119 => true, - 120 => true, - 121 => true, - 122 => true, - 123 => true, - 124 => true, - 126 => true, - 127 => true, - 128 => true, - 129 => true, - 130 => true, - 131 => true, - 132 => true, - 133 => true, - 134 => true, - 135 => true, - 136 => true, - 137 => true, - 138 => true, - 139 => true, - 140 => true, - 141 => true, - 142 => true, - 143 => true, - 144 => true, - 145 => true, - 146 => true, - 147 => true, - 148 => true, - 149 => true, - 150 => true, - 151 => true, - 152 => true, - 154 => true, - 155 => true, - 156 => true, - 157 => true, - 158 => true, - 159 => true, - 160 => true, - 161 => true, - 162 => true, - 163 => true, - 164 => true, - 165 => true, - 166 => true, - 167 => true, - 168 => true, - 169 => true, - 170 => true, - 171 => true, - 172 => true, - 173 => true, - 174 => true, - 175 => true, - 176 => true, - 177 => true, - 178 => true, - 179 => true, - 180 => true, - 181 => true, - 182 => true, - 183 => true, - 184 => true, - 185 => true, - 186 => true, - 187 => true, - 188 => true, - 189 => true, - 190 => true, - 191 => true, - 194 => true, - 195 => true, - 196 => true, - 197 => true, - 198 => true, - 199 => true, - 200 => true, - 201 => true, - 202 => true, - 203 => true, - 204 => true, - 205 => true, - 207 => true, - 208 => true, - 209 => true, - 210 => true, - 211 => true, - 212 => true, - 213 => true, - 214 => true, - 215 => true, - 218 => false, - 219 => false, - 220 => false, - 221 => false, - 224 => false, - 225 => false, - 227 => true, - 228 => false, - 229 => true, - 230 => true, - 231 => true, - 232 => true, - 233 => true, - 234 => true, - 235 => true, - 236 => true, - 237 => true, - 238 => true, - 239 => true, - 240 => true, - 241 => true, - 242 => true, - 245 => true, - 246 => false, - 247 => false, - 248 => false, - 249 => false, - 250 => false, - 251 => false, - 252 => false, - 253 => false, - 254 => false, - 255 => false, - 256 => false, - 257 => false, - 259 => true, - 260 => false, - 261 => true, - 262 => true, - 263 => true, - 264 => true, - 265 => true, - 266 => true, - 267 => true, - 268 => true, - 269 => true, - 270 => true, - 271 => true, - 274 => true, - 275 => true, - 276 => true, - 277 => true, - 278 => true, - 279 => true, - 280 => false, - 281 => false, - 282 => true, - 283 => true, - 284 => true, - 285 => true, - 286 => true, - 287 => false, - 288 => false, - 291 => true, - 292 => true, - 293 => true, - 294 => true, - 295 => true, - 296 => true, - 297 => false, - 298 => false, - 299 => true, - 300 => true, - 301 => false, - 302 => false, - 303 => true, - 304 => true, - 305 => true, - 306 => true, - 307 => true, - 308 => true, - 309 => true, - 310 => true, - 311 => true, - 312 => true, - 313 => true, - 314 => true, - 315 => true, - 316 => true, - 317 => false, - 318 => true, - 319 => false, - 320 => true, - 321 => true, - 322 => false, - 323 => true, - 324 => true, - 325 => true, - 326 => true, - 327 => false, - 328 => true, - 329 => false, - 330 => false, - 331 => false, - 332 => false, - 333 => true, - 334 => true, - 335 => true, - 336 => true, - 337 => true, - 338 => true, - 339 => true, - 340 => true, - 341 => true, - 342 => true, - 343 => true, - 344 => true, - 345 => true, - 346 => true, - 347 => true, - 348 => true, - 349 => true, - 350 => true, - 351 => true, - 352 => true, - 353 => true, - 354 => true, - 355 => true, - 356 => true, - 357 => true, - 358 => true, - 359 => true, - 360 => true, - 361 => true, - 362 => true, - 363 => true, - 364 => true, - 365 => true, - 366 => true, - 400 => true, - 401 => true, - 402 => true, - 403 => true, - 4160 => true, - 4161 => true, - 4162 => true, - 4416 => false, - 4421 => true, - 4422 => true, - 4428 => true, - 4429 => true, - 4430 => true, - 4431 => true, - 4432 => true, - 4445 => false, - 4446 => false, - 4447 => true, - 4448 => false, - 4449 => false, - 4450 => true, - 4451 => true, - 4452 => true, - 4453 => true, - 4454 => true, - 4455 => true, - 4456 => false, - 4457 => true, - 4458 => false, - 4459 => true, - 4460 => true, - 4472 => false, - 4473 => false, - 4474 => false, - 4475 => false, - 4476 => false, - 4477 => true, - 4479 => true, - 4480 => true, - 4481 => true, - 4482 => true, - 4483 => true, - 5000 => true, - 5001 => true, - 5002 => true, - 5003 => true, - 5004 => true, - 5005 => true, - 5006 => true, - 5007 => true, - 5011 => true, - 5012 => true, - 5056 => true, - 5075 => false, - 5078 => true, - 5090 => false, - 5249 => false, - 5250 => false, - 5251 => false, - 5252 => true, - 5253 => true, - 5254 => true, - 5255 => true, - 5256 => false, - 5257 => true, - 5258 => true, - 5259 => false, - 5260 => false, - 5261 => false, - 5262 => false, - 5263 => false, - 5264 => false, - 5265 => true, - 5266 => false, - 5267 => true, - 5268 => true, - 5269 => true, - 5270 => true, - 5271 => true, - 5272 => true, - 5273 => true, - 5274 => true, - 5275 => true, - 5276 => true, - 5277 => true, - 5278 => true, - 5279 => false, - 5280 => false, - 5281 => false, - 5283 => true, - 5294 => false, - 5295 => false, - 5296 => true, - 5299 => false, - 5300 => true, - 5301 => true, - 5334 => true, - 5335 => false, - 5336 => false, - 5337 => false, - 5338 => false, - 5339 => false, - 5340 => true, - 5341 => false, - 5344 => false, - 5358 => false, - 5359 => true, - 5360 => false, - 5361 => true, - 5362 => true, - 5364 => false, - 5365 => false, - 5380 => false, - 5381 => true, - 5391 => true, - 5392 => true, - 5393 => true, - 5394 => true, - 5395 => true, - 5396 => true, - 5397 => false, - 5571 => true, - 5572 => true, - 5573 => true, - 5574 => true, - 5575 => true, - 5576 => false, - 5577 => true, - 5578 => false, - 5580 => true, - 5581 => false, - 5585 => true, - 5586 => true, - 5587 => true, - 5588 => true, - 5589 => true, - 5590 => true, - 5591 => true, - 5592 => true, - 5593 => true, - 5594 => true, - 5595 => true, - 5596 => true, - 5597 => true, - 5598 => true, - 5600 => true, - 5601 => true, - 5609 => true, - 5610 => true, - 5611 => true, - 5614 => true, - 5615 => true, - 5630 => false, - 5631 => true, - 5632 => false, - 5633 => false, - 5699 => true, - 5700 => false, - 5701 => false, - 5702 => false, - 5703 => false, - 5704 => false, - 5705 => false, - 5706 => false, - 5707 => false, - 5708 => false, - 5709 => false, - 5710 => false, - 5711 => false, - 5712 => false, - 5713 => true, - 5714 => true, - 5715 => true, - 5716 => true, - 5717 => true, - 5718 => true, - 5719 => true, - 5720 => true, - 5721 => true, - 5722 => true, - 5723 => true, - 5724 => true, - 5725 => true, - 5726 => true, - 5727 => true, - 5728 => true, - 5729 => true, - 5730 => true, - 5731 => true, - 5732 => true, - 5733 => true, - 5734 => true, - 5735 => true, - 5736 => true, - 5737 => true, - 5738 => true, - 5739 => true, - 5740 => true, - 5741 => true, - 5742 => true, - 5743 => true, - 5744 => true, - 5745 => true, - 5746 => true, - 5747 => true, - 5748 => true, - 5749 => true, - 5750 => true, - 5751 => true, - 5752 => true, - 5753 => true, - 5754 => true, - 5755 => true, - 5756 => true, - 5757 => true, - 5758 => true, - 5759 => true, - 5760 => true, - 5761 => true, - 5762 => true, - 5763 => true, - 5764 => true, - 5765 => true, - 5766 => true, - 5767 => true, - 5768 => true, - 5769 => true, - 5770 => true, - 5771 => true, - 5772 => true, - 5773 => true, - 5774 => true, - 5775 => true, - 5776 => true, - 5777 => true, - 5778 => true, - 5779 => true, - 5780 => true, - 5781 => true, - 5782 => true, - 5783 => true, - 5784 => true, - 5785 => true, - 5786 => true, - 5787 => true, - 5788 => true, - 5789 => true, - 5790 => true, - 5791 => true, - 5792 => true, - 5793 => true, - 5794 => true, - 5795 => true, - 5796 => true, - 5797 => true, - 5798 => true, - 5799 => true, - 5800 => true, - 5801 => true, - 5802 => true, - 5803 => true, - 5804 => true, - 5805 => true, - 5806 => true, - 5807 => true, - 5808 => true, - 5809 => true, - 5810 => true, - 5811 => true, - 5812 => true, - 5813 => true, - 5814 => true, - 5815 => true, - 5816 => true, - 5818 => true, - 5819 => true, - 5820 => false, - 5840 => true, - 5841 => true, - 5842 => true, - 5843 => true, - 5846 => true, - 5847 => true, - 5848 => true, - 5849 => true, - 5850 => true, - 5851 => true, - 5852 => true, - 5853 => true, - 5854 => true, - 5855 => true, - 5856 => true, - 5857 => true, - 5858 => true, - 5859 => true, - 5860 => true, - 5861 => true, - 5862 => true, - 5863 => true, - 5864 => true, - 5865 => true, - 5866 => true, - 5867 => true, - 5868 => true, - 5869 => true, - 5870 => true, - 5871 => true, - 5872 => true, - 5873 => true, - 5874 => true, - 5875 => true, - 5876 => true, - 5877 => true, - 5878 => true, - 5879 => true, - 5880 => true, - 5881 => true, - 5882 => true, - 5887 => false, - 5911 => false, - 5912 => false, - 5913 => false, - 5923 => true, - 5924 => true, - 5925 => true, - 5926 => true, - 5927 => true, - 5928 => true, - 5929 => true, - 5930 => true, - 5931 => true, - 5932 => true, - 5933 => true, - 5934 => true, - 5938 => true, - 5946 => true, - 5947 => true, - 5949 => true, - 6016 => true, - 6017 => true, - 6018 => true, - 6019 => true, - 6020 => true, - 6021 => true, - 6022 => true, - 6023 => true, - 6024 => true, - 6025 => true, - 6026 => true, - 6027 => true, - 6028 => true, - 6029 => true, - 6030 => true, - 6031 => true, - 6032 => true, - 6035 => true, - 6086 => false, - 6090 => false, - 6091 => false, - 6092 => false, - 6096 => true, - 6116 => true, - 6117 => true, - 6142 => false, - 6143 => false, - 6401 => true, - 6402 => true, - 6403 => true, - 6404 => true, - 6405 => true, - 6406 => true, - 6407 => true, - 6408 => true, - _ => bail!("Unknown opcode: {}", opcode), - }; - Ok(out) -} diff --git a/spirq-spvasm/src/generated/op_to_str.rs b/spirq-spvasm/src/generated/op_to_str.rs deleted file mode 100644 index 5f7d9b2..0000000 --- a/spirq-spvasm/src/generated/op_to_str.rs +++ /dev/null @@ -1,692 +0,0 @@ -#![allow(unreachable_patterns)] -use anyhow::{bail, Result}; - -pub fn op_to_str(opcode: u32) -> Result<&'static str> { - let out: &'static str = match opcode { - 0 => "OpNop", - 1 => "OpUndef", - 2 => "OpSourceContinued", - 3 => "OpSource", - 4 => "OpSourceExtension", - 5 => "OpName", - 6 => "OpMemberName", - 7 => "OpString", - 8 => "OpLine", - 10 => "OpExtension", - 11 => "OpExtInstImport", - 12 => "OpExtInst", - 14 => "OpMemoryModel", - 15 => "OpEntryPoint", - 16 => "OpExecutionMode", - 17 => "OpCapability", - 19 => "OpTypeVoid", - 20 => "OpTypeBool", - 21 => "OpTypeInt", - 22 => "OpTypeFloat", - 23 => "OpTypeVector", - 24 => "OpTypeMatrix", - 25 => "OpTypeImage", - 26 => "OpTypeSampler", - 27 => "OpTypeSampledImage", - 28 => "OpTypeArray", - 29 => "OpTypeRuntimeArray", - 30 => "OpTypeStruct", - 31 => "OpTypeOpaque", - 32 => "OpTypePointer", - 33 => "OpTypeFunction", - 34 => "OpTypeEvent", - 35 => "OpTypeDeviceEvent", - 36 => "OpTypeReserveId", - 37 => "OpTypeQueue", - 38 => "OpTypePipe", - 39 => "OpTypeForwardPointer", - 41 => "OpConstantTrue", - 42 => "OpConstantFalse", - 43 => "OpConstant", - 44 => "OpConstantComposite", - 45 => "OpConstantSampler", - 46 => "OpConstantNull", - 48 => "OpSpecConstantTrue", - 49 => "OpSpecConstantFalse", - 50 => "OpSpecConstant", - 51 => "OpSpecConstantComposite", - 52 => "OpSpecConstantOp", - 54 => "OpFunction", - 55 => "OpFunctionParameter", - 56 => "OpFunctionEnd", - 57 => "OpFunctionCall", - 59 => "OpVariable", - 60 => "OpImageTexelPointer", - 61 => "OpLoad", - 62 => "OpStore", - 63 => "OpCopyMemory", - 64 => "OpCopyMemorySized", - 65 => "OpAccessChain", - 66 => "OpInBoundsAccessChain", - 67 => "OpPtrAccessChain", - 68 => "OpArrayLength", - 69 => "OpGenericPtrMemSemantics", - 70 => "OpInBoundsPtrAccessChain", - 71 => "OpDecorate", - 72 => "OpMemberDecorate", - 73 => "OpDecorationGroup", - 74 => "OpGroupDecorate", - 75 => "OpGroupMemberDecorate", - 77 => "OpVectorExtractDynamic", - 78 => "OpVectorInsertDynamic", - 79 => "OpVectorShuffle", - 80 => "OpCompositeConstruct", - 81 => "OpCompositeExtract", - 82 => "OpCompositeInsert", - 83 => "OpCopyObject", - 84 => "OpTranspose", - 86 => "OpSampledImage", - 87 => "OpImageSampleImplicitLod", - 88 => "OpImageSampleExplicitLod", - 89 => "OpImageSampleDrefImplicitLod", - 90 => "OpImageSampleDrefExplicitLod", - 91 => "OpImageSampleProjImplicitLod", - 92 => "OpImageSampleProjExplicitLod", - 93 => "OpImageSampleProjDrefImplicitLod", - 94 => "OpImageSampleProjDrefExplicitLod", - 95 => "OpImageFetch", - 96 => "OpImageGather", - 97 => "OpImageDrefGather", - 98 => "OpImageRead", - 99 => "OpImageWrite", - 100 => "OpImage", - 101 => "OpImageQueryFormat", - 102 => "OpImageQueryOrder", - 103 => "OpImageQuerySizeLod", - 104 => "OpImageQuerySize", - 105 => "OpImageQueryLod", - 106 => "OpImageQueryLevels", - 107 => "OpImageQuerySamples", - 109 => "OpConvertFToU", - 110 => "OpConvertFToS", - 111 => "OpConvertSToF", - 112 => "OpConvertUToF", - 113 => "OpUConvert", - 114 => "OpSConvert", - 115 => "OpFConvert", - 116 => "OpQuantizeToF16", - 117 => "OpConvertPtrToU", - 118 => "OpSatConvertSToU", - 119 => "OpSatConvertUToS", - 120 => "OpConvertUToPtr", - 121 => "OpPtrCastToGeneric", - 122 => "OpGenericCastToPtr", - 123 => "OpGenericCastToPtrExplicit", - 124 => "OpBitcast", - 126 => "OpSNegate", - 127 => "OpFNegate", - 128 => "OpIAdd", - 129 => "OpFAdd", - 130 => "OpISub", - 131 => "OpFSub", - 132 => "OpIMul", - 133 => "OpFMul", - 134 => "OpUDiv", - 135 => "OpSDiv", - 136 => "OpFDiv", - 137 => "OpUMod", - 138 => "OpSRem", - 139 => "OpSMod", - 140 => "OpFRem", - 141 => "OpFMod", - 142 => "OpVectorTimesScalar", - 143 => "OpMatrixTimesScalar", - 144 => "OpVectorTimesMatrix", - 145 => "OpMatrixTimesVector", - 146 => "OpMatrixTimesMatrix", - 147 => "OpOuterProduct", - 148 => "OpDot", - 149 => "OpIAddCarry", - 150 => "OpISubBorrow", - 151 => "OpUMulExtended", - 152 => "OpSMulExtended", - 154 => "OpAny", - 155 => "OpAll", - 156 => "OpIsNan", - 157 => "OpIsInf", - 158 => "OpIsFinite", - 159 => "OpIsNormal", - 160 => "OpSignBitSet", - 161 => "OpLessOrGreater", - 162 => "OpOrdered", - 163 => "OpUnordered", - 164 => "OpLogicalEqual", - 165 => "OpLogicalNotEqual", - 166 => "OpLogicalOr", - 167 => "OpLogicalAnd", - 168 => "OpLogicalNot", - 169 => "OpSelect", - 170 => "OpIEqual", - 171 => "OpINotEqual", - 172 => "OpUGreaterThan", - 173 => "OpSGreaterThan", - 174 => "OpUGreaterThanEqual", - 175 => "OpSGreaterThanEqual", - 176 => "OpULessThan", - 177 => "OpSLessThan", - 178 => "OpULessThanEqual", - 179 => "OpSLessThanEqual", - 180 => "OpFOrdEqual", - 181 => "OpFUnordEqual", - 182 => "OpFOrdNotEqual", - 183 => "OpFUnordNotEqual", - 184 => "OpFOrdLessThan", - 185 => "OpFUnordLessThan", - 186 => "OpFOrdGreaterThan", - 187 => "OpFUnordGreaterThan", - 188 => "OpFOrdLessThanEqual", - 189 => "OpFUnordLessThanEqual", - 190 => "OpFOrdGreaterThanEqual", - 191 => "OpFUnordGreaterThanEqual", - 194 => "OpShiftRightLogical", - 195 => "OpShiftRightArithmetic", - 196 => "OpShiftLeftLogical", - 197 => "OpBitwiseOr", - 198 => "OpBitwiseXor", - 199 => "OpBitwiseAnd", - 200 => "OpNot", - 201 => "OpBitFieldInsert", - 202 => "OpBitFieldSExtract", - 203 => "OpBitFieldUExtract", - 204 => "OpBitReverse", - 205 => "OpBitCount", - 207 => "OpDPdx", - 208 => "OpDPdy", - 209 => "OpFwidth", - 210 => "OpDPdxFine", - 211 => "OpDPdyFine", - 212 => "OpFwidthFine", - 213 => "OpDPdxCoarse", - 214 => "OpDPdyCoarse", - 215 => "OpFwidthCoarse", - 218 => "OpEmitVertex", - 219 => "OpEndPrimitive", - 220 => "OpEmitStreamVertex", - 221 => "OpEndStreamPrimitive", - 224 => "OpControlBarrier", - 225 => "OpMemoryBarrier", - 227 => "OpAtomicLoad", - 228 => "OpAtomicStore", - 229 => "OpAtomicExchange", - 230 => "OpAtomicCompareExchange", - 231 => "OpAtomicCompareExchangeWeak", - 232 => "OpAtomicIIncrement", - 233 => "OpAtomicIDecrement", - 234 => "OpAtomicIAdd", - 235 => "OpAtomicISub", - 236 => "OpAtomicSMin", - 237 => "OpAtomicUMin", - 238 => "OpAtomicSMax", - 239 => "OpAtomicUMax", - 240 => "OpAtomicAnd", - 241 => "OpAtomicOr", - 242 => "OpAtomicXor", - 245 => "OpPhi", - 246 => "OpLoopMerge", - 247 => "OpSelectionMerge", - 248 => "OpLabel", - 249 => "OpBranch", - 250 => "OpBranchConditional", - 251 => "OpSwitch", - 252 => "OpKill", - 253 => "OpReturn", - 254 => "OpReturnValue", - 255 => "OpUnreachable", - 256 => "OpLifetimeStart", - 257 => "OpLifetimeStop", - 259 => "OpGroupAsyncCopy", - 260 => "OpGroupWaitEvents", - 261 => "OpGroupAll", - 262 => "OpGroupAny", - 263 => "OpGroupBroadcast", - 264 => "OpGroupIAdd", - 265 => "OpGroupFAdd", - 266 => "OpGroupFMin", - 267 => "OpGroupUMin", - 268 => "OpGroupSMin", - 269 => "OpGroupFMax", - 270 => "OpGroupUMax", - 271 => "OpGroupSMax", - 274 => "OpReadPipe", - 275 => "OpWritePipe", - 276 => "OpReservedReadPipe", - 277 => "OpReservedWritePipe", - 278 => "OpReserveReadPipePackets", - 279 => "OpReserveWritePipePackets", - 280 => "OpCommitReadPipe", - 281 => "OpCommitWritePipe", - 282 => "OpIsValidReserveId", - 283 => "OpGetNumPipePackets", - 284 => "OpGetMaxPipePackets", - 285 => "OpGroupReserveReadPipePackets", - 286 => "OpGroupReserveWritePipePackets", - 287 => "OpGroupCommitReadPipe", - 288 => "OpGroupCommitWritePipe", - 291 => "OpEnqueueMarker", - 292 => "OpEnqueueKernel", - 293 => "OpGetKernelNDrangeSubGroupCount", - 294 => "OpGetKernelNDrangeMaxSubGroupSize", - 295 => "OpGetKernelWorkGroupSize", - 296 => "OpGetKernelPreferredWorkGroupSizeMultiple", - 297 => "OpRetainEvent", - 298 => "OpReleaseEvent", - 299 => "OpCreateUserEvent", - 300 => "OpIsValidEvent", - 301 => "OpSetUserEventStatus", - 302 => "OpCaptureEventProfilingInfo", - 303 => "OpGetDefaultQueue", - 304 => "OpBuildNDRange", - 305 => "OpImageSparseSampleImplicitLod", - 306 => "OpImageSparseSampleExplicitLod", - 307 => "OpImageSparseSampleDrefImplicitLod", - 308 => "OpImageSparseSampleDrefExplicitLod", - 309 => "OpImageSparseSampleProjImplicitLod", - 310 => "OpImageSparseSampleProjExplicitLod", - 311 => "OpImageSparseSampleProjDrefImplicitLod", - 312 => "OpImageSparseSampleProjDrefExplicitLod", - 313 => "OpImageSparseFetch", - 314 => "OpImageSparseGather", - 315 => "OpImageSparseDrefGather", - 316 => "OpImageSparseTexelsResident", - 317 => "OpNoLine", - 318 => "OpAtomicFlagTestAndSet", - 319 => "OpAtomicFlagClear", - 320 => "OpImageSparseRead", - 321 => "OpSizeOf", - 322 => "OpTypePipeStorage", - 323 => "OpConstantPipeStorage", - 324 => "OpCreatePipeFromPipeStorage", - 325 => "OpGetKernelLocalSizeForSubgroupCount", - 326 => "OpGetKernelMaxNumSubgroups", - 327 => "OpTypeNamedBarrier", - 328 => "OpNamedBarrierInitialize", - 329 => "OpMemoryNamedBarrier", - 330 => "OpModuleProcessed", - 331 => "OpExecutionModeId", - 333 => "OpGroupNonUniformElect", - 334 => "OpGroupNonUniformAll", - 335 => "OpGroupNonUniformAny", - 336 => "OpGroupNonUniformAllEqual", - 337 => "OpGroupNonUniformBroadcast", - 338 => "OpGroupNonUniformBroadcastFirst", - 339 => "OpGroupNonUniformBallot", - 340 => "OpGroupNonUniformInverseBallot", - 341 => "OpGroupNonUniformBallotBitExtract", - 342 => "OpGroupNonUniformBallotBitCount", - 343 => "OpGroupNonUniformBallotFindLSB", - 344 => "OpGroupNonUniformBallotFindMSB", - 345 => "OpGroupNonUniformShuffle", - 346 => "OpGroupNonUniformShuffleXor", - 347 => "OpGroupNonUniformShuffleUp", - 348 => "OpGroupNonUniformShuffleDown", - 349 => "OpGroupNonUniformIAdd", - 350 => "OpGroupNonUniformFAdd", - 351 => "OpGroupNonUniformIMul", - 352 => "OpGroupNonUniformFMul", - 353 => "OpGroupNonUniformSMin", - 354 => "OpGroupNonUniformUMin", - 355 => "OpGroupNonUniformFMin", - 356 => "OpGroupNonUniformSMax", - 357 => "OpGroupNonUniformUMax", - 358 => "OpGroupNonUniformFMax", - 359 => "OpGroupNonUniformBitwiseAnd", - 360 => "OpGroupNonUniformBitwiseOr", - 361 => "OpGroupNonUniformBitwiseXor", - 362 => "OpGroupNonUniformLogicalAnd", - 363 => "OpGroupNonUniformLogicalOr", - 364 => "OpGroupNonUniformLogicalXor", - 365 => "OpGroupNonUniformQuadBroadcast", - 366 => "OpGroupNonUniformQuadSwap", - 400 => "OpCopyLogical", - 401 => "OpPtrEqual", - 402 => "OpPtrNotEqual", - 403 => "OpPtrDiff", - 4160 => "OpColorAttachmentReadEXT", - 4161 => "OpDepthAttachmentReadEXT", - 4162 => "OpStencilAttachmentReadEXT", - 4421 => "OpSubgroupBallotKHR", - 4422 => "OpSubgroupFirstInvocationKHR", - 4428 => "OpSubgroupAllKHR", - 4429 => "OpSubgroupAnyKHR", - 4430 => "OpSubgroupAllEqualKHR", - 4431 => "OpGroupNonUniformRotateKHR", - 4432 => "OpSubgroupReadInvocationKHR", - 4445 => "OpTraceRayKHR", - 4446 => "OpExecuteCallableKHR", - 4447 => "OpConvertUToAccelerationStructureKHR", - 4448 => "OpIgnoreIntersectionKHR", - 4449 => "OpTerminateRayKHR", - 4450 => "OpSDot", - 4450 => "OpSDotKHR", - 4451 => "OpUDot", - 4451 => "OpUDotKHR", - 4452 => "OpSUDot", - 4452 => "OpSUDotKHR", - 4453 => "OpSDotAccSat", - 4453 => "OpSDotAccSatKHR", - 4454 => "OpUDotAccSat", - 4454 => "OpUDotAccSatKHR", - 4455 => "OpSUDotAccSat", - 4455 => "OpSUDotAccSatKHR", - 4456 => "OpTypeCooperativeMatrixKHR", - 4457 => "OpCooperativeMatrixLoadKHR", - 4458 => "OpCooperativeMatrixStoreKHR", - 4459 => "OpCooperativeMatrixMulAddKHR", - 4460 => "OpCooperativeMatrixLengthKHR", - 4472 => "OpTypeRayQueryKHR", - 4473 => "OpRayQueryInitializeKHR", - 4474 => "OpRayQueryTerminateKHR", - 4475 => "OpRayQueryGenerateIntersectionKHR", - 4476 => "OpRayQueryConfirmIntersectionKHR", - 4477 => "OpRayQueryProceedKHR", - 4479 => "OpRayQueryGetIntersectionTypeKHR", - 4480 => "OpImageSampleWeightedQCOM", - 4481 => "OpImageBoxFilterQCOM", - 4482 => "OpImageBlockMatchSSDQCOM", - 4483 => "OpImageBlockMatchSADQCOM", - 5056 => "OpReadClockKHR", - 5075 => "OpFinalizeNodePayloadsAMDX", - 5078 => "OpFinishWritingNodePayloadAMDX", - 5090 => "OpInitializeNodePayloadsAMDX", - 5249 => "OpHitObjectRecordHitMotionNV", - 5250 => "OpHitObjectRecordHitWithIndexMotionNV", - 5251 => "OpHitObjectRecordMissMotionNV", - 5252 => "OpHitObjectGetWorldToObjectNV", - 5253 => "OpHitObjectGetObjectToWorldNV", - 5254 => "OpHitObjectGetObjectRayDirectionNV", - 5255 => "OpHitObjectGetObjectRayOriginNV", - 5256 => "OpHitObjectTraceRayMotionNV", - 5257 => "OpHitObjectGetShaderRecordBufferHandleNV", - 5258 => "OpHitObjectGetShaderBindingTableRecordIndexNV", - 5259 => "OpHitObjectRecordEmptyNV", - 5260 => "OpHitObjectTraceRayNV", - 5261 => "OpHitObjectRecordHitNV", - 5262 => "OpHitObjectRecordHitWithIndexNV", - 5263 => "OpHitObjectRecordMissNV", - 5264 => "OpHitObjectExecuteShaderNV", - 5265 => "OpHitObjectGetCurrentTimeNV", - 5266 => "OpHitObjectGetAttributesNV", - 5267 => "OpHitObjectGetHitKindNV", - 5268 => "OpHitObjectGetPrimitiveIndexNV", - 5269 => "OpHitObjectGetGeometryIndexNV", - 5270 => "OpHitObjectGetInstanceIdNV", - 5271 => "OpHitObjectGetInstanceCustomIndexNV", - 5272 => "OpHitObjectGetWorldRayDirectionNV", - 5273 => "OpHitObjectGetWorldRayOriginNV", - 5274 => "OpHitObjectGetRayTMaxNV", - 5275 => "OpHitObjectGetRayTMinNV", - 5276 => "OpHitObjectIsEmptyNV", - 5277 => "OpHitObjectIsHitNV", - 5278 => "OpHitObjectIsMissNV", - 5279 => "OpReorderThreadWithHitObjectNV", - 5280 => "OpReorderThreadWithHintNV", - 5281 => "OpTypeHitObjectNV", - 5294 => "OpEmitMeshTasksEXT", - 5295 => "OpSetMeshOutputsEXT", - 5300 => "OpFetchMicroTriangleVertexPositionNV", - 5301 => "OpFetchMicroTriangleVertexBarycentricNV", - 5334 => "OpReportIntersectionKHR", - 5340 => "OpRayQueryGetIntersectionTriangleVertexPositionsKHR", - 5341 => "OpTypeAccelerationStructureKHR", - 5364 => "OpBeginInvocationInterlockEXT", - 5365 => "OpEndInvocationInterlockEXT", - 5380 => "OpDemoteToHelperInvocation", - 5380 => "OpDemoteToHelperInvocationEXT", - 5381 => "OpIsHelperInvocationEXT", - 5391 => "OpConvertUToImageNV", - 5392 => "OpConvertUToSamplerNV", - 5393 => "OpConvertImageToUNV", - 5394 => "OpConvertSamplerToUNV", - 5395 => "OpConvertUToSampledImageNV", - 5396 => "OpConvertSampledImageToUNV", - 5397 => "OpSamplerImageAddressingModeNV", - 5571 => "OpSubgroupShuffleINTEL", - 5572 => "OpSubgroupShuffleDownINTEL", - 5573 => "OpSubgroupShuffleUpINTEL", - 5574 => "OpSubgroupShuffleXorINTEL", - 5575 => "OpSubgroupBlockReadINTEL", - 5576 => "OpSubgroupBlockWriteINTEL", - 5577 => "OpSubgroupImageBlockReadINTEL", - 5578 => "OpSubgroupImageBlockWriteINTEL", - 5580 => "OpSubgroupImageMediaBlockReadINTEL", - 5581 => "OpSubgroupImageMediaBlockWriteINTEL", - 5585 => "OpUCountLeadingZerosINTEL", - 5586 => "OpUCountTrailingZerosINTEL", - 5587 => "OpAbsISubINTEL", - 5588 => "OpAbsUSubINTEL", - 5589 => "OpIAddSatINTEL", - 5590 => "OpUAddSatINTEL", - 5591 => "OpIAverageINTEL", - 5592 => "OpUAverageINTEL", - 5593 => "OpIAverageRoundedINTEL", - 5594 => "OpUAverageRoundedINTEL", - 5595 => "OpISubSatINTEL", - 5596 => "OpUSubSatINTEL", - 5597 => "OpIMul32x16INTEL", - 5598 => "OpUMul32x16INTEL", - 5609 => "OpAsmTargetINTEL", - 5610 => "OpAsmINTEL", - 5611 => "OpAsmCallINTEL", - 5614 => "OpAtomicFMinEXT", - 5615 => "OpAtomicFMaxEXT", - 5630 => "OpAssumeTrueKHR", - 5631 => "OpExpectKHR", - 5699 => "OpVmeImageINTEL", - 5700 => "OpTypeVmeImageINTEL", - 5701 => "OpTypeAvcImePayloadINTEL", - 5702 => "OpTypeAvcRefPayloadINTEL", - 5703 => "OpTypeAvcSicPayloadINTEL", - 5704 => "OpTypeAvcMcePayloadINTEL", - 5705 => "OpTypeAvcMceResultINTEL", - 5706 => "OpTypeAvcImeResultINTEL", - 5707 => "OpTypeAvcImeResultSingleReferenceStreamoutINTEL", - 5708 => "OpTypeAvcImeResultDualReferenceStreamoutINTEL", - 5709 => "OpTypeAvcImeSingleReferenceStreaminINTEL", - 5710 => "OpTypeAvcImeDualReferenceStreaminINTEL", - 5711 => "OpTypeAvcRefResultINTEL", - 5712 => "OpTypeAvcSicResultINTEL", - 5713 => "OpSubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL", - 5714 => "OpSubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL", - 5715 => "OpSubgroupAvcMceGetDefaultInterShapePenaltyINTEL", - 5716 => "OpSubgroupAvcMceSetInterShapePenaltyINTEL", - 5717 => "OpSubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL", - 5718 => "OpSubgroupAvcMceSetInterDirectionPenaltyINTEL", - 5719 => "OpSubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL", - 5720 => "OpSubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL", - 5721 => "OpSubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL", - 5722 => "OpSubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL", - 5723 => "OpSubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL", - 5724 => "OpSubgroupAvcMceSetMotionVectorCostFunctionINTEL", - 5725 => "OpSubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL", - 5726 => "OpSubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL", - 5727 => "OpSubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL", - 5728 => "OpSubgroupAvcMceSetAcOnlyHaarINTEL", - 5729 => "OpSubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL", - 5730 => "OpSubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL", - 5731 => "OpSubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL", - 5732 => "OpSubgroupAvcMceConvertToImePayloadINTEL", - 5733 => "OpSubgroupAvcMceConvertToImeResultINTEL", - 5734 => "OpSubgroupAvcMceConvertToRefPayloadINTEL", - 5735 => "OpSubgroupAvcMceConvertToRefResultINTEL", - 5736 => "OpSubgroupAvcMceConvertToSicPayloadINTEL", - 5737 => "OpSubgroupAvcMceConvertToSicResultINTEL", - 5738 => "OpSubgroupAvcMceGetMotionVectorsINTEL", - 5739 => "OpSubgroupAvcMceGetInterDistortionsINTEL", - 5740 => "OpSubgroupAvcMceGetBestInterDistortionsINTEL", - 5741 => "OpSubgroupAvcMceGetInterMajorShapeINTEL", - 5742 => "OpSubgroupAvcMceGetInterMinorShapeINTEL", - 5743 => "OpSubgroupAvcMceGetInterDirectionsINTEL", - 5744 => "OpSubgroupAvcMceGetInterMotionVectorCountINTEL", - 5745 => "OpSubgroupAvcMceGetInterReferenceIdsINTEL", - 5746 => "OpSubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL", - 5747 => "OpSubgroupAvcImeInitializeINTEL", - 5748 => "OpSubgroupAvcImeSetSingleReferenceINTEL", - 5749 => "OpSubgroupAvcImeSetDualReferenceINTEL", - 5750 => "OpSubgroupAvcImeRefWindowSizeINTEL", - 5751 => "OpSubgroupAvcImeAdjustRefOffsetINTEL", - 5752 => "OpSubgroupAvcImeConvertToMcePayloadINTEL", - 5753 => "OpSubgroupAvcImeSetMaxMotionVectorCountINTEL", - 5754 => "OpSubgroupAvcImeSetUnidirectionalMixDisableINTEL", - 5755 => "OpSubgroupAvcImeSetEarlySearchTerminationThresholdINTEL", - 5756 => "OpSubgroupAvcImeSetWeightedSadINTEL", - 5757 => "OpSubgroupAvcImeEvaluateWithSingleReferenceINTEL", - 5758 => "OpSubgroupAvcImeEvaluateWithDualReferenceINTEL", - 5759 => "OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL", - 5760 => "OpSubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL", - 5761 => "OpSubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL", - 5762 => "OpSubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL", - 5763 => "OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL", - 5764 => "OpSubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL", - 5765 => "OpSubgroupAvcImeConvertToMceResultINTEL", - 5766 => "OpSubgroupAvcImeGetSingleReferenceStreaminINTEL", - 5767 => "OpSubgroupAvcImeGetDualReferenceStreaminINTEL", - 5768 => "OpSubgroupAvcImeStripSingleReferenceStreamoutINTEL", - 5769 => "OpSubgroupAvcImeStripDualReferenceStreamoutINTEL", - 5770 => "OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL", - 5771 => "OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL", - 5772 => "OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL", - 5773 => "OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL", - 5774 => "OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL", - 5775 => "OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL", - 5776 => "OpSubgroupAvcImeGetBorderReachedINTEL", - 5777 => "OpSubgroupAvcImeGetTruncatedSearchIndicationINTEL", - 5778 => "OpSubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL", - 5779 => "OpSubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL", - 5780 => "OpSubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL", - 5781 => "OpSubgroupAvcFmeInitializeINTEL", - 5782 => "OpSubgroupAvcBmeInitializeINTEL", - 5783 => "OpSubgroupAvcRefConvertToMcePayloadINTEL", - 5784 => "OpSubgroupAvcRefSetBidirectionalMixDisableINTEL", - 5785 => "OpSubgroupAvcRefSetBilinearFilterEnableINTEL", - 5786 => "OpSubgroupAvcRefEvaluateWithSingleReferenceINTEL", - 5787 => "OpSubgroupAvcRefEvaluateWithDualReferenceINTEL", - 5788 => "OpSubgroupAvcRefEvaluateWithMultiReferenceINTEL", - 5789 => "OpSubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL", - 5790 => "OpSubgroupAvcRefConvertToMceResultINTEL", - 5791 => "OpSubgroupAvcSicInitializeINTEL", - 5792 => "OpSubgroupAvcSicConfigureSkcINTEL", - 5793 => "OpSubgroupAvcSicConfigureIpeLumaINTEL", - 5794 => "OpSubgroupAvcSicConfigureIpeLumaChromaINTEL", - 5795 => "OpSubgroupAvcSicGetMotionVectorMaskINTEL", - 5796 => "OpSubgroupAvcSicConvertToMcePayloadINTEL", - 5797 => "OpSubgroupAvcSicSetIntraLumaShapePenaltyINTEL", - 5798 => "OpSubgroupAvcSicSetIntraLumaModeCostFunctionINTEL", - 5799 => "OpSubgroupAvcSicSetIntraChromaModeCostFunctionINTEL", - 5800 => "OpSubgroupAvcSicSetBilinearFilterEnableINTEL", - 5801 => "OpSubgroupAvcSicSetSkcForwardTransformEnableINTEL", - 5802 => "OpSubgroupAvcSicSetBlockBasedRawSkipSadINTEL", - 5803 => "OpSubgroupAvcSicEvaluateIpeINTEL", - 5804 => "OpSubgroupAvcSicEvaluateWithSingleReferenceINTEL", - 5805 => "OpSubgroupAvcSicEvaluateWithDualReferenceINTEL", - 5806 => "OpSubgroupAvcSicEvaluateWithMultiReferenceINTEL", - 5807 => "OpSubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL", - 5808 => "OpSubgroupAvcSicConvertToMceResultINTEL", - 5809 => "OpSubgroupAvcSicGetIpeLumaShapeINTEL", - 5810 => "OpSubgroupAvcSicGetBestIpeLumaDistortionINTEL", - 5811 => "OpSubgroupAvcSicGetBestIpeChromaDistortionINTEL", - 5812 => "OpSubgroupAvcSicGetPackedIpeLumaModesINTEL", - 5813 => "OpSubgroupAvcSicGetIpeChromaModeINTEL", - 5814 => "OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL", - 5815 => "OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL", - 5816 => "OpSubgroupAvcSicGetInterRawSadsINTEL", - 5818 => "OpVariableLengthArrayINTEL", - 5819 => "OpSaveMemoryINTEL", - 5820 => "OpRestoreMemoryINTEL", - 5840 => "OpArbitraryFloatSinCosPiINTEL", - 5841 => "OpArbitraryFloatCastINTEL", - 5842 => "OpArbitraryFloatCastFromIntINTEL", - 5843 => "OpArbitraryFloatCastToIntINTEL", - 5846 => "OpArbitraryFloatAddINTEL", - 5847 => "OpArbitraryFloatSubINTEL", - 5848 => "OpArbitraryFloatMulINTEL", - 5849 => "OpArbitraryFloatDivINTEL", - 5850 => "OpArbitraryFloatGTINTEL", - 5851 => "OpArbitraryFloatGEINTEL", - 5852 => "OpArbitraryFloatLTINTEL", - 5853 => "OpArbitraryFloatLEINTEL", - 5854 => "OpArbitraryFloatEQINTEL", - 5855 => "OpArbitraryFloatRecipINTEL", - 5856 => "OpArbitraryFloatRSqrtINTEL", - 5857 => "OpArbitraryFloatCbrtINTEL", - 5858 => "OpArbitraryFloatHypotINTEL", - 5859 => "OpArbitraryFloatSqrtINTEL", - 5860 => "OpArbitraryFloatLogINTEL", - 5861 => "OpArbitraryFloatLog2INTEL", - 5862 => "OpArbitraryFloatLog10INTEL", - 5863 => "OpArbitraryFloatLog1pINTEL", - 5864 => "OpArbitraryFloatExpINTEL", - 5865 => "OpArbitraryFloatExp2INTEL", - 5866 => "OpArbitraryFloatExp10INTEL", - 5867 => "OpArbitraryFloatExpm1INTEL", - 5868 => "OpArbitraryFloatSinINTEL", - 5869 => "OpArbitraryFloatCosINTEL", - 5870 => "OpArbitraryFloatSinCosINTEL", - 5871 => "OpArbitraryFloatSinPiINTEL", - 5872 => "OpArbitraryFloatCosPiINTEL", - 5873 => "OpArbitraryFloatASinINTEL", - 5874 => "OpArbitraryFloatASinPiINTEL", - 5875 => "OpArbitraryFloatACosINTEL", - 5876 => "OpArbitraryFloatACosPiINTEL", - 5877 => "OpArbitraryFloatATanINTEL", - 5878 => "OpArbitraryFloatATanPiINTEL", - 5879 => "OpArbitraryFloatATan2INTEL", - 5880 => "OpArbitraryFloatPowINTEL", - 5881 => "OpArbitraryFloatPowRINTEL", - 5882 => "OpArbitraryFloatPowNINTEL", - 5923 => "OpFixedSqrtINTEL", - 5924 => "OpFixedRecipINTEL", - 5925 => "OpFixedRsqrtINTEL", - 5926 => "OpFixedSinINTEL", - 5927 => "OpFixedCosINTEL", - 5928 => "OpFixedSinCosINTEL", - 5929 => "OpFixedSinPiINTEL", - 5930 => "OpFixedCosPiINTEL", - 5931 => "OpFixedSinCosPiINTEL", - 5932 => "OpFixedLogINTEL", - 5933 => "OpFixedExpINTEL", - 5934 => "OpPtrCastToCrossWorkgroupINTEL", - 5938 => "OpCrossWorkgroupCastToPtrINTEL", - 6016 => "OpRayQueryGetRayTMinKHR", - 6017 => "OpRayQueryGetRayFlagsKHR", - 6018 => "OpRayQueryGetIntersectionTKHR", - 6019 => "OpRayQueryGetIntersectionInstanceCustomIndexKHR", - 6020 => "OpRayQueryGetIntersectionInstanceIdKHR", - 6021 => "OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR", - 6022 => "OpRayQueryGetIntersectionGeometryIndexKHR", - 6023 => "OpRayQueryGetIntersectionPrimitiveIndexKHR", - 6024 => "OpRayQueryGetIntersectionBarycentricsKHR", - 6025 => "OpRayQueryGetIntersectionFrontFaceKHR", - 6026 => "OpRayQueryGetIntersectionCandidateAABBOpaqueKHR", - 6027 => "OpRayQueryGetIntersectionObjectRayDirectionKHR", - 6028 => "OpRayQueryGetIntersectionObjectRayOriginKHR", - 6029 => "OpRayQueryGetWorldRayDirectionKHR", - 6030 => "OpRayQueryGetWorldRayOriginKHR", - 6031 => "OpRayQueryGetIntersectionObjectToWorldKHR", - 6032 => "OpRayQueryGetIntersectionWorldToObjectKHR", - 6035 => "OpAtomicFAddEXT", - 6086 => "OpTypeBufferSurfaceINTEL", - 6090 => "OpTypeStructContinuedINTEL", - 6091 => "OpConstantCompositeContinuedINTEL", - 6092 => "OpSpecConstantCompositeContinuedINTEL", - 6096 => "OpCompositeConstructContinuedINTEL", - 6116 => "OpConvertFToBF16INTEL", - 6117 => "OpConvertBF16ToFINTEL", - 6142 => "OpControlBarrierArriveINTEL", - 6143 => "OpControlBarrierWaitINTEL", - 6401 => "OpGroupIMulKHR", - 6402 => "OpGroupFMulKHR", - 6403 => "OpGroupBitwiseAndKHR", - 6404 => "OpGroupBitwiseOrKHR", - 6405 => "OpGroupBitwiseXorKHR", - 6406 => "OpGroupLogicalAndKHR", - 6407 => "OpGroupLogicalOrKHR", - 6408 => "OpGroupLogicalXorKHR", - _ => bail!("Unknown opcode: {}", opcode), - }; - Ok(out) -} diff --git a/spirq-spvasm/src/generated/operand_enum_type.rs b/spirq-spvasm/src/generated/operand_enum_type.rs deleted file mode 100644 index a773f10..0000000 --- a/spirq-spvasm/src/generated/operand_enum_type.rs +++ /dev/null @@ -1,434 +0,0 @@ -use anyhow::{bail, Result}; - -fn unknown_operand_index(i: usize) -> Result<&'static str> { - bail!("Unknown operand index: {}", i) -} - -pub fn operand_enum_type(opcode: u32, i: usize) -> Result<&'static str> { - let out: &'static str = match opcode { - 3 => match i { - 0 => "SourceLanguage", - _ => return unknown_operand_index(i), - }, - 14 => match i { - 0 => "AddressingModel", - 1 => "MemoryModel", - _ => return unknown_operand_index(i), - }, - 15 => match i { - 0 => "ExecutionModel", - _ => return unknown_operand_index(i), - }, - 16 => match i { - 1 => "ExecutionMode", - _ => return unknown_operand_index(i), - }, - 17 => match i { - 0 => "Capability", - _ => return unknown_operand_index(i), - }, - 25 => match i { - 1 => "Dim", - 6 => "ImageFormat", - 7 => "AccessQualifier", - _ => return unknown_operand_index(i), - }, - 32 => match i { - 0 => "StorageClass", - _ => return unknown_operand_index(i), - }, - 38 => match i { - 0 => "AccessQualifier", - _ => return unknown_operand_index(i), - }, - 39 => match i { - 1 => "StorageClass", - _ => return unknown_operand_index(i), - }, - 45 => match i { - 0 => "SamplerAddressingMode", - 2 => "SamplerFilterMode", - _ => return unknown_operand_index(i), - }, - 54 => match i { - 0 => "FunctionControl", - _ => return unknown_operand_index(i), - }, - 59 => match i { - 0 => "StorageClass", - _ => return unknown_operand_index(i), - }, - 61 => match i { - 1 => "MemoryAccess", - _ => return unknown_operand_index(i), - }, - 62 => match i { - 2 => "MemoryAccess", - _ => return unknown_operand_index(i), - }, - 63 => match i { - 2 => "MemoryAccess", - 3 => "MemoryAccess", - _ => return unknown_operand_index(i), - }, - 64 => match i { - 3 => "MemoryAccess", - 4 => "MemoryAccess", - _ => return unknown_operand_index(i), - }, - 71 => match i { - 1 => "Decoration", - _ => return unknown_operand_index(i), - }, - 72 => match i { - 2 => "Decoration", - _ => return unknown_operand_index(i), - }, - 87 => match i { - 2 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 88 => match i { - 2 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 89 => match i { - 3 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 90 => match i { - 3 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 91 => match i { - 2 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 92 => match i { - 2 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 93 => match i { - 3 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 94 => match i { - 3 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 95 => match i { - 2 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 96 => match i { - 3 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 97 => match i { - 3 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 98 => match i { - 2 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 99 => match i { - 3 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 123 => match i { - 1 => "StorageClass", - _ => return unknown_operand_index(i), - }, - 246 => match i { - 2 => "LoopControl", - _ => return unknown_operand_index(i), - }, - 247 => match i { - 1 => "SelectionControl", - _ => return unknown_operand_index(i), - }, - 264 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 265 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 266 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 267 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 268 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 269 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 270 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 271 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 305 => match i { - 2 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 306 => match i { - 2 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 307 => match i { - 3 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 308 => match i { - 3 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 309 => match i { - 2 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 310 => match i { - 2 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 311 => match i { - 3 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 312 => match i { - 3 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 313 => match i { - 2 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 314 => match i { - 3 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 315 => match i { - 3 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 320 => match i { - 2 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 331 => match i { - 1 => "ExecutionMode", - _ => return unknown_operand_index(i), - }, - 332 => match i { - 1 => "Decoration", - _ => return unknown_operand_index(i), - }, - 342 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 349 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 350 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 351 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 352 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 353 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 354 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 355 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 356 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 357 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 358 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 359 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 360 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 361 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 362 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 363 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 364 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 4450 => match i { - 2 => "PackedVectorFormat", - _ => return unknown_operand_index(i), - }, - 4451 => match i { - 2 => "PackedVectorFormat", - _ => return unknown_operand_index(i), - }, - 4452 => match i { - 2 => "PackedVectorFormat", - _ => return unknown_operand_index(i), - }, - 4453 => match i { - 3 => "PackedVectorFormat", - _ => return unknown_operand_index(i), - }, - 4454 => match i { - 3 => "PackedVectorFormat", - _ => return unknown_operand_index(i), - }, - 4455 => match i { - 3 => "PackedVectorFormat", - _ => return unknown_operand_index(i), - }, - 4457 => match i { - 3 => "MemoryAccess", - _ => return unknown_operand_index(i), - }, - 4458 => match i { - 4 => "MemoryAccess", - _ => return unknown_operand_index(i), - }, - 4459 => match i { - 3 => "CooperativeMatrixOperands", - _ => return unknown_operand_index(i), - }, - 5000 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 5001 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 5002 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 5003 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 5004 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 5005 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 5006 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 5007 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 5283 => match i { - 4 => "ImageOperands", - _ => return unknown_operand_index(i), - }, - 5359 => match i { - 3 => "MemoryAccess", - _ => return unknown_operand_index(i), - }, - 5360 => match i { - 4 => "MemoryAccess", - _ => return unknown_operand_index(i), - }, - 5632 => match i { - 1 => "Decoration", - _ => return unknown_operand_index(i), - }, - 5633 => match i { - 2 => "Decoration", - _ => return unknown_operand_index(i), - }, - 6086 => match i { - 0 => "AccessQualifier", - _ => return unknown_operand_index(i), - }, - 6401 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 6402 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 6403 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 6404 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 6405 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 6406 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 6407 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - 6408 => match i { - 1 => "GroupOperation", - _ => return unknown_operand_index(i), - }, - _ => bail!("{}-th operand of opcode {} is not a enum", i, opcode), - }; - Ok(out) -} diff --git a/spirq-spvasm/src/generated/print_operand.rs b/spirq-spvasm/src/generated/print_operand.rs deleted file mode 100644 index ae99815..0000000 --- a/spirq-spvasm/src/generated/print_operand.rs +++ /dev/null @@ -1,9030 +0,0 @@ -use super::enum_to_str::enum_to_str; -use anyhow::{bail, Result}; -use spirq_core::parse::Operands; -use std::collections::HashMap; - -fn print_id(operands: &mut Operands, id_names: &HashMap) -> Result { - let id = operands.read_u32()?; - if let Some(name) = id_names.get(&id) { - Ok(format!("%{}", name)) - } else { - Ok(format!("%{}", id)) - } -} -fn print_u32(operands: &mut Operands) -> Result { - Ok(operands.read_u32()?.to_string()) -} -#[allow(dead_code)] -fn print_f32(operands: &mut Operands) -> Result { - Ok(operands.read_f32()?.to_string()) -} -fn print_str(operands: &mut Operands) -> Result { - Ok(format!(r#""{}""#, operands.read_str()?)) -} -fn print_list(operands: &mut Operands) -> Result> { - let out = operands - .read_list()? - .iter() - .map(|x| x.to_string()) - .collect::>(); - Ok(out) -} -fn print_pair_id_id_list( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let mut out = Vec::new(); - out.push(print_id(operands, id_names)?); - out.push(print_id(operands, id_names)?); - Ok(out) -} -fn print_pair_id_u32_list( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let mut out = Vec::new(); - out.push(print_id(operands, id_names)?); - out.push(print_u32(operands)?); - Ok(out) -} -fn print_pair_u32_id_list( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let mut out = Vec::new(); - out.push(print_u32(operands)?); - out.push(print_id(operands, id_names)?); - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_ImageOperands( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"ImageOperands", value)?]; - // None - if value & 0x0000 != 0 {} - // Bias - if value & 0x0001 != 0 { - // IdRef - out.push(print_id(operands, id_names)?); - } - // Lod - if value & 0x0002 != 0 { - // IdRef - out.push(print_id(operands, id_names)?); - } - // Grad - if value & 0x0004 != 0 { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // ConstOffset - if value & 0x0008 != 0 { - // IdRef - out.push(print_id(operands, id_names)?); - } - // Offset - if value & 0x0010 != 0 { - // IdRef - out.push(print_id(operands, id_names)?); - } - // ConstOffsets - if value & 0x0020 != 0 { - // IdRef - out.push(print_id(operands, id_names)?); - } - // Sample - if value & 0x0040 != 0 { - // IdRef - out.push(print_id(operands, id_names)?); - } - // MinLod - if value & 0x0080 != 0 { - // IdRef - out.push(print_id(operands, id_names)?); - } - // MakeTexelAvailableKHR - if value & 0x0100 != 0 { - // IdScope - out.push(print_id(operands, id_names)?); - } - // MakeTexelVisibleKHR - if value & 0x0200 != 0 { - // IdScope - out.push(print_id(operands, id_names)?); - } - // NonPrivateTexelKHR - if value & 0x0400 != 0 {} - // VolatileTexelKHR - if value & 0x0800 != 0 {} - // SignExtend - if value & 0x1000 != 0 {} - // ZeroExtend - if value & 0x2000 != 0 {} - // Nontemporal - if value & 0x4000 != 0 {} - // Offsets - if value & 0x10000 != 0 { - // IdRef - out.push(print_id(operands, id_names)?); - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_FPFastMathMode( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"FPFastMathMode", value)?]; - // None - if value & 0x0000 != 0 {} - // NotNaN - if value & 0x0001 != 0 {} - // NotInf - if value & 0x0002 != 0 {} - // NSZ - if value & 0x0004 != 0 {} - // AllowRecip - if value & 0x0008 != 0 {} - // Fast - if value & 0x0010 != 0 {} - // AllowContractFastINTEL - if value & 0x10000 != 0 {} - // AllowReassocINTEL - if value & 0x20000 != 0 {} - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_SelectionControl( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"SelectionControl", value)?]; - // None - if value & 0x0000 != 0 {} - // Flatten - if value & 0x0001 != 0 {} - // DontFlatten - if value & 0x0002 != 0 {} - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_LoopControl( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"LoopControl", value)?]; - // None - if value & 0x0000 != 0 {} - // Unroll - if value & 0x0001 != 0 {} - // DontUnroll - if value & 0x0002 != 0 {} - // DependencyInfinite - if value & 0x0004 != 0 {} - // DependencyLength - if value & 0x0008 != 0 { - // LiteralInteger - out.push(print_u32(operands)?); - } - // MinIterations - if value & 0x0010 != 0 { - // LiteralInteger - out.push(print_u32(operands)?); - } - // MaxIterations - if value & 0x0020 != 0 { - // LiteralInteger - out.push(print_u32(operands)?); - } - // IterationMultiple - if value & 0x0040 != 0 { - // LiteralInteger - out.push(print_u32(operands)?); - } - // PeelCount - if value & 0x0080 != 0 { - // LiteralInteger - out.push(print_u32(operands)?); - } - // PartialCount - if value & 0x0100 != 0 { - // LiteralInteger - out.push(print_u32(operands)?); - } - // InitiationIntervalINTEL - if value & 0x10000 != 0 { - // LiteralInteger - out.push(print_u32(operands)?); - } - // MaxConcurrencyINTEL - if value & 0x20000 != 0 { - // LiteralInteger - out.push(print_u32(operands)?); - } - // DependencyArrayINTEL - if value & 0x40000 != 0 { - // LiteralInteger - out.push(print_u32(operands)?); - } - // PipelineEnableINTEL - if value & 0x80000 != 0 { - // LiteralInteger - out.push(print_u32(operands)?); - } - // LoopCoalesceINTEL - if value & 0x100000 != 0 { - // LiteralInteger - out.push(print_u32(operands)?); - } - // MaxInterleavingINTEL - if value & 0x200000 != 0 { - // LiteralInteger - out.push(print_u32(operands)?); - } - // SpeculatedIterationsINTEL - if value & 0x400000 != 0 { - // LiteralInteger - out.push(print_u32(operands)?); - } - // NoFusionINTEL - if value & 0x800000 != 0 {} - // LoopCountINTEL - if value & 0x1000000 != 0 { - // LiteralInteger - out.push(print_u32(operands)?); - } - // MaxReinvocationDelayINTEL - if value & 0x2000000 != 0 { - // LiteralInteger - out.push(print_u32(operands)?); - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_FunctionControl( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"FunctionControl", value)?]; - // None - if value & 0x0000 != 0 {} - // Inline - if value & 0x0001 != 0 {} - // DontInline - if value & 0x0002 != 0 {} - // Pure - if value & 0x0004 != 0 {} - // Const - if value & 0x0008 != 0 {} - // OptNoneINTEL - if value & 0x10000 != 0 {} - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_MemorySemantics( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"MemorySemantics", value)?]; - // None - if value & 0x0000 != 0 {} - // Acquire - if value & 0x0002 != 0 {} - // Release - if value & 0x0004 != 0 {} - // AcquireRelease - if value & 0x0008 != 0 {} - // SequentiallyConsistent - if value & 0x0010 != 0 {} - // UniformMemory - if value & 0x0040 != 0 {} - // SubgroupMemory - if value & 0x0080 != 0 {} - // WorkgroupMemory - if value & 0x0100 != 0 {} - // CrossWorkgroupMemory - if value & 0x0200 != 0 {} - // AtomicCounterMemory - if value & 0x0400 != 0 {} - // ImageMemory - if value & 0x0800 != 0 {} - // OutputMemoryKHR - if value & 0x1000 != 0 {} - // MakeAvailableKHR - if value & 0x2000 != 0 {} - // MakeVisibleKHR - if value & 0x4000 != 0 {} - // Volatile - if value & 0x8000 != 0 {} - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_MemoryAccess( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"MemoryAccess", value)?]; - // None - if value & 0x0000 != 0 {} - // Volatile - if value & 0x0001 != 0 {} - // Aligned - if value & 0x0002 != 0 { - // LiteralInteger - out.push(print_u32(operands)?); - } - // Nontemporal - if value & 0x0004 != 0 {} - // MakePointerAvailableKHR - if value & 0x0008 != 0 { - // IdScope - out.push(print_id(operands, id_names)?); - } - // MakePointerVisibleKHR - if value & 0x0010 != 0 { - // IdScope - out.push(print_id(operands, id_names)?); - } - // NonPrivatePointerKHR - if value & 0x0020 != 0 {} - // AliasScopeINTELMask - if value & 0x10000 != 0 { - // IdRef - out.push(print_id(operands, id_names)?); - } - // NoAliasINTELMask - if value & 0x20000 != 0 { - // IdRef - out.push(print_id(operands, id_names)?); - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_KernelProfilingInfo( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"KernelProfilingInfo", value)?]; - // None - if value & 0x0000 != 0 {} - // CmdExecTime - if value & 0x0001 != 0 {} - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_RayFlags( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"RayFlags", value)?]; - // NoneKHR - if value & 0x0000 != 0 {} - // OpaqueKHR - if value & 0x0001 != 0 {} - // NoOpaqueKHR - if value & 0x0002 != 0 {} - // TerminateOnFirstHitKHR - if value & 0x0004 != 0 {} - // SkipClosestHitShaderKHR - if value & 0x0008 != 0 {} - // CullBackFacingTrianglesKHR - if value & 0x0010 != 0 {} - // CullFrontFacingTrianglesKHR - if value & 0x0020 != 0 {} - // CullOpaqueKHR - if value & 0x0040 != 0 {} - // CullNoOpaqueKHR - if value & 0x0080 != 0 {} - // SkipTrianglesKHR - if value & 0x0100 != 0 {} - // SkipAABBsKHR - if value & 0x0200 != 0 {} - // ForceOpacityMicromap2StateEXT - if value & 0x0400 != 0 {} - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_FragmentShadingRate( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"FragmentShadingRate", value)?]; - // Vertical2Pixels - if value & 0x0001 != 0 {} - // Vertical4Pixels - if value & 0x0002 != 0 {} - // Horizontal2Pixels - if value & 0x0004 != 0 {} - // Horizontal4Pixels - if value & 0x0008 != 0 {} - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_SourceLanguage( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"SourceLanguage", value)?]; - match value { - // Unknown - 0 => {} - // ESSL - 1 => {} - // GLSL - 2 => {} - // OpenCL_C - 3 => {} - // OpenCL_CPP - 4 => {} - // HLSL - 5 => {} - // CPP_for_OpenCL - 6 => {} - // SYCL - 7 => {} - // HERO_C - 8 => {} - // NZSL - 9 => {} - // WGSL - 10 => {} - // Slang - 11 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_ExecutionModel( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"ExecutionModel", value)?]; - match value { - // Vertex - 0 => {} - // TessellationControl - 1 => {} - // TessellationEvaluation - 2 => {} - // Geometry - 3 => {} - // Fragment - 4 => {} - // GLCompute - 5 => {} - // Kernel - 6 => {} - // TaskNV - 5267 => {} - // MeshNV - 5268 => {} - // RayGenerationKHR - 5313 => {} - // IntersectionKHR - 5314 => {} - // AnyHitKHR - 5315 => {} - // ClosestHitKHR - 5316 => {} - // MissKHR - 5317 => {} - // CallableKHR - 5318 => {} - // TaskEXT - 5364 => {} - // MeshEXT - 5365 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_AddressingModel( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"AddressingModel", value)?]; - match value { - // Logical - 0 => {} - // Physical32 - 1 => {} - // Physical64 - 2 => {} - // PhysicalStorageBuffer64EXT - 5348 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_MemoryModel( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"MemoryModel", value)?]; - match value { - // Simple - 0 => {} - // GLSL450 - 1 => {} - // OpenCL - 2 => {} - // VulkanKHR - 3 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_ExecutionMode( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"ExecutionMode", value)?]; - match value { - // Invocations - 0 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // SpacingEqual - 1 => {} - // SpacingFractionalEven - 2 => {} - // SpacingFractionalOdd - 3 => {} - // VertexOrderCw - 4 => {} - // VertexOrderCcw - 5 => {} - // PixelCenterInteger - 6 => {} - // OriginUpperLeft - 7 => {} - // OriginLowerLeft - 8 => {} - // EarlyFragmentTests - 9 => {} - // PointMode - 10 => {} - // Xfb - 11 => {} - // DepthReplacing - 12 => {} - // DepthGreater - 14 => {} - // DepthLess - 15 => {} - // DepthUnchanged - 16 => {} - // LocalSize - 17 => { - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // LocalSizeHint - 18 => { - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // InputPoints - 19 => {} - // InputLines - 20 => {} - // InputLinesAdjacency - 21 => {} - // Triangles - 22 => {} - // InputTrianglesAdjacency - 23 => {} - // Quads - 24 => {} - // Isolines - 25 => {} - // OutputVertices - 26 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // OutputPoints - 27 => {} - // OutputLineStrip - 28 => {} - // OutputTriangleStrip - 29 => {} - // VecTypeHint - 30 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // ContractionOff - 31 => {} - // Initializer - 33 => {} - // Finalizer - 34 => {} - // SubgroupSize - 35 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // SubgroupsPerWorkgroup - 36 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // SubgroupsPerWorkgroupId - 37 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // LocalSizeId - 38 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // LocalSizeHintId - 39 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // NonCoherentColorAttachmentReadEXT - 4169 => {} - // NonCoherentDepthAttachmentReadEXT - 4170 => {} - // NonCoherentStencilAttachmentReadEXT - 4171 => {} - // SubgroupUniformControlFlowKHR - 4421 => {} - // PostDepthCoverage - 4446 => {} - // DenormPreserve - 4459 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // DenormFlushToZero - 4460 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // SignedZeroInfNanPreserve - 4461 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // RoundingModeRTE - 4462 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // RoundingModeRTZ - 4463 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // EarlyAndLateFragmentTestsAMD - 5017 => {} - // StencilRefReplacingEXT - 5027 => {} - // CoalescingAMDX - 5069 => {} - // MaxNodeRecursionAMDX - 5071 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // StaticNumWorkgroupsAMDX - 5072 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // ShaderIndexAMDX - 5073 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // MaxNumWorkgroupsAMDX - 5077 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // StencilRefUnchangedFrontAMD - 5079 => {} - // StencilRefGreaterFrontAMD - 5080 => {} - // StencilRefLessFrontAMD - 5081 => {} - // StencilRefUnchangedBackAMD - 5082 => {} - // StencilRefGreaterBackAMD - 5083 => {} - // StencilRefLessBackAMD - 5084 => {} - // OutputLinesEXT - 5269 => {} - // OutputPrimitivesEXT - 5270 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // DerivativeGroupQuadsNV - 5289 => {} - // DerivativeGroupLinearNV - 5290 => {} - // OutputTrianglesEXT - 5298 => {} - // PixelInterlockOrderedEXT - 5366 => {} - // PixelInterlockUnorderedEXT - 5367 => {} - // SampleInterlockOrderedEXT - 5368 => {} - // SampleInterlockUnorderedEXT - 5369 => {} - // ShadingRateInterlockOrderedEXT - 5370 => {} - // ShadingRateInterlockUnorderedEXT - 5371 => {} - // SharedLocalMemorySizeINTEL - 5618 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // RoundingModeRTPINTEL - 5620 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // RoundingModeRTNINTEL - 5621 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // FloatingPointModeALTINTEL - 5622 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // FloatingPointModeIEEEINTEL - 5623 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // MaxWorkgroupSizeINTEL - 5893 => { - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // MaxWorkDimINTEL - 5894 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // NoGlobalOffsetINTEL - 5895 => {} - // NumSIMDWorkitemsINTEL - 5896 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // SchedulerTargetFmaxMhzINTEL - 5903 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // StreamingInterfaceINTEL - 6154 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // RegisterMapInterfaceINTEL - 6160 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // NamedBarrierCountINTEL - 6417 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_StorageClass( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"StorageClass", value)?]; - match value { - // UniformConstant - 0 => {} - // Input - 1 => {} - // Uniform - 2 => {} - // Output - 3 => {} - // Workgroup - 4 => {} - // CrossWorkgroup - 5 => {} - // Private - 6 => {} - // Function - 7 => {} - // Generic - 8 => {} - // PushConstant - 9 => {} - // AtomicCounter - 10 => {} - // Image - 11 => {} - // StorageBuffer - 12 => {} - // TileImageEXT - 4172 => {} - // NodePayloadAMDX - 5068 => {} - // NodeOutputPayloadAMDX - 5076 => {} - // CallableDataKHR - 5328 => {} - // IncomingCallableDataKHR - 5329 => {} - // RayPayloadKHR - 5338 => {} - // HitAttributeKHR - 5339 => {} - // IncomingRayPayloadKHR - 5342 => {} - // ShaderRecordBufferKHR - 5343 => {} - // PhysicalStorageBufferEXT - 5349 => {} - // HitObjectAttributeNV - 5385 => {} - // TaskPayloadWorkgroupEXT - 5402 => {} - // CodeSectionINTEL - 5605 => {} - // DeviceOnlyINTEL - 5936 => {} - // HostOnlyINTEL - 5937 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_Dim(operands: &mut Operands, id_names: &HashMap) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"Dim", value)?]; - match value { - // 1D - 0 => {} - // 2D - 1 => {} - // 3D - 2 => {} - // Cube - 3 => {} - // Rect - 4 => {} - // Buffer - 5 => {} - // SubpassData - 6 => {} - // TileImageDataEXT - 4173 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_SamplerAddressingMode( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"SamplerAddressingMode", value)?]; - match value { - // None - 0 => {} - // ClampToEdge - 1 => {} - // Clamp - 2 => {} - // Repeat - 3 => {} - // RepeatMirrored - 4 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_SamplerFilterMode( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"SamplerFilterMode", value)?]; - match value { - // Nearest - 0 => {} - // Linear - 1 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_ImageFormat( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"ImageFormat", value)?]; - match value { - // Unknown - 0 => {} - // Rgba32f - 1 => {} - // Rgba16f - 2 => {} - // R32f - 3 => {} - // Rgba8 - 4 => {} - // Rgba8Snorm - 5 => {} - // Rg32f - 6 => {} - // Rg16f - 7 => {} - // R11fG11fB10f - 8 => {} - // R16f - 9 => {} - // Rgba16 - 10 => {} - // Rgb10A2 - 11 => {} - // Rg16 - 12 => {} - // Rg8 - 13 => {} - // R16 - 14 => {} - // R8 - 15 => {} - // Rgba16Snorm - 16 => {} - // Rg16Snorm - 17 => {} - // Rg8Snorm - 18 => {} - // R16Snorm - 19 => {} - // R8Snorm - 20 => {} - // Rgba32i - 21 => {} - // Rgba16i - 22 => {} - // Rgba8i - 23 => {} - // R32i - 24 => {} - // Rg32i - 25 => {} - // Rg16i - 26 => {} - // Rg8i - 27 => {} - // R16i - 28 => {} - // R8i - 29 => {} - // Rgba32ui - 30 => {} - // Rgba16ui - 31 => {} - // Rgba8ui - 32 => {} - // R32ui - 33 => {} - // Rgb10a2ui - 34 => {} - // Rg32ui - 35 => {} - // Rg16ui - 36 => {} - // Rg8ui - 37 => {} - // R16ui - 38 => {} - // R8ui - 39 => {} - // R64ui - 40 => {} - // R64i - 41 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_ImageChannelOrder( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"ImageChannelOrder", value)?]; - match value { - // R - 0 => {} - // A - 1 => {} - // RG - 2 => {} - // RA - 3 => {} - // RGB - 4 => {} - // RGBA - 5 => {} - // BGRA - 6 => {} - // ARGB - 7 => {} - // Intensity - 8 => {} - // Luminance - 9 => {} - // Rx - 10 => {} - // RGx - 11 => {} - // RGBx - 12 => {} - // Depth - 13 => {} - // DepthStencil - 14 => {} - // sRGB - 15 => {} - // sRGBx - 16 => {} - // sRGBA - 17 => {} - // sBGRA - 18 => {} - // ABGR - 19 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_ImageChannelDataType( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"ImageChannelDataType", value)?]; - match value { - // SnormInt8 - 0 => {} - // SnormInt16 - 1 => {} - // UnormInt8 - 2 => {} - // UnormInt16 - 3 => {} - // UnormShort565 - 4 => {} - // UnormShort555 - 5 => {} - // UnormInt101010 - 6 => {} - // SignedInt8 - 7 => {} - // SignedInt16 - 8 => {} - // SignedInt32 - 9 => {} - // UnsignedInt8 - 10 => {} - // UnsignedInt16 - 11 => {} - // UnsignedInt32 - 12 => {} - // HalfFloat - 13 => {} - // Float - 14 => {} - // UnormInt24 - 15 => {} - // UnormInt101010_2 - 16 => {} - // UnsignedIntRaw10EXT - 19 => {} - // UnsignedIntRaw12EXT - 20 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_FPRoundingMode( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"FPRoundingMode", value)?]; - match value { - // RTE - 0 => {} - // RTZ - 1 => {} - // RTP - 2 => {} - // RTN - 3 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_FPDenormMode( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"FPDenormMode", value)?]; - match value { - // Preserve - 0 => {} - // FlushToZero - 1 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_QuantizationModes( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"QuantizationModes", value)?]; - match value { - // TRN - 0 => {} - // TRN_ZERO - 1 => {} - // RND - 2 => {} - // RND_ZERO - 3 => {} - // RND_INF - 4 => {} - // RND_MIN_INF - 5 => {} - // RND_CONV - 6 => {} - // RND_CONV_ODD - 7 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_FPOperationMode( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"FPOperationMode", value)?]; - match value { - // IEEE - 0 => {} - // ALT - 1 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_OverflowModes( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"OverflowModes", value)?]; - match value { - // WRAP - 0 => {} - // SAT - 1 => {} - // SAT_ZERO - 2 => {} - // SAT_SYM - 3 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_LinkageType( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"LinkageType", value)?]; - match value { - // Export - 0 => {} - // Import - 1 => {} - // LinkOnceODR - 2 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_AccessQualifier( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"AccessQualifier", value)?]; - match value { - // ReadOnly - 0 => {} - // WriteOnly - 1 => {} - // ReadWrite - 2 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_HostAccessQualifier( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"HostAccessQualifier", value)?]; - match value { - // NoneINTEL - 0 => {} - // ReadINTEL - 1 => {} - // WriteINTEL - 2 => {} - // ReadWriteINTEL - 3 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_FunctionParameterAttribute( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"FunctionParameterAttribute", value)?]; - match value { - // Zext - 0 => {} - // Sext - 1 => {} - // ByVal - 2 => {} - // Sret - 3 => {} - // NoAlias - 4 => {} - // NoCapture - 5 => {} - // NoWrite - 6 => {} - // NoReadWrite - 7 => {} - // RuntimeAlignedINTEL - 5940 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_Decoration( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"Decoration", value)?]; - match value { - // RelaxedPrecision - 0 => {} - // SpecId - 1 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // Block - 2 => {} - // BufferBlock - 3 => {} - // RowMajor - 4 => {} - // ColMajor - 5 => {} - // ArrayStride - 6 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // MatrixStride - 7 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // GLSLShared - 8 => {} - // GLSLPacked - 9 => {} - // CPacked - 10 => {} - // BuiltIn - 11 => { - // BuiltIn - out.extend(print_enum_BuiltIn(operands, id_names)?); - } - // NoPerspective - 13 => {} - // Flat - 14 => {} - // Patch - 15 => {} - // Centroid - 16 => {} - // Sample - 17 => {} - // Invariant - 18 => {} - // Restrict - 19 => {} - // Aliased - 20 => {} - // Volatile - 21 => {} - // Constant - 22 => {} - // Coherent - 23 => {} - // NonWritable - 24 => {} - // NonReadable - 25 => {} - // Uniform - 26 => {} - // UniformId - 27 => { - // IdScope - out.push(print_id(operands, id_names)?); - } - // SaturatedConversion - 28 => {} - // Stream - 29 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // Location - 30 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // Component - 31 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // Index - 32 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // Binding - 33 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // DescriptorSet - 34 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // Offset - 35 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // XfbBuffer - 36 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // XfbStride - 37 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // FuncParamAttr - 38 => { - // FunctionParameterAttribute - out.extend(print_enum_FunctionParameterAttribute(operands, id_names)?); - } - // FPRoundingMode - 39 => { - // FPRoundingMode - out.extend(print_enum_FPRoundingMode(operands, id_names)?); - } - // FPFastMathMode - 40 => { - // FPFastMathMode - out.extend(print_enum_FPFastMathMode(operands, id_names)?); - } - // LinkageAttributes - 41 => { - // LiteralString - out.push(print_str(operands)?); - // LinkageType - out.extend(print_enum_LinkageType(operands, id_names)?); - } - // NoContraction - 42 => {} - // InputAttachmentIndex - 43 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // Alignment - 44 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // MaxByteOffset - 45 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // AlignmentId - 46 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // MaxByteOffsetId - 47 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // NoSignedWrap - 4469 => {} - // NoUnsignedWrap - 4470 => {} - // WeightTextureQCOM - 4487 => {} - // BlockMatchTextureQCOM - 4488 => {} - // ExplicitInterpAMD - 4999 => {} - // NodeSharesPayloadLimitsWithAMDX - 5019 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // NodeMaxPayloadsAMDX - 5020 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // TrackFinishWritingAMDX - 5078 => {} - // PayloadNodeNameAMDX - 5091 => { - // LiteralString - out.push(print_str(operands)?); - } - // OverrideCoverageNV - 5248 => {} - // PassthroughNV - 5250 => {} - // ViewportRelativeNV - 5252 => {} - // SecondaryViewportRelativeNV - 5256 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // PerPrimitiveEXT - 5271 => {} - // PerViewNV - 5272 => {} - // PerTaskNV - 5273 => {} - // PerVertexNV - 5285 => {} - // NonUniformEXT - 5300 => {} - // RestrictPointerEXT - 5355 => {} - // AliasedPointerEXT - 5356 => {} - // HitObjectShaderRecordBufferNV - 5386 => {} - // BindlessSamplerNV - 5398 => {} - // BindlessImageNV - 5399 => {} - // BoundSamplerNV - 5400 => {} - // BoundImageNV - 5401 => {} - // SIMTCallINTEL - 5599 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // ReferencedIndirectlyINTEL - 5602 => {} - // ClobberINTEL - 5607 => { - // LiteralString - out.push(print_str(operands)?); - } - // SideEffectsINTEL - 5608 => {} - // VectorComputeVariableINTEL - 5624 => {} - // FuncParamIOKindINTEL - 5625 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // VectorComputeFunctionINTEL - 5626 => {} - // StackCallINTEL - 5627 => {} - // GlobalVariableOffsetINTEL - 5628 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // HlslCounterBufferGOOGLE - 5634 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // HlslSemanticGOOGLE - 5635 => { - // LiteralString - out.push(print_str(operands)?); - } - // UserTypeGOOGLE - 5636 => { - // LiteralString - out.push(print_str(operands)?); - } - // FunctionRoundingModeINTEL - 5822 => { - // LiteralInteger - out.push(print_u32(operands)?); - // FPRoundingMode - out.extend(print_enum_FPRoundingMode(operands, id_names)?); - } - // FunctionDenormModeINTEL - 5823 => { - // LiteralInteger - out.push(print_u32(operands)?); - // FPDenormMode - out.extend(print_enum_FPDenormMode(operands, id_names)?); - } - // RegisterINTEL - 5825 => {} - // MemoryINTEL - 5826 => { - // LiteralString - out.push(print_str(operands)?); - } - // NumbanksINTEL - 5827 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // BankwidthINTEL - 5828 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // MaxPrivateCopiesINTEL - 5829 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // SinglepumpINTEL - 5830 => {} - // DoublepumpINTEL - 5831 => {} - // MaxReplicatesINTEL - 5832 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // SimpleDualPortINTEL - 5833 => {} - // MergeINTEL - 5834 => { - // LiteralString - out.push(print_str(operands)?); - // LiteralString - out.push(print_str(operands)?); - } - // BankBitsINTEL - 5835 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // ForcePow2DepthINTEL - 5836 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // StridesizeINTEL - 5883 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // WordsizeINTEL - 5884 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // TrueDualPortINTEL - 5885 => {} - // BurstCoalesceINTEL - 5899 => {} - // CacheSizeINTEL - 5900 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // DontStaticallyCoalesceINTEL - 5901 => {} - // PrefetchINTEL - 5902 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // StallEnableINTEL - 5905 => {} - // FuseLoopsInFunctionINTEL - 5907 => {} - // MathOpDSPModeINTEL - 5909 => { - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // AliasScopeINTEL - 5914 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // NoAliasINTEL - 5915 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // InitiationIntervalINTEL - 5917 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // MaxConcurrencyINTEL - 5918 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // PipelineEnableINTEL - 5919 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // BufferLocationINTEL - 5921 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // IOPipeStorageINTEL - 5944 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // FunctionFloatingPointModeINTEL - 6080 => { - // LiteralInteger - out.push(print_u32(operands)?); - // FPOperationMode - out.extend(print_enum_FPOperationMode(operands, id_names)?); - } - // SingleElementVectorINTEL - 6085 => {} - // VectorComputeCallableFunctionINTEL - 6087 => {} - // MediaBlockIOINTEL - 6140 => {} - // StallFreeINTEL - 6151 => {} - // FPMaxErrorDecorationINTEL - 6170 => { - // LiteralFloat - out.push(print_f32(operands)?); - } - // LatencyControlLabelINTEL - 6172 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // LatencyControlConstraintINTEL - 6173 => { - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // ConduitKernelArgumentINTEL - 6175 => {} - // RegisterMapKernelArgumentINTEL - 6176 => {} - // MMHostInterfaceAddressWidthINTEL - 6177 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // MMHostInterfaceDataWidthINTEL - 6178 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // MMHostInterfaceLatencyINTEL - 6179 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // MMHostInterfaceReadWriteModeINTEL - 6180 => { - // AccessQualifier - out.extend(print_enum_AccessQualifier(operands, id_names)?); - } - // MMHostInterfaceMaxBurstINTEL - 6181 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // MMHostInterfaceWaitRequestINTEL - 6182 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // StableKernelArgumentINTEL - 6183 => {} - // HostAccessINTEL - 6188 => { - // HostAccessQualifier - out.extend(print_enum_HostAccessQualifier(operands, id_names)?); - // LiteralString - out.push(print_str(operands)?); - } - // InitModeINTEL - 6190 => { - // InitializationModeQualifier - out.extend(print_enum_InitializationModeQualifier(operands, id_names)?); - } - // ImplementInRegisterMapINTEL - 6191 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // CacheControlLoadINTEL - 6442 => { - // LiteralInteger - out.push(print_u32(operands)?); - // LoadCacheControl - out.extend(print_enum_LoadCacheControl(operands, id_names)?); - } - // CacheControlStoreINTEL - 6443 => { - // LiteralInteger - out.push(print_u32(operands)?); - // StoreCacheControl - out.extend(print_enum_StoreCacheControl(operands, id_names)?); - } - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_BuiltIn( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"BuiltIn", value)?]; - match value { - // Position - 0 => {} - // PointSize - 1 => {} - // ClipDistance - 3 => {} - // CullDistance - 4 => {} - // VertexId - 5 => {} - // InstanceId - 6 => {} - // PrimitiveId - 7 => {} - // InvocationId - 8 => {} - // Layer - 9 => {} - // ViewportIndex - 10 => {} - // TessLevelOuter - 11 => {} - // TessLevelInner - 12 => {} - // TessCoord - 13 => {} - // PatchVertices - 14 => {} - // FragCoord - 15 => {} - // PointCoord - 16 => {} - // FrontFacing - 17 => {} - // SampleId - 18 => {} - // SamplePosition - 19 => {} - // SampleMask - 20 => {} - // FragDepth - 22 => {} - // HelperInvocation - 23 => {} - // NumWorkgroups - 24 => {} - // WorkgroupSize - 25 => {} - // WorkgroupId - 26 => {} - // LocalInvocationId - 27 => {} - // GlobalInvocationId - 28 => {} - // LocalInvocationIndex - 29 => {} - // WorkDim - 30 => {} - // GlobalSize - 31 => {} - // EnqueuedWorkgroupSize - 32 => {} - // GlobalOffset - 33 => {} - // GlobalLinearId - 34 => {} - // SubgroupSize - 36 => {} - // SubgroupMaxSize - 37 => {} - // NumSubgroups - 38 => {} - // NumEnqueuedSubgroups - 39 => {} - // SubgroupId - 40 => {} - // SubgroupLocalInvocationId - 41 => {} - // VertexIndex - 42 => {} - // InstanceIndex - 43 => {} - // CoreIDARM - 4160 => {} - // CoreCountARM - 4161 => {} - // CoreMaxIDARM - 4162 => {} - // WarpIDARM - 4163 => {} - // WarpMaxIDARM - 4164 => {} - // SubgroupEqMaskKHR - 4416 => {} - // SubgroupGeMaskKHR - 4417 => {} - // SubgroupGtMaskKHR - 4418 => {} - // SubgroupLeMaskKHR - 4419 => {} - // SubgroupLtMaskKHR - 4420 => {} - // BaseVertex - 4424 => {} - // BaseInstance - 4425 => {} - // DrawIndex - 4426 => {} - // PrimitiveShadingRateKHR - 4432 => {} - // DeviceIndex - 4438 => {} - // ViewIndex - 4440 => {} - // ShadingRateKHR - 4444 => {} - // BaryCoordNoPerspAMD - 4992 => {} - // BaryCoordNoPerspCentroidAMD - 4993 => {} - // BaryCoordNoPerspSampleAMD - 4994 => {} - // BaryCoordSmoothAMD - 4995 => {} - // BaryCoordSmoothCentroidAMD - 4996 => {} - // BaryCoordSmoothSampleAMD - 4997 => {} - // BaryCoordPullModelAMD - 4998 => {} - // FragStencilRefEXT - 5014 => {} - // CoalescedInputCountAMDX - 5021 => {} - // ShaderIndexAMDX - 5073 => {} - // ViewportMaskNV - 5253 => {} - // SecondaryPositionNV - 5257 => {} - // SecondaryViewportMaskNV - 5258 => {} - // PositionPerViewNV - 5261 => {} - // ViewportMaskPerViewNV - 5262 => {} - // FullyCoveredEXT - 5264 => {} - // TaskCountNV - 5274 => {} - // PrimitiveCountNV - 5275 => {} - // PrimitiveIndicesNV - 5276 => {} - // ClipDistancePerViewNV - 5277 => {} - // CullDistancePerViewNV - 5278 => {} - // LayerPerViewNV - 5279 => {} - // MeshViewCountNV - 5280 => {} - // MeshViewIndicesNV - 5281 => {} - // BaryCoordNV - 5286 => {} - // BaryCoordNoPerspNV - 5287 => {} - // FragmentSizeNV - 5292 => {} - // InvocationsPerPixelNV - 5293 => {} - // PrimitivePointIndicesEXT - 5294 => {} - // PrimitiveLineIndicesEXT - 5295 => {} - // PrimitiveTriangleIndicesEXT - 5296 => {} - // CullPrimitiveEXT - 5299 => {} - // LaunchIdKHR - 5319 => {} - // LaunchSizeKHR - 5320 => {} - // WorldRayOriginKHR - 5321 => {} - // WorldRayDirectionKHR - 5322 => {} - // ObjectRayOriginKHR - 5323 => {} - // ObjectRayDirectionKHR - 5324 => {} - // RayTminKHR - 5325 => {} - // RayTmaxKHR - 5326 => {} - // InstanceCustomIndexKHR - 5327 => {} - // ObjectToWorldKHR - 5330 => {} - // WorldToObjectKHR - 5331 => {} - // HitTNV - 5332 => {} - // HitKindKHR - 5333 => {} - // CurrentRayTimeNV - 5334 => {} - // HitTriangleVertexPositionsKHR - 5335 => {} - // HitMicroTriangleVertexPositionsNV - 5337 => {} - // HitMicroTriangleVertexBarycentricsNV - 5344 => {} - // IncomingRayFlagsKHR - 5351 => {} - // RayGeometryIndexKHR - 5352 => {} - // WarpsPerSMNV - 5374 => {} - // SMCountNV - 5375 => {} - // WarpIDNV - 5376 => {} - // SMIDNV - 5377 => {} - // HitKindFrontFacingMicroTriangleNV - 5405 => {} - // HitKindBackFacingMicroTriangleNV - 5406 => {} - // CullMaskKHR - 6021 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_Scope( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"Scope", value)?]; - match value { - // CrossDevice - 0 => {} - // Device - 1 => {} - // Workgroup - 2 => {} - // Subgroup - 3 => {} - // Invocation - 4 => {} - // QueueFamilyKHR - 5 => {} - // ShaderCallKHR - 6 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_GroupOperation( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"GroupOperation", value)?]; - match value { - // Reduce - 0 => {} - // InclusiveScan - 1 => {} - // ExclusiveScan - 2 => {} - // ClusteredReduce - 3 => {} - // PartitionedReduceNV - 6 => {} - // PartitionedInclusiveScanNV - 7 => {} - // PartitionedExclusiveScanNV - 8 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_KernelEnqueueFlags( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"KernelEnqueueFlags", value)?]; - match value { - // NoWait - 0 => {} - // WaitKernel - 1 => {} - // WaitWorkGroup - 2 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_Capability( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"Capability", value)?]; - match value { - // Matrix - 0 => {} - // Shader - 1 => {} - // Geometry - 2 => {} - // Tessellation - 3 => {} - // Addresses - 4 => {} - // Linkage - 5 => {} - // Kernel - 6 => {} - // Vector16 - 7 => {} - // Float16Buffer - 8 => {} - // Float16 - 9 => {} - // Float64 - 10 => {} - // Int64 - 11 => {} - // Int64Atomics - 12 => {} - // ImageBasic - 13 => {} - // ImageReadWrite - 14 => {} - // ImageMipmap - 15 => {} - // Pipes - 17 => {} - // Groups - 18 => {} - // DeviceEnqueue - 19 => {} - // LiteralSampler - 20 => {} - // AtomicStorage - 21 => {} - // Int16 - 22 => {} - // TessellationPointSize - 23 => {} - // GeometryPointSize - 24 => {} - // ImageGatherExtended - 25 => {} - // StorageImageMultisample - 27 => {} - // UniformBufferArrayDynamicIndexing - 28 => {} - // SampledImageArrayDynamicIndexing - 29 => {} - // StorageBufferArrayDynamicIndexing - 30 => {} - // StorageImageArrayDynamicIndexing - 31 => {} - // ClipDistance - 32 => {} - // CullDistance - 33 => {} - // ImageCubeArray - 34 => {} - // SampleRateShading - 35 => {} - // ImageRect - 36 => {} - // SampledRect - 37 => {} - // GenericPointer - 38 => {} - // Int8 - 39 => {} - // InputAttachment - 40 => {} - // SparseResidency - 41 => {} - // MinLod - 42 => {} - // Sampled1D - 43 => {} - // Image1D - 44 => {} - // SampledCubeArray - 45 => {} - // SampledBuffer - 46 => {} - // ImageBuffer - 47 => {} - // ImageMSArray - 48 => {} - // StorageImageExtendedFormats - 49 => {} - // ImageQuery - 50 => {} - // DerivativeControl - 51 => {} - // InterpolationFunction - 52 => {} - // TransformFeedback - 53 => {} - // GeometryStreams - 54 => {} - // StorageImageReadWithoutFormat - 55 => {} - // StorageImageWriteWithoutFormat - 56 => {} - // MultiViewport - 57 => {} - // SubgroupDispatch - 58 => {} - // NamedBarrier - 59 => {} - // PipeStorage - 60 => {} - // GroupNonUniform - 61 => {} - // GroupNonUniformVote - 62 => {} - // GroupNonUniformArithmetic - 63 => {} - // GroupNonUniformBallot - 64 => {} - // GroupNonUniformShuffle - 65 => {} - // GroupNonUniformShuffleRelative - 66 => {} - // GroupNonUniformClustered - 67 => {} - // GroupNonUniformQuad - 68 => {} - // ShaderLayer - 69 => {} - // ShaderViewportIndex - 70 => {} - // UniformDecoration - 71 => {} - // CoreBuiltinsARM - 4165 => {} - // TileImageColorReadAccessEXT - 4166 => {} - // TileImageDepthReadAccessEXT - 4167 => {} - // TileImageStencilReadAccessEXT - 4168 => {} - // FragmentShadingRateKHR - 4422 => {} - // SubgroupBallotKHR - 4423 => {} - // DrawParameters - 4427 => {} - // WorkgroupMemoryExplicitLayoutKHR - 4428 => {} - // WorkgroupMemoryExplicitLayout8BitAccessKHR - 4429 => {} - // WorkgroupMemoryExplicitLayout16BitAccessKHR - 4430 => {} - // SubgroupVoteKHR - 4431 => {} - // StorageUniformBufferBlock16 - 4433 => {} - // StorageUniform16 - 4434 => {} - // StoragePushConstant16 - 4435 => {} - // StorageInputOutput16 - 4436 => {} - // DeviceGroup - 4437 => {} - // MultiView - 4439 => {} - // VariablePointersStorageBuffer - 4441 => {} - // VariablePointers - 4442 => {} - // AtomicStorageOps - 4445 => {} - // SampleMaskPostDepthCoverage - 4447 => {} - // StorageBuffer8BitAccess - 4448 => {} - // UniformAndStorageBuffer8BitAccess - 4449 => {} - // StoragePushConstant8 - 4450 => {} - // DenormPreserve - 4464 => {} - // DenormFlushToZero - 4465 => {} - // SignedZeroInfNanPreserve - 4466 => {} - // RoundingModeRTE - 4467 => {} - // RoundingModeRTZ - 4468 => {} - // RayQueryProvisionalKHR - 4471 => {} - // RayQueryKHR - 4472 => {} - // RayTraversalPrimitiveCullingKHR - 4478 => {} - // RayTracingKHR - 4479 => {} - // TextureSampleWeightedQCOM - 4484 => {} - // TextureBoxFilterQCOM - 4485 => {} - // TextureBlockMatchQCOM - 4486 => {} - // Float16ImageAMD - 5008 => {} - // ImageGatherBiasLodAMD - 5009 => {} - // FragmentMaskAMD - 5010 => {} - // StencilExportEXT - 5013 => {} - // ImageReadWriteLodAMD - 5015 => {} - // Int64ImageEXT - 5016 => {} - // ShaderClockKHR - 5055 => {} - // ShaderEnqueueAMDX - 5067 => {} - // SampleMaskOverrideCoverageNV - 5249 => {} - // GeometryShaderPassthroughNV - 5251 => {} - // ShaderViewportIndexLayerNV - 5254 => {} - // ShaderViewportMaskNV - 5255 => {} - // ShaderStereoViewNV - 5259 => {} - // PerViewAttributesNV - 5260 => {} - // FragmentFullyCoveredEXT - 5265 => {} - // MeshShadingNV - 5266 => {} - // ImageFootprintNV - 5282 => {} - // MeshShadingEXT - 5283 => {} - // FragmentBarycentricNV - 5284 => {} - // ComputeDerivativeGroupQuadsNV - 5288 => {} - // ShadingRateNV - 5291 => {} - // GroupNonUniformPartitionedNV - 5297 => {} - // ShaderNonUniformEXT - 5301 => {} - // RuntimeDescriptorArrayEXT - 5302 => {} - // InputAttachmentArrayDynamicIndexingEXT - 5303 => {} - // UniformTexelBufferArrayDynamicIndexingEXT - 5304 => {} - // StorageTexelBufferArrayDynamicIndexingEXT - 5305 => {} - // UniformBufferArrayNonUniformIndexingEXT - 5306 => {} - // SampledImageArrayNonUniformIndexingEXT - 5307 => {} - // StorageBufferArrayNonUniformIndexingEXT - 5308 => {} - // StorageImageArrayNonUniformIndexingEXT - 5309 => {} - // InputAttachmentArrayNonUniformIndexingEXT - 5310 => {} - // UniformTexelBufferArrayNonUniformIndexingEXT - 5311 => {} - // StorageTexelBufferArrayNonUniformIndexingEXT - 5312 => {} - // RayTracingPositionFetchKHR - 5336 => {} - // RayTracingNV - 5340 => {} - // RayTracingMotionBlurNV - 5341 => {} - // VulkanMemoryModelKHR - 5345 => {} - // VulkanMemoryModelDeviceScopeKHR - 5346 => {} - // PhysicalStorageBufferAddressesEXT - 5347 => {} - // ComputeDerivativeGroupLinearNV - 5350 => {} - // RayTracingProvisionalKHR - 5353 => {} - // CooperativeMatrixNV - 5357 => {} - // FragmentShaderSampleInterlockEXT - 5363 => {} - // FragmentShaderShadingRateInterlockEXT - 5372 => {} - // ShaderSMBuiltinsNV - 5373 => {} - // FragmentShaderPixelInterlockEXT - 5378 => {} - // DemoteToHelperInvocationEXT - 5379 => {} - // DisplacementMicromapNV - 5380 => {} - // RayTracingOpacityMicromapEXT - 5381 => {} - // ShaderInvocationReorderNV - 5383 => {} - // BindlessTextureNV - 5390 => {} - // RayQueryPositionFetchKHR - 5391 => {} - // RayTracingDisplacementMicromapNV - 5409 => {} - // SubgroupShuffleINTEL - 5568 => {} - // SubgroupBufferBlockIOINTEL - 5569 => {} - // SubgroupImageBlockIOINTEL - 5570 => {} - // SubgroupImageMediaBlockIOINTEL - 5579 => {} - // RoundToInfinityINTEL - 5582 => {} - // FloatingPointModeINTEL - 5583 => {} - // IntegerFunctions2INTEL - 5584 => {} - // FunctionPointersINTEL - 5603 => {} - // IndirectReferencesINTEL - 5604 => {} - // AsmINTEL - 5606 => {} - // AtomicFloat32MinMaxEXT - 5612 => {} - // AtomicFloat64MinMaxEXT - 5613 => {} - // AtomicFloat16MinMaxEXT - 5616 => {} - // VectorComputeINTEL - 5617 => {} - // VectorAnyINTEL - 5619 => {} - // ExpectAssumeKHR - 5629 => {} - // SubgroupAvcMotionEstimationINTEL - 5696 => {} - // SubgroupAvcMotionEstimationIntraINTEL - 5697 => {} - // SubgroupAvcMotionEstimationChromaINTEL - 5698 => {} - // VariableLengthArrayINTEL - 5817 => {} - // FunctionFloatControlINTEL - 5821 => {} - // FPGAMemoryAttributesINTEL - 5824 => {} - // FPFastMathModeINTEL - 5837 => {} - // ArbitraryPrecisionIntegersINTEL - 5844 => {} - // ArbitraryPrecisionFloatingPointINTEL - 5845 => {} - // UnstructuredLoopControlsINTEL - 5886 => {} - // FPGALoopControlsINTEL - 5888 => {} - // KernelAttributesINTEL - 5892 => {} - // FPGAKernelAttributesINTEL - 5897 => {} - // FPGAMemoryAccessesINTEL - 5898 => {} - // FPGAClusterAttributesINTEL - 5904 => {} - // LoopFuseINTEL - 5906 => {} - // FPGADSPControlINTEL - 5908 => {} - // MemoryAccessAliasingINTEL - 5910 => {} - // FPGAInvocationPipeliningAttributesINTEL - 5916 => {} - // FPGABufferLocationINTEL - 5920 => {} - // ArbitraryPrecisionFixedPointINTEL - 5922 => {} - // USMStorageClassesINTEL - 5935 => {} - // RuntimeAlignedAttributeINTEL - 5939 => {} - // IOPipesINTEL - 5943 => {} - // BlockingPipesINTEL - 5945 => {} - // FPGARegINTEL - 5948 => {} - // DotProductInputAllKHR - 6016 => {} - // DotProductInput4x8BitKHR - 6017 => {} - // DotProductInput4x8BitPackedKHR - 6018 => {} - // DotProductKHR - 6019 => {} - // RayCullMaskKHR - 6020 => {} - // CooperativeMatrixKHR - 6022 => {} - // BitInstructions - 6025 => {} - // GroupNonUniformRotateKHR - 6026 => {} - // AtomicFloat32AddEXT - 6033 => {} - // AtomicFloat64AddEXT - 6034 => {} - // LongCompositesINTEL - 6089 => {} - // OptNoneINTEL - 6094 => {} - // AtomicFloat16AddEXT - 6095 => {} - // DebugInfoModuleINTEL - 6114 => {} - // BFloat16ConversionINTEL - 6115 => {} - // SplitBarrierINTEL - 6141 => {} - // FPGAClusterAttributesV2INTEL - 6150 => {} - // FPGAKernelAttributesv2INTEL - 6161 => {} - // FPMaxErrorINTEL - 6169 => {} - // FPGALatencyControlINTEL - 6171 => {} - // FPGAArgumentInterfacesINTEL - 6174 => {} - // GlobalVariableHostAccessINTEL - 6187 => {} - // GlobalVariableFPGADecorationsINTEL - 6189 => {} - // GroupUniformArithmeticKHR - 6400 => {} - // CacheControlsINTEL - 6441 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_RayQueryIntersection( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"RayQueryIntersection", value)?]; - match value { - // RayQueryCandidateIntersectionKHR - 0 => {} - // RayQueryCommittedIntersectionKHR - 1 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_RayQueryCommittedIntersectionType( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"RayQueryCommittedIntersectionType", value)?]; - match value { - // RayQueryCommittedIntersectionNoneKHR - 0 => {} - // RayQueryCommittedIntersectionTriangleKHR - 1 => {} - // RayQueryCommittedIntersectionGeneratedKHR - 2 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_RayQueryCandidateIntersectionType( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"RayQueryCandidateIntersectionType", value)?]; - match value { - // RayQueryCandidateIntersectionTriangleKHR - 0 => {} - // RayQueryCandidateIntersectionAABBKHR - 1 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_PackedVectorFormat( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"PackedVectorFormat", value)?]; - match value { - // PackedVectorFormat4x8BitKHR - 0 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_CooperativeMatrixOperands( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"CooperativeMatrixOperands", value)?]; - // NoneKHR - if value & 0x0000 != 0 {} - // MatrixASignedComponentsKHR - if value & 0x0001 != 0 {} - // MatrixBSignedComponentsKHR - if value & 0x0002 != 0 {} - // MatrixCSignedComponentsKHR - if value & 0x0004 != 0 {} - // MatrixResultSignedComponentsKHR - if value & 0x0008 != 0 {} - // SaturatingAccumulationKHR - if value & 0x0010 != 0 {} - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_CooperativeMatrixLayout( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"CooperativeMatrixLayout", value)?]; - match value { - // RowMajorKHR - 0 => {} - // ColumnMajorKHR - 1 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_CooperativeMatrixUse( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"CooperativeMatrixUse", value)?]; - match value { - // MatrixAKHR - 0 => {} - // MatrixBKHR - 1 => {} - // MatrixAccumulatorKHR - 2 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_InitializationModeQualifier( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"InitializationModeQualifier", value)?]; - match value { - // InitOnDeviceReprogramINTEL - 0 => {} - // InitOnDeviceResetINTEL - 1 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_LoadCacheControl( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"LoadCacheControl", value)?]; - match value { - // UncachedINTEL - 0 => {} - // CachedINTEL - 1 => {} - // StreamingINTEL - 2 => {} - // InvalidateAfterReadINTEL - 3 => {} - // ConstCachedINTEL - 4 => {} - _ => {} - } - Ok(out) -} - -#[allow(non_snake_case)] -#[allow(dead_code)] -#[allow(unused_variables)] -fn print_enum_StoreCacheControl( - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let value = operands.read_u32()?; - #[allow(unused_mut)] - let mut out = vec![enum_to_str(&"StoreCacheControl", value)?]; - match value { - // UncachedINTEL - 0 => {} - // WriteThroughINTEL - 1 => {} - // WriteBackINTEL - 2 => {} - // StreamingINTEL - 3 => {} - _ => {} - } - Ok(out) -} - -pub fn print_operand( - opcode: u32, - operands: &mut Operands, - id_names: &HashMap, -) -> Result> { - let mut out: Vec = Vec::new(); - match opcode { - // OpNop - 0 => {} - // OpUndef - 1 => {} - // OpSourceContinued - 2 => { - // LiteralString - out.push(print_str(operands)?); - } - // OpSource - 3 => { - // SourceLanguage - out.extend(print_enum_SourceLanguage(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - // LiteralString ? - if operands.len() != 0 { - out.push(print_str(operands)?); - } - } - // OpSourceExtension - 4 => { - // LiteralString - out.push(print_str(operands)?); - } - // OpName - 5 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralString - out.push(print_str(operands)?); - } - // OpMemberName - 6 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralString - out.push(print_str(operands)?); - } - // OpString - 7 => { - // LiteralString - out.push(print_str(operands)?); - } - // OpLine - 8 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpExtension - 10 => { - // LiteralString - out.push(print_str(operands)?); - } - // OpExtInstImport - 11 => { - // LiteralString - out.push(print_str(operands)?); - } - // OpExtInst - 12 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralExtInstInteger - out.push(print_u32(operands)?); - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpMemoryModel - 14 => { - // AddressingModel - out.extend(print_enum_AddressingModel(operands, id_names)?); - // MemoryModel - out.extend(print_enum_MemoryModel(operands, id_names)?); - } - // OpEntryPoint - 15 => { - // ExecutionModel - out.extend(print_enum_ExecutionModel(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralString - out.push(print_str(operands)?); - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpExecutionMode - 16 => { - // IdRef - out.push(print_id(operands, id_names)?); - // ExecutionMode - out.extend(print_enum_ExecutionMode(operands, id_names)?); - } - // OpCapability - 17 => { - // Capability - out.extend(print_enum_Capability(operands, id_names)?); - } - // OpTypeVoid - 19 => {} - // OpTypeBool - 20 => {} - // OpTypeInt - 21 => { - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpTypeFloat - 22 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpTypeVector - 23 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpTypeMatrix - 24 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpTypeImage - 25 => { - // IdRef - out.push(print_id(operands, id_names)?); - // Dim - out.extend(print_enum_Dim(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // ImageFormat - out.extend(print_enum_ImageFormat(operands, id_names)?); - // AccessQualifier ? - if operands.len() != 0 { - out.extend(print_enum_AccessQualifier(operands, id_names)?); - } - } - // OpTypeSampler - 26 => {} - // OpTypeSampledImage - 27 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpTypeArray - 28 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpTypeRuntimeArray - 29 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpTypeStruct - 30 => { - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpTypeOpaque - 31 => { - // LiteralString - out.push(print_str(operands)?); - } - // OpTypePointer - 32 => { - // StorageClass - out.extend(print_enum_StorageClass(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpTypeFunction - 33 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpTypeEvent - 34 => {} - // OpTypeDeviceEvent - 35 => {} - // OpTypeReserveId - 36 => {} - // OpTypeQueue - 37 => {} - // OpTypePipe - 38 => { - // AccessQualifier - out.extend(print_enum_AccessQualifier(operands, id_names)?); - } - // OpTypeForwardPointer - 39 => { - // IdRef - out.push(print_id(operands, id_names)?); - // StorageClass - out.extend(print_enum_StorageClass(operands, id_names)?); - } - // OpConstantTrue - 41 => {} - // OpConstantFalse - 42 => {} - // OpConstant - 43 => { - // LiteralContextDependentNumber - out.extend(print_list(operands)?); - } - // OpConstantComposite - 44 => { - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpConstantSampler - 45 => { - // SamplerAddressingMode - out.extend(print_enum_SamplerAddressingMode(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // SamplerFilterMode - out.extend(print_enum_SamplerFilterMode(operands, id_names)?); - } - // OpConstantNull - 46 => {} - // OpSpecConstantTrue - 48 => {} - // OpSpecConstantFalse - 49 => {} - // OpSpecConstant - 50 => { - // LiteralContextDependentNumber - out.extend(print_list(operands)?); - } - // OpSpecConstantComposite - 51 => { - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpSpecConstantOp - 52 => { - // LiteralSpecConstantOpInteger - out.push(print_u32(operands)?); - } - // OpFunction - 54 => { - // FunctionControl - out.extend(print_enum_FunctionControl(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFunctionParameter - 55 => {} - // OpFunctionEnd - 56 => {} - // OpFunctionCall - 57 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpVariable - 59 => { - // StorageClass - out.extend(print_enum_StorageClass(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpImageTexelPointer - 60 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpLoad - 61 => { - // IdRef - out.push(print_id(operands, id_names)?); - // MemoryAccess ? - if operands.len() != 0 { - out.extend(print_enum_MemoryAccess(operands, id_names)?); - } - } - // OpStore - 62 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // MemoryAccess ? - if operands.len() != 0 { - out.extend(print_enum_MemoryAccess(operands, id_names)?); - } - } - // OpCopyMemory - 63 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // MemoryAccess ? - if operands.len() != 0 { - out.extend(print_enum_MemoryAccess(operands, id_names)?); - } - // MemoryAccess ? - if operands.len() != 0 { - out.extend(print_enum_MemoryAccess(operands, id_names)?); - } - } - // OpCopyMemorySized - 64 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // MemoryAccess ? - if operands.len() != 0 { - out.extend(print_enum_MemoryAccess(operands, id_names)?); - } - // MemoryAccess ? - if operands.len() != 0 { - out.extend(print_enum_MemoryAccess(operands, id_names)?); - } - } - // OpAccessChain - 65 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpInBoundsAccessChain - 66 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpPtrAccessChain - 67 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpArrayLength - 68 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpGenericPtrMemSemantics - 69 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpInBoundsPtrAccessChain - 70 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpDecorate - 71 => { - // IdRef - out.push(print_id(operands, id_names)?); - // Decoration - out.extend(print_enum_Decoration(operands, id_names)?); - } - // OpMemberDecorate - 72 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // Decoration - out.extend(print_enum_Decoration(operands, id_names)?); - } - // OpDecorationGroup - 73 => {} - // OpGroupDecorate - 74 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGroupMemberDecorate - 75 => { - // IdRef - out.push(print_id(operands, id_names)?); - // PairIdRefLiteralInteger * - while operands.len() != 0 { - out.extend(print_pair_id_u32_list(operands, id_names)?); - } - } - // OpVectorExtractDynamic - 77 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpVectorInsertDynamic - 78 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpVectorShuffle - 79 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger * - while operands.len() != 0 { - out.push(print_u32(operands)?); - } - } - // OpCompositeConstruct - 80 => { - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpCompositeExtract - 81 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger * - while operands.len() != 0 { - out.push(print_u32(operands)?); - } - } - // OpCompositeInsert - 82 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger * - while operands.len() != 0 { - out.push(print_u32(operands)?); - } - } - // OpCopyObject - 83 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpTranspose - 84 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSampledImage - 86 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpImageSampleImplicitLod - 87 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpImageSampleExplicitLod - 88 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - // OpImageSampleDrefImplicitLod - 89 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpImageSampleDrefExplicitLod - 90 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - // OpImageSampleProjImplicitLod - 91 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpImageSampleProjExplicitLod - 92 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - // OpImageSampleProjDrefImplicitLod - 93 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpImageSampleProjDrefExplicitLod - 94 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - // OpImageFetch - 95 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpImageGather - 96 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpImageDrefGather - 97 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpImageRead - 98 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpImageWrite - 99 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpImage - 100 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpImageQueryFormat - 101 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpImageQueryOrder - 102 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpImageQuerySizeLod - 103 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpImageQuerySize - 104 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpImageQueryLod - 105 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpImageQueryLevels - 106 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpImageQuerySamples - 107 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpConvertFToU - 109 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpConvertFToS - 110 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpConvertSToF - 111 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpConvertUToF - 112 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpUConvert - 113 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSConvert - 114 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFConvert - 115 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpQuantizeToF16 - 116 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpConvertPtrToU - 117 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSatConvertSToU - 118 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSatConvertUToS - 119 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpConvertUToPtr - 120 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpPtrCastToGeneric - 121 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGenericCastToPtr - 122 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGenericCastToPtrExplicit - 123 => { - // IdRef - out.push(print_id(operands, id_names)?); - // StorageClass - out.extend(print_enum_StorageClass(operands, id_names)?); - } - // OpBitcast - 124 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSNegate - 126 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFNegate - 127 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpIAdd - 128 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFAdd - 129 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpISub - 130 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFSub - 131 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpIMul - 132 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFMul - 133 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpUDiv - 134 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSDiv - 135 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFDiv - 136 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpUMod - 137 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSRem - 138 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSMod - 139 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFRem - 140 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFMod - 141 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpVectorTimesScalar - 142 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpMatrixTimesScalar - 143 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpVectorTimesMatrix - 144 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpMatrixTimesVector - 145 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpMatrixTimesMatrix - 146 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpOuterProduct - 147 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpDot - 148 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpIAddCarry - 149 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpISubBorrow - 150 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpUMulExtended - 151 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSMulExtended - 152 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAny - 154 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAll - 155 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpIsNan - 156 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpIsInf - 157 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpIsFinite - 158 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpIsNormal - 159 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSignBitSet - 160 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpLessOrGreater - 161 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpOrdered - 162 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpUnordered - 163 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpLogicalEqual - 164 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpLogicalNotEqual - 165 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpLogicalOr - 166 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpLogicalAnd - 167 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpLogicalNot - 168 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSelect - 169 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpIEqual - 170 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpINotEqual - 171 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpUGreaterThan - 172 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSGreaterThan - 173 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpUGreaterThanEqual - 174 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSGreaterThanEqual - 175 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpULessThan - 176 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSLessThan - 177 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpULessThanEqual - 178 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSLessThanEqual - 179 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFOrdEqual - 180 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFUnordEqual - 181 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFOrdNotEqual - 182 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFUnordNotEqual - 183 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFOrdLessThan - 184 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFUnordLessThan - 185 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFOrdGreaterThan - 186 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFUnordGreaterThan - 187 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFOrdLessThanEqual - 188 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFUnordLessThanEqual - 189 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFOrdGreaterThanEqual - 190 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFUnordGreaterThanEqual - 191 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpShiftRightLogical - 194 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpShiftRightArithmetic - 195 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpShiftLeftLogical - 196 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpBitwiseOr - 197 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpBitwiseXor - 198 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpBitwiseAnd - 199 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpNot - 200 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpBitFieldInsert - 201 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpBitFieldSExtract - 202 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpBitFieldUExtract - 203 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpBitReverse - 204 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpBitCount - 205 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpDPdx - 207 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpDPdy - 208 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFwidth - 209 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpDPdxFine - 210 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpDPdyFine - 211 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFwidthFine - 212 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpDPdxCoarse - 213 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpDPdyCoarse - 214 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFwidthCoarse - 215 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpEmitVertex - 218 => {} - // OpEndPrimitive - 219 => {} - // OpEmitStreamVertex - 220 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpEndStreamPrimitive - 221 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpControlBarrier - 224 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - } - // OpMemoryBarrier - 225 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - } - // OpAtomicLoad - 227 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - } - // OpAtomicStore - 228 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAtomicExchange - 229 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAtomicCompareExchange - 230 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAtomicCompareExchangeWeak - 231 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAtomicIIncrement - 232 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - } - // OpAtomicIDecrement - 233 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - } - // OpAtomicIAdd - 234 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAtomicISub - 235 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAtomicSMin - 236 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAtomicUMin - 237 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAtomicSMax - 238 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAtomicUMax - 239 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAtomicAnd - 240 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAtomicOr - 241 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAtomicXor - 242 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpPhi - 245 => { - // PairIdRefIdRef * - while operands.len() != 0 { - out.extend(print_pair_id_id_list(operands, id_names)?); - } - } - // OpLoopMerge - 246 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LoopControl - out.extend(print_enum_LoopControl(operands, id_names)?); - } - // OpSelectionMerge - 247 => { - // IdRef - out.push(print_id(operands, id_names)?); - // SelectionControl - out.extend(print_enum_SelectionControl(operands, id_names)?); - } - // OpLabel - 248 => {} - // OpBranch - 249 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpBranchConditional - 250 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger * - while operands.len() != 0 { - out.push(print_u32(operands)?); - } - } - // OpSwitch - 251 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // PairLiteralIntegerIdRef * - while operands.len() != 0 { - out.extend(print_pair_u32_id_list(operands, id_names)?); - } - } - // OpKill - 252 => {} - // OpReturn - 253 => {} - // OpReturnValue - 254 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpUnreachable - 255 => {} - // OpLifetimeStart - 256 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpLifetimeStop - 257 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpGroupAsyncCopy - 259 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupWaitEvents - 260 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupAll - 261 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupAny - 262 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupBroadcast - 263 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupIAdd - 264 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupFAdd - 265 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupFMin - 266 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupUMin - 267 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupSMin - 268 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupFMax - 269 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupUMax - 270 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupSMax - 271 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpReadPipe - 274 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpWritePipe - 275 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpReservedReadPipe - 276 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpReservedWritePipe - 277 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpReserveReadPipePackets - 278 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpReserveWritePipePackets - 279 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpCommitReadPipe - 280 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpCommitWritePipe - 281 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpIsValidReserveId - 282 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGetNumPipePackets - 283 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGetMaxPipePackets - 284 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupReserveReadPipePackets - 285 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupReserveWritePipePackets - 286 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupCommitReadPipe - 287 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupCommitWritePipe - 288 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpEnqueueMarker - 291 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpEnqueueKernel - 292 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGetKernelNDrangeSubGroupCount - 293 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGetKernelNDrangeMaxSubGroupSize - 294 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGetKernelWorkGroupSize - 295 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGetKernelPreferredWorkGroupSizeMultiple - 296 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRetainEvent - 297 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpReleaseEvent - 298 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpCreateUserEvent - 299 => {} - // OpIsValidEvent - 300 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSetUserEventStatus - 301 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpCaptureEventProfilingInfo - 302 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGetDefaultQueue - 303 => {} - // OpBuildNDRange - 304 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpImageSparseSampleImplicitLod - 305 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpImageSparseSampleExplicitLod - 306 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - // OpImageSparseSampleDrefImplicitLod - 307 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpImageSparseSampleDrefExplicitLod - 308 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - // OpImageSparseSampleProjImplicitLod - 309 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpImageSparseSampleProjExplicitLod - 310 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - // OpImageSparseSampleProjDrefImplicitLod - 311 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpImageSparseSampleProjDrefExplicitLod - 312 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - // OpImageSparseFetch - 313 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpImageSparseGather - 314 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpImageSparseDrefGather - 315 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpImageSparseTexelsResident - 316 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpNoLine - 317 => {} - // OpAtomicFlagTestAndSet - 318 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - } - // OpAtomicFlagClear - 319 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - } - // OpImageSparseRead - 320 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpSizeOf - 321 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpTypePipeStorage - 322 => {} - // OpConstantPipeStorage - 323 => { - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpCreatePipeFromPipeStorage - 324 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGetKernelLocalSizeForSubgroupCount - 325 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGetKernelMaxNumSubgroups - 326 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpTypeNamedBarrier - 327 => {} - // OpNamedBarrierInitialize - 328 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpMemoryNamedBarrier - 329 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - } - // OpModuleProcessed - 330 => { - // LiteralString - out.push(print_str(operands)?); - } - // OpExecutionModeId - 331 => { - // IdRef - out.push(print_id(operands, id_names)?); - // ExecutionMode - out.extend(print_enum_ExecutionMode(operands, id_names)?); - } - // OpDecorateId - 332 => { - // IdRef - out.push(print_id(operands, id_names)?); - // Decoration - out.extend(print_enum_Decoration(operands, id_names)?); - } - // OpGroupNonUniformElect - 333 => { - // IdScope - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformAll - 334 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformAny - 335 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformAllEqual - 336 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformBroadcast - 337 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformBroadcastFirst - 338 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformBallot - 339 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformInverseBallot - 340 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformBallotBitExtract - 341 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformBallotBitCount - 342 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformBallotFindLSB - 343 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformBallotFindMSB - 344 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformShuffle - 345 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformShuffleXor - 346 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformShuffleUp - 347 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformShuffleDown - 348 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformIAdd - 349 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGroupNonUniformFAdd - 350 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGroupNonUniformIMul - 351 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGroupNonUniformFMul - 352 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGroupNonUniformSMin - 353 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGroupNonUniformUMin - 354 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGroupNonUniformFMin - 355 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGroupNonUniformSMax - 356 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGroupNonUniformUMax - 357 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGroupNonUniformFMax - 358 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGroupNonUniformBitwiseAnd - 359 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGroupNonUniformBitwiseOr - 360 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGroupNonUniformBitwiseXor - 361 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGroupNonUniformLogicalAnd - 362 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGroupNonUniformLogicalOr - 363 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGroupNonUniformLogicalXor - 364 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpGroupNonUniformQuadBroadcast - 365 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformQuadSwap - 366 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpCopyLogical - 400 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpPtrEqual - 401 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpPtrNotEqual - 402 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpPtrDiff - 403 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpColorAttachmentReadEXT - 4160 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpDepthAttachmentReadEXT - 4161 => { - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpStencilAttachmentReadEXT - 4162 => { - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpTerminateInvocation - 4416 => {} - // OpSubgroupBallotKHR - 4421 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupFirstInvocationKHR - 4422 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAllKHR - 4428 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAnyKHR - 4429 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAllEqualKHR - 4430 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformRotateKHR - 4431 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpSubgroupReadInvocationKHR - 4432 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpTraceRayKHR - 4445 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpExecuteCallableKHR - 4446 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpConvertUToAccelerationStructureKHR - 4447 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpIgnoreIntersectionKHR - 4448 => {} - // OpTerminateRayKHR - 4449 => {} - // OpSDotKHR - 4450 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // PackedVectorFormat ? - if operands.len() != 0 { - out.extend(print_enum_PackedVectorFormat(operands, id_names)?); - } - } - // OpUDotKHR - 4451 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // PackedVectorFormat ? - if operands.len() != 0 { - out.extend(print_enum_PackedVectorFormat(operands, id_names)?); - } - } - // OpSUDotKHR - 4452 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // PackedVectorFormat ? - if operands.len() != 0 { - out.extend(print_enum_PackedVectorFormat(operands, id_names)?); - } - } - // OpSDotAccSatKHR - 4453 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // PackedVectorFormat ? - if operands.len() != 0 { - out.extend(print_enum_PackedVectorFormat(operands, id_names)?); - } - } - // OpUDotAccSatKHR - 4454 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // PackedVectorFormat ? - if operands.len() != 0 { - out.extend(print_enum_PackedVectorFormat(operands, id_names)?); - } - } - // OpSUDotAccSatKHR - 4455 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // PackedVectorFormat ? - if operands.len() != 0 { - out.extend(print_enum_PackedVectorFormat(operands, id_names)?); - } - } - // OpTypeCooperativeMatrixKHR - 4456 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpCooperativeMatrixLoadKHR - 4457 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - // MemoryAccess ? - if operands.len() != 0 { - out.extend(print_enum_MemoryAccess(operands, id_names)?); - } - } - // OpCooperativeMatrixStoreKHR - 4458 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - // MemoryAccess ? - if operands.len() != 0 { - out.extend(print_enum_MemoryAccess(operands, id_names)?); - } - } - // OpCooperativeMatrixMulAddKHR - 4459 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // CooperativeMatrixOperands ? - if operands.len() != 0 { - out.extend(print_enum_CooperativeMatrixOperands(operands, id_names)?); - } - } - // OpCooperativeMatrixLengthKHR - 4460 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpTypeRayQueryKHR - 4472 => {} - // OpRayQueryInitializeKHR - 4473 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryTerminateKHR - 4474 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGenerateIntersectionKHR - 4475 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryConfirmIntersectionKHR - 4476 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryProceedKHR - 4477 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetIntersectionTypeKHR - 4479 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpImageSampleWeightedQCOM - 4480 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpImageBoxFilterQCOM - 4481 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpImageBlockMatchSSDQCOM - 4482 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpImageBlockMatchSADQCOM - 4483 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupIAddNonUniformAMD - 5000 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupFAddNonUniformAMD - 5001 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupFMinNonUniformAMD - 5002 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupUMinNonUniformAMD - 5003 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupSMinNonUniformAMD - 5004 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupFMaxNonUniformAMD - 5005 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupUMaxNonUniformAMD - 5006 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupSMaxNonUniformAMD - 5007 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFragmentMaskFetchAMD - 5011 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFragmentFetchAMD - 5012 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpReadClockKHR - 5056 => { - // IdScope - out.push(print_id(operands, id_names)?); - } - // OpFinalizeNodePayloadsAMDX - 5075 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFinishWritingNodePayloadAMDX - 5078 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpInitializeNodePayloadsAMDX - 5090 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectRecordHitMotionNV - 5249 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectRecordHitWithIndexMotionNV - 5250 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectRecordMissMotionNV - 5251 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectGetWorldToObjectNV - 5252 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectGetObjectToWorldNV - 5253 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectGetObjectRayDirectionNV - 5254 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectGetObjectRayOriginNV - 5255 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectTraceRayMotionNV - 5256 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectGetShaderRecordBufferHandleNV - 5257 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectGetShaderBindingTableRecordIndexNV - 5258 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectRecordEmptyNV - 5259 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectTraceRayNV - 5260 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectRecordHitNV - 5261 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectRecordHitWithIndexNV - 5262 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectRecordMissNV - 5263 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectExecuteShaderNV - 5264 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectGetCurrentTimeNV - 5265 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectGetAttributesNV - 5266 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectGetHitKindNV - 5267 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectGetPrimitiveIndexNV - 5268 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectGetGeometryIndexNV - 5269 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectGetInstanceIdNV - 5270 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectGetInstanceCustomIndexNV - 5271 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectGetWorldRayDirectionNV - 5272 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectGetWorldRayOriginNV - 5273 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectGetRayTMaxNV - 5274 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectGetRayTMinNV - 5275 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectIsEmptyNV - 5276 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectIsHitNV - 5277 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpHitObjectIsMissNV - 5278 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpReorderThreadWithHitObjectNV - 5279 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpReorderThreadWithHintNV - 5280 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpTypeHitObjectNV - 5281 => {} - // OpImageSampleFootprintNV - 5283 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // ImageOperands ? - if operands.len() != 0 { - out.extend(print_enum_ImageOperands(operands, id_names)?); - } - } - // OpEmitMeshTasksEXT - 5294 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpSetMeshOutputsEXT - 5295 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupNonUniformPartitionNV - 5296 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpWritePackedPrimitiveIndices4x8NV - 5299 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFetchMicroTriangleVertexPositionNV - 5300 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFetchMicroTriangleVertexBarycentricNV - 5301 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpReportIntersectionKHR - 5334 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpIgnoreIntersectionNV - 5335 => {} - // OpTerminateRayNV - 5336 => {} - // OpTraceNV - 5337 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpTraceMotionNV - 5338 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpTraceRayMotionNV - 5339 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetIntersectionTriangleVertexPositionsKHR - 5340 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpTypeAccelerationStructureKHR - 5341 => {} - // OpExecuteCallableNV - 5344 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpTypeCooperativeMatrixNV - 5358 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpCooperativeMatrixLoadNV - 5359 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // MemoryAccess ? - if operands.len() != 0 { - out.extend(print_enum_MemoryAccess(operands, id_names)?); - } - } - // OpCooperativeMatrixStoreNV - 5360 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // MemoryAccess ? - if operands.len() != 0 { - out.extend(print_enum_MemoryAccess(operands, id_names)?); - } - } - // OpCooperativeMatrixMulAddNV - 5361 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpCooperativeMatrixLengthNV - 5362 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpBeginInvocationInterlockEXT - 5364 => {} - // OpEndInvocationInterlockEXT - 5365 => {} - // OpDemoteToHelperInvocationEXT - 5380 => {} - // OpIsHelperInvocationEXT - 5381 => {} - // OpConvertUToImageNV - 5391 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpConvertUToSamplerNV - 5392 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpConvertImageToUNV - 5393 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpConvertSamplerToUNV - 5394 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpConvertUToSampledImageNV - 5395 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpConvertSampledImageToUNV - 5396 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSamplerImageAddressingModeNV - 5397 => { - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpSubgroupShuffleINTEL - 5571 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupShuffleDownINTEL - 5572 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupShuffleUpINTEL - 5573 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupShuffleXorINTEL - 5574 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupBlockReadINTEL - 5575 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupBlockWriteINTEL - 5576 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupImageBlockReadINTEL - 5577 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupImageBlockWriteINTEL - 5578 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupImageMediaBlockReadINTEL - 5580 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupImageMediaBlockWriteINTEL - 5581 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpUCountLeadingZerosINTEL - 5585 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpUCountTrailingZerosINTEL - 5586 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAbsISubINTEL - 5587 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAbsUSubINTEL - 5588 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpIAddSatINTEL - 5589 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpUAddSatINTEL - 5590 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpIAverageINTEL - 5591 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpUAverageINTEL - 5592 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpIAverageRoundedINTEL - 5593 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpUAverageRoundedINTEL - 5594 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpISubSatINTEL - 5595 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpUSubSatINTEL - 5596 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpIMul32x16INTEL - 5597 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpUMul32x16INTEL - 5598 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpConstantFunctionPointerINTEL - 5600 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFunctionPointerCallINTEL - 5601 => { - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpAsmTargetINTEL - 5609 => { - // LiteralString - out.push(print_str(operands)?); - } - // OpAsmINTEL - 5610 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralString - out.push(print_str(operands)?); - // LiteralString - out.push(print_str(operands)?); - } - // OpAsmCallINTEL - 5611 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpAtomicFMinEXT - 5614 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAtomicFMaxEXT - 5615 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAssumeTrueKHR - 5630 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpExpectKHR - 5631 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpDecorateStringGOOGLE - 5632 => { - // IdRef - out.push(print_id(operands, id_names)?); - // Decoration - out.extend(print_enum_Decoration(operands, id_names)?); - } - // OpMemberDecorateStringGOOGLE - 5633 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // Decoration - out.extend(print_enum_Decoration(operands, id_names)?); - } - // OpVmeImageINTEL - 5699 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpTypeVmeImageINTEL - 5700 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpTypeAvcImePayloadINTEL - 5701 => {} - // OpTypeAvcRefPayloadINTEL - 5702 => {} - // OpTypeAvcSicPayloadINTEL - 5703 => {} - // OpTypeAvcMcePayloadINTEL - 5704 => {} - // OpTypeAvcMceResultINTEL - 5705 => {} - // OpTypeAvcImeResultINTEL - 5706 => {} - // OpTypeAvcImeResultSingleReferenceStreamoutINTEL - 5707 => {} - // OpTypeAvcImeResultDualReferenceStreamoutINTEL - 5708 => {} - // OpTypeAvcImeSingleReferenceStreaminINTEL - 5709 => {} - // OpTypeAvcImeDualReferenceStreaminINTEL - 5710 => {} - // OpTypeAvcRefResultINTEL - 5711 => {} - // OpTypeAvcSicResultINTEL - 5712 => {} - // OpSubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL - 5713 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL - 5714 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceGetDefaultInterShapePenaltyINTEL - 5715 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceSetInterShapePenaltyINTEL - 5716 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL - 5717 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceSetInterDirectionPenaltyINTEL - 5718 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL - 5719 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL - 5720 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL - 5721 => {} - // OpSubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL - 5722 => {} - // OpSubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL - 5723 => {} - // OpSubgroupAvcMceSetMotionVectorCostFunctionINTEL - 5724 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL - 5725 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL - 5726 => {} - // OpSubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL - 5727 => {} - // OpSubgroupAvcMceSetAcOnlyHaarINTEL - 5728 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL - 5729 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL - 5730 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL - 5731 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceConvertToImePayloadINTEL - 5732 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceConvertToImeResultINTEL - 5733 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceConvertToRefPayloadINTEL - 5734 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceConvertToRefResultINTEL - 5735 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceConvertToSicPayloadINTEL - 5736 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceConvertToSicResultINTEL - 5737 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceGetMotionVectorsINTEL - 5738 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceGetInterDistortionsINTEL - 5739 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceGetBestInterDistortionsINTEL - 5740 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceGetInterMajorShapeINTEL - 5741 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceGetInterMinorShapeINTEL - 5742 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceGetInterDirectionsINTEL - 5743 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceGetInterMotionVectorCountINTEL - 5744 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceGetInterReferenceIdsINTEL - 5745 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL - 5746 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeInitializeINTEL - 5747 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeSetSingleReferenceINTEL - 5748 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeSetDualReferenceINTEL - 5749 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeRefWindowSizeINTEL - 5750 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeAdjustRefOffsetINTEL - 5751 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeConvertToMcePayloadINTEL - 5752 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeSetMaxMotionVectorCountINTEL - 5753 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeSetUnidirectionalMixDisableINTEL - 5754 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeSetEarlySearchTerminationThresholdINTEL - 5755 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeSetWeightedSadINTEL - 5756 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeEvaluateWithSingleReferenceINTEL - 5757 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeEvaluateWithDualReferenceINTEL - 5758 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL - 5759 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL - 5760 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL - 5761 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL - 5762 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL - 5763 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL - 5764 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeConvertToMceResultINTEL - 5765 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeGetSingleReferenceStreaminINTEL - 5766 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeGetDualReferenceStreaminINTEL - 5767 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeStripSingleReferenceStreamoutINTEL - 5768 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeStripDualReferenceStreamoutINTEL - 5769 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL - 5770 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL - 5771 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL - 5772 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL - 5773 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL - 5774 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL - 5775 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeGetBorderReachedINTEL - 5776 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeGetTruncatedSearchIndicationINTEL - 5777 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL - 5778 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL - 5779 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL - 5780 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcFmeInitializeINTEL - 5781 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcBmeInitializeINTEL - 5782 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcRefConvertToMcePayloadINTEL - 5783 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcRefSetBidirectionalMixDisableINTEL - 5784 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcRefSetBilinearFilterEnableINTEL - 5785 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcRefEvaluateWithSingleReferenceINTEL - 5786 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcRefEvaluateWithDualReferenceINTEL - 5787 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcRefEvaluateWithMultiReferenceINTEL - 5788 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL - 5789 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcRefConvertToMceResultINTEL - 5790 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicInitializeINTEL - 5791 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicConfigureSkcINTEL - 5792 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicConfigureIpeLumaINTEL - 5793 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicConfigureIpeLumaChromaINTEL - 5794 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicGetMotionVectorMaskINTEL - 5795 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicConvertToMcePayloadINTEL - 5796 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicSetIntraLumaShapePenaltyINTEL - 5797 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicSetIntraLumaModeCostFunctionINTEL - 5798 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicSetIntraChromaModeCostFunctionINTEL - 5799 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicSetBilinearFilterEnableINTEL - 5800 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicSetSkcForwardTransformEnableINTEL - 5801 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicSetBlockBasedRawSkipSadINTEL - 5802 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicEvaluateIpeINTEL - 5803 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicEvaluateWithSingleReferenceINTEL - 5804 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicEvaluateWithDualReferenceINTEL - 5805 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicEvaluateWithMultiReferenceINTEL - 5806 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL - 5807 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicConvertToMceResultINTEL - 5808 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicGetIpeLumaShapeINTEL - 5809 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicGetBestIpeLumaDistortionINTEL - 5810 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicGetBestIpeChromaDistortionINTEL - 5811 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicGetPackedIpeLumaModesINTEL - 5812 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicGetIpeChromaModeINTEL - 5813 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL - 5814 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL - 5815 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSubgroupAvcSicGetInterRawSadsINTEL - 5816 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpVariableLengthArrayINTEL - 5818 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpSaveMemoryINTEL - 5819 => {} - // OpRestoreMemoryINTEL - 5820 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpArbitraryFloatSinCosPiINTEL - 5840 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatCastINTEL - 5841 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatCastFromIntINTEL - 5842 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatCastToIntINTEL - 5843 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatAddINTEL - 5846 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatSubINTEL - 5847 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatMulINTEL - 5848 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatDivINTEL - 5849 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatGTINTEL - 5850 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatGEINTEL - 5851 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatLTINTEL - 5852 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatLEINTEL - 5853 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatEQINTEL - 5854 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatRecipINTEL - 5855 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatRSqrtINTEL - 5856 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatCbrtINTEL - 5857 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatHypotINTEL - 5858 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatSqrtINTEL - 5859 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatLogINTEL - 5860 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatLog2INTEL - 5861 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatLog10INTEL - 5862 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatLog1pINTEL - 5863 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatExpINTEL - 5864 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatExp2INTEL - 5865 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatExp10INTEL - 5866 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatExpm1INTEL - 5867 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatSinINTEL - 5868 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatCosINTEL - 5869 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatSinCosINTEL - 5870 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatSinPiINTEL - 5871 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatCosPiINTEL - 5872 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatASinINTEL - 5873 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatASinPiINTEL - 5874 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatACosINTEL - 5875 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatACosPiINTEL - 5876 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatATanINTEL - 5877 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatATanPiINTEL - 5878 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatATan2INTEL - 5879 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatPowINTEL - 5880 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatPowRINTEL - 5881 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpArbitraryFloatPowNINTEL - 5882 => { - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpLoopControlINTEL - 5887 => { - // LiteralInteger * - while operands.len() != 0 { - out.push(print_u32(operands)?); - } - } - // OpAliasDomainDeclINTEL - 5911 => { - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpAliasScopeDeclINTEL - 5912 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef ? - if operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpAliasScopeListDeclINTEL - 5913 => { - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpFixedSqrtINTEL - 5923 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpFixedRecipINTEL - 5924 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpFixedRsqrtINTEL - 5925 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpFixedSinINTEL - 5926 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpFixedCosINTEL - 5927 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpFixedSinCosINTEL - 5928 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpFixedSinPiINTEL - 5929 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpFixedCosPiINTEL - 5930 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpFixedSinCosPiINTEL - 5931 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpFixedLogINTEL - 5932 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpFixedExpINTEL - 5933 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - // LiteralInteger - out.push(print_u32(operands)?); - } - // OpPtrCastToCrossWorkgroupINTEL - 5934 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpCrossWorkgroupCastToPtrINTEL - 5938 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpReadPipeBlockingINTEL - 5946 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpWritePipeBlockingINTEL - 5947 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpFPGARegINTEL - 5949 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetRayTMinKHR - 6016 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetRayFlagsKHR - 6017 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetIntersectionTKHR - 6018 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetIntersectionInstanceCustomIndexKHR - 6019 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetIntersectionInstanceIdKHR - 6020 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR - 6021 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetIntersectionGeometryIndexKHR - 6022 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetIntersectionPrimitiveIndexKHR - 6023 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetIntersectionBarycentricsKHR - 6024 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetIntersectionFrontFaceKHR - 6025 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetIntersectionCandidateAABBOpaqueKHR - 6026 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetIntersectionObjectRayDirectionKHR - 6027 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetIntersectionObjectRayOriginKHR - 6028 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetWorldRayDirectionKHR - 6029 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetWorldRayOriginKHR - 6030 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetIntersectionObjectToWorldKHR - 6031 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpRayQueryGetIntersectionWorldToObjectKHR - 6032 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpAtomicFAddEXT - 6035 => { - // IdRef - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpTypeBufferSurfaceINTEL - 6086 => { - // AccessQualifier - out.extend(print_enum_AccessQualifier(operands, id_names)?); - } - // OpTypeStructContinuedINTEL - 6090 => { - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpConstantCompositeContinuedINTEL - 6091 => { - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpSpecConstantCompositeContinuedINTEL - 6092 => { - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpCompositeConstructContinuedINTEL - 6096 => { - // IdRef * - while operands.len() != 0 { - out.push(print_id(operands, id_names)?); - } - } - // OpConvertFToBF16INTEL - 6116 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpConvertBF16ToFINTEL - 6117 => { - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpControlBarrierArriveINTEL - 6142 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - } - // OpControlBarrierWaitINTEL - 6143 => { - // IdScope - out.push(print_id(operands, id_names)?); - // IdScope - out.push(print_id(operands, id_names)?); - // IdMemorySemantics - out.push(print_id(operands, id_names)?); - } - // OpGroupIMulKHR - 6401 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupFMulKHR - 6402 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupBitwiseAndKHR - 6403 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupBitwiseOrKHR - 6404 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupBitwiseXorKHR - 6405 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupLogicalAndKHR - 6406 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupLogicalOrKHR - 6407 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - // OpGroupLogicalXorKHR - 6408 => { - // IdScope - out.push(print_id(operands, id_names)?); - // GroupOperation - out.extend(print_enum_GroupOperation(operands, id_names)?); - // IdRef - out.push(print_id(operands, id_names)?); - } - _ => bail!("unsupported opcode {}", opcode), - }; - while operands.len() != 0 { - out.push(format!("!{}", operands.read_u32()?)); - } - Ok(out) -} diff --git a/spirq-spvasm/src/lib.rs b/spirq-spvasm/src/lib.rs deleted file mode 100644 index 0eb3024..0000000 --- a/spirq-spvasm/src/lib.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub mod asm; -pub mod dis; -mod generated; -#[cfg(test)] -mod test; - -pub use crate::asm::Assembler; -pub use crate::dis::Disassembler; -pub use spirq_core::parse::{SpirvBinary, SpirvHeader}; diff --git a/spirq-spvasm/src/test.rs b/spirq-spvasm/src/test.rs deleted file mode 100644 index aa33261..0000000 --- a/spirq-spvasm/src/test.rs +++ /dev/null @@ -1,63 +0,0 @@ -use pretty_assertions::assert_eq; -use spirq::spirv; -use spirq_core::parse::bin::SpirvHeader; - -use crate::asm::Assembler; -use crate::dis::Disassembler; - -#[test] -fn test_asm_dis_roundtrip() { - let code = r#" -; SPIR-V -; Version: SPIRV_VERSION -; Generator: 0; 0 -; Bound: 13 -; Schema: 0 -%void = OpTypeVoid -%void_0 = OpTypeVoid -%void_1 = OpTypeVoid -%void_2 = OpTypeVoid -%void_3 = OpTypeVoid -%void_4 = OpTypeVoid -%void_5 = OpTypeVoid -%void_6 = OpTypeVoid -%void_7 = OpTypeVoid -%void_8 = OpTypeVoid -%void_9 = OpTypeVoid -%void_10 = OpTypeVoid -"# - .trim_start(); - let code = code.replace( - "SPIRV_VERSION", - &format!("{}.{}", spirv::MAJOR_VERSION, spirv::MINOR_VERSION), - ); - let header = SpirvHeader::default(); - let spv = Assembler::new().assemble(&code, header).unwrap(); - let spvasm = Disassembler::new() - .name_type_ids(true) - .disassemble(&spv.into()) - .unwrap(); - assert_eq!(code, spvasm); -} - -#[test] -fn test_gallery_roundtrip() { - let code = include_str!("../../assets/gallery.frag.spvasm") - .lines() - // (penguinliong) For some reason our reassembled SPIR-V use less IDs - // than the GLSLang output. Workaround here. - .skip(5) - .map(|x| x.trim().to_owned() + "\n") - .collect::>() - .concat(); - let header = SpirvHeader::new(0x00010500, 0x0008000b); - let spv = Assembler::new().assemble(&code, header).unwrap(); - let spvasm = Disassembler::new() - .print_header(false) - .name_ids(true) - .name_type_ids(true) - .name_const_ids(true) - .disassemble(&spv.into()) - .unwrap(); - assert_eq!(code, spvasm); -} diff --git a/spirq/Cargo.toml b/spirq/Cargo.toml index acf7c40..b0bb644 100644 --- a/spirq/Cargo.toml +++ b/spirq/Cargo.toml @@ -18,13 +18,13 @@ maintenance = { status = "actively-developed" } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -spirq-core = { version = "1.0.4", path = "../spirq-core" } +spq-core = "1.0.4" num-traits = "0.2" num-derive = "0.4" fnv = "1.0.7" -ordered-float = "3.4.0" +ordered-float = "4.2" [dev-dependencies] bytes = "1.2" byteorder = "1.3" -inline-spirv = "0.1" +inline-spirv = "0.2" diff --git a/spirq/README.md b/spirq/README.md index 886f338..68a40ab 100644 --- a/spirq/README.md +++ b/spirq/README.md @@ -3,7 +3,7 @@ [![Crate](https://img.shields.io/crates/v/spirq)](https://crates.io/crates/spirq) [![Documentation](https://docs.rs/spirq/badge.svg)](https://docs.rs/spirq) -SPIR-Q is a light weight library for SPIR-V pipeline metadata query, supporting upto SPIR-V 1.5 specification aligned with Vulkan 1.2. +SPIR-Q is a light weight library for SPIR-V pipeline metadata query, supporting upto SPIR-V 1.5 specification aligned with Vulkan 1.3. ## Why SPIR-Q? diff --git a/spirq/src/instr.rs b/spirq/src/instr.rs index 586eb52..f2c2b5c 100644 --- a/spirq/src/instr.rs +++ b/spirq/src/instr.rs @@ -1,4 +1,4 @@ -use spirq_core::error::anyhow; +use spq_core::error::anyhow; use std::convert::TryFrom; use crate::{parse::Instr, spirv::*}; @@ -32,8 +32,8 @@ macro_rules! define_ops { _ph: ::std::marker::PhantomData<&'a ()>, } impl<'a> TryFrom<&'a Instr> for $opcode<'a> { - type Error = ::spirq_core::error::Error; - fn try_from(instr: &'a Instr) -> ::spirq_core::error::Result { + type Error = ::spq_core::error::Error; + fn try_from(instr: &'a Instr) -> ::spq_core::error::Result { let mut operands = instr.operands(); let op = $opcode { $( $field: define_ops!($read_fn: $type: operands), )+ diff --git a/spirq/src/lib.rs b/spirq/src/lib.rs index 2925d30..791d093 100644 --- a/spirq/src/lib.rs +++ b/spirq/src/lib.rs @@ -68,15 +68,15 @@ pub mod reflect_cfg; #[cfg(test)] mod tests; -pub use spirq_core::annotation; -pub use spirq_core::constant; -pub use spirq_core::error; -pub use spirq_core::evaluator; -pub use spirq_core::func; -pub use spirq_core::parse; -pub use spirq_core::spirv; -pub use spirq_core::ty; -pub use spirq_core::var; +pub use spq_core::annotation; +pub use spq_core::constant; +pub use spq_core::error; +pub use spq_core::evaluator; +pub use spq_core::func; +pub use spq_core::parse; +pub use spq_core::spirv; +pub use spq_core::ty; +pub use spq_core::var; pub use reflect_cfg::ReflectConfig; diff --git a/spirq/src/reflect.rs b/spirq/src/reflect.rs index 694da9f..1b0403c 100644 --- a/spirq/src/reflect.rs +++ b/spirq/src/reflect.rs @@ -3,7 +3,7 @@ use std::collections::BTreeMap; use std::convert::TryFrom; use fnv::{FnvHashMap as HashMap, FnvHashSet as HashSet}; -use spirq_core::parse::Instrs; +use spq_core::parse::Instrs; use crate::{ annotation::{DecorationRegistry, NameRegistry},