Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Regenerate on sdk-1.3.296.0 #251

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Publish
on:
push:
tags:
- '**'
paths: "**/Cargo.toml"

concurrency:
Expand Down
1 change: 0 additions & 1 deletion autogen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ authors = [
"Lei Zhang <[email protected]>",
]
edition = "2018"
rust-version = "1.58"

publish = false

Expand Down
2 changes: 1 addition & 1 deletion autogen/external/SPIRV-Headers
Submodule SPIRV-Headers updated 47 files
+10 −0 .github/dependabot.yml
+7 −7 .github/workflows/presubmit.yml
+6 −0 BUILD.bazel
+2 −1 BUILD.gn
+8 −6 CMakeLists.txt
+79 −1 LICENSE
+1 −1 README.md
+17 −11 include/spirv/spir-v.xml
+1 −1 include/spirv/unified1/AMD_gcn_shader.h
+1 −1 include/spirv/unified1/AMD_shader_ballot.h
+1 −1 include/spirv/unified1/AMD_shader_explicit_vertex_parameter.h
+1 −1 include/spirv/unified1/AMD_shader_trinary_minmax.h
+1 −1 include/spirv/unified1/DebugInfo.h
+1 −1 include/spirv/unified1/GLSL.std.450.h
+3 −2 include/spirv/unified1/NonSemanticClspvReflection.h
+1 −1 include/spirv/unified1/NonSemanticDebugBreak.h
+1 −1 include/spirv/unified1/NonSemanticDebugPrintf.h
+1 −1 include/spirv/unified1/NonSemanticShaderDebugInfo100.h
+57 −0 include/spirv/unified1/NonSemanticVkspReflection.h
+1 −1 include/spirv/unified1/OpenCL.std.h
+1 −1 include/spirv/unified1/OpenCLDebugInfo100.h
+1 −1 include/spirv/unified1/extinst.debuginfo.grammar.json
+1 −1 include/spirv/unified1/extinst.glsl.std.450.grammar.json
+11 −1 include/spirv/unified1/extinst.nonsemantic.clspvreflection.grammar.json
+1 −1 include/spirv/unified1/extinst.nonsemantic.shader.debuginfo.100.grammar.json
+138 −0 include/spirv/unified1/extinst.nonsemantic.vkspreflection.grammar.json
+1 −1 include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json
+1 −1 include/spirv/unified1/extinst.opencl.std.100.grammar.json
+141 −7 include/spirv/unified1/spirv.bf
+806 −247 include/spirv/unified1/spirv.core.grammar.json
+141 −7 include/spirv/unified1/spirv.cs
+1,913 −9 include/spirv/unified1/spirv.h
+1,917 −9 include/spirv/unified1/spirv.hpp
+1,917 −9 include/spirv/unified1/spirv.hpp11
+96 −14 include/spirv/unified1/spirv.json
+137 −7 include/spirv/unified1/spirv.lua
+86 −7 include/spirv/unified1/spirv.py
+141 −7 include/spirv/unified1/spv.d
+4 −4 tests/CMakeLists.txt
+1 −1 tests/example.cpp
+2 −2 tools/buildHeaders/bin/generate_language_headers.py
+1 −0 tools/buildHeaders/bin/makeExtinstHeaders.py
+89 −51 tools/buildHeaders/header.cpp
+1 −1 tools/buildHeaders/header.h
+81 −5 tools/buildHeaders/jsonToSpirv.cpp
+5 −2 tools/buildHeaders/jsonToSpirv.h
+1 −1 tools/buildHeaders/main.cpp
4 changes: 2 additions & 2 deletions autogen/src/dr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ pub fn gen_dr_operand_kinds(grammar: &[structs::OperandKind]) -> TokenStream {
let mut seen_discriminator = BTreeMap::new();

for e in enumerators {
if seen_discriminator.get(&e.value).is_none() {
if let std::collections::btree_map::Entry::Vacant(seen_entry) = seen_discriminator.entry(e.value) {
let name = match category {
structs::Category::BitEnum => {
use heck::ShoutySnakeCase;
Expand All @@ -412,7 +412,7 @@ pub fn gen_dr_operand_kinds(grammar: &[structs::OperandKind]) -> TokenStream {
_ => panic!("Unexpected operand type"),
};

seen_discriminator.insert(e.value, name.clone());
seen_entry.insert(name.clone());

capability_clauses
.entry(&e.capabilities)
Expand Down
27 changes: 17 additions & 10 deletions autogen/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,20 @@ fn generate_enum(
.iter()
.map(|(number, name)| quote! { #name = #number });

// Each item is a tuple indicating an inclusive range as opposed to an exclusive range like is
// common.
let mut number_runs = vec![(variants[0].0, variants[0].0)];
for &(number, _) in variants.iter().skip(1) {
let last_run = number_runs.last_mut().unwrap();
match number.cmp(&(last_run.1 + 1)) {
Ordering::Equal => last_run.1 = number,
Ordering::Greater => number_runs.push((number, number)),
Ordering::Less => unreachable!("Variants not sorted by discriminant"),
// Each item is a tuple indicating an inclusive range as opposed to an exclusive range like
// is common.
let mut number_runs = Vec::<(u32, u32)>::new();
for &(number, _) in variants.iter() {
if let Some(last_run) = number_runs.last_mut() {
match number.cmp(&(last_run.1 + 1)) {
Ordering::Equal => last_run.1 = number,
Ordering::Greater => number_runs.push((number, number)),
Ordering::Less => unreachable!("Variants not sorted by discriminant"),
}
} else {
number_runs.push((number, number));
}
}

// We try to check if the given number is within a run of valid discriminants and if so
// transmute the number directly to the enum type.
let from_prim = number_runs
Expand All @@ -77,11 +79,16 @@ fn generate_enum(
})
.collect::<Vec<_>>();

// At least one variant is required for repr(u32). Generate a Max member like Spirv-Headers
// tooling does.
let empty_enum = variants.is_empty().then_some(quote!(Max = 0x7fffffff));

let attribute = value_enum_attribute();
quote! {
#[doc = #comment]
#attribute
pub enum #enum_name {
#empty_enum
#(#enumerants),*
}

Expand Down
2 changes: 1 addition & 1 deletion rspirv/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rspirv"
version = "0.12.0+sdk-1.3.268.0"
version = "0.12.0+sdk-1.3.275.0"
authors = ["Lei Zhang <[email protected]>"]
edition = "2018"

Expand Down
5 changes: 4 additions & 1 deletion rspirv/binary/assemble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ impl Assemble for dr::Operand {
Self::InitializationModeQualifier(v) => result.push(v as u32),
Self::LoadCacheControl(v) => result.push(v as u32),
Self::StoreCacheControl(v) => result.push(v as u32),
Self::RawAccessChainOperands(v) => result.push(v.bits()),
Self::NamedMaximumNumberOfRegisters(v) => result.push(v as u32),
Self::FPEncoding(v) => result.push(v as u32),
}
}
}
Expand Down Expand Up @@ -321,7 +324,7 @@ mod tests {
fn test_assemble_function_parameters() {
let mut b = dr::Builder::new();
b.memory_model(spirv::AddressingModel::Logical, spirv::MemoryModel::Simple);
let float = b.type_float(32);
let float = b.type_float(32, None);
let ptr = b.type_pointer(None, spirv::StorageClass::Function, float);
let fff = b.type_function(float, vec![float, float]);
b.begin_function(float, None, spirv::FunctionControl::CONST, fff)
Expand Down
31 changes: 31 additions & 0 deletions rspirv/binary/autogen_decode_operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ impl<'a> Decoder<'a> {
Err(Error::StreamExpected(self.offset))
}
}
#[doc = "Decodes and returns the next SPIR-V word as\na SPIR-V RawAccessChainOperands value."]
pub fn raw_access_chain_operands(&mut self) -> Result<spirv::RawAccessChainOperands> {
if let Ok(word) = self.word() {
spirv::RawAccessChainOperands::from_bits(word).ok_or(
Error::RawAccessChainOperandsUnknown(self.offset - WORD_NUM_BYTES, word),
)
} else {
Err(Error::StreamExpected(self.offset))
}
}
#[doc = "Decodes and returns the next SPIR-V word as\na SPIR-V SourceLanguage value."]
pub fn source_language(&mut self) -> Result<spirv::SourceLanguage> {
if let Ok(word) = self.word() {
Expand Down Expand Up @@ -505,4 +515,25 @@ impl<'a> Decoder<'a> {
Err(Error::StreamExpected(self.offset))
}
}
#[doc = "Decodes and returns the next SPIR-V word as\na SPIR-V NamedMaximumNumberOfRegisters value."]
pub fn named_maximum_number_of_registers(
&mut self,
) -> Result<spirv::NamedMaximumNumberOfRegisters> {
if let Ok(word) = self.word() {
spirv::NamedMaximumNumberOfRegisters::from_u32(word).ok_or(
Error::NamedMaximumNumberOfRegistersUnknown(self.offset - WORD_NUM_BYTES, word),
)
} else {
Err(Error::StreamExpected(self.offset))
}
}
#[doc = "Decodes and returns the next SPIR-V word as\na SPIR-V FPEncoding value."]
pub fn fp_encoding(&mut self) -> Result<spirv::FPEncoding> {
if let Ok(word) = self.word() {
spirv::FPEncoding::from_u32(word)
.ok_or(Error::FPEncodingUnknown(self.offset - WORD_NUM_BYTES, word))
} else {
Err(Error::StreamExpected(self.offset))
}
}
}
24 changes: 24 additions & 0 deletions rspirv/binary/autogen_disas_operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,21 @@ impl Disassemble for spirv::FPFastMathMode {
if self.contains(spirv::FPFastMathMode::FAST) {
bits.push("Fast")
}
if self.contains(spirv::FPFastMathMode::ALLOW_CONTRACT) {
bits.push("AllowContract")
}
if self.contains(spirv::FPFastMathMode::ALLOW_CONTRACT_FAST_INTEL) {
bits.push("AllowContractFastINTEL")
}
if self.contains(spirv::FPFastMathMode::ALLOW_REASSOC) {
bits.push("AllowReassoc")
}
if self.contains(spirv::FPFastMathMode::ALLOW_REASSOC_INTEL) {
bits.push("AllowReassocINTEL")
}
if self.contains(spirv::FPFastMathMode::ALLOW_TRANSFORM) {
bits.push("AllowTransform")
}
bits.join("|")
}
}
Expand Down Expand Up @@ -383,6 +392,21 @@ impl Disassemble for spirv::FragmentShadingRate {
bits.join("|")
}
}
impl Disassemble for spirv::RawAccessChainOperands {
fn disassemble(&self) -> String {
if self.is_empty() {
return "None".to_string();
}
let mut bits = vec![];
if self.contains(spirv::RawAccessChainOperands::ROBUSTNESS_PER_COMPONENT_NV) {
bits.push("RobustnessPerComponentNV")
}
if self.contains(spirv::RawAccessChainOperands::ROBUSTNESS_PER_ELEMENT_NV) {
bits.push("RobustnessPerElementNV")
}
bits.join("|")
}
}
impl Disassemble for spirv::CooperativeMatrixOperands {
fn disassemble(&self) -> String {
if self.is_empty() {
Expand Down
18 changes: 18 additions & 0 deletions rspirv/binary/autogen_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub enum Error {
KernelProfilingInfoUnknown(usize, spirv::Word),
RayFlagsUnknown(usize, spirv::Word),
FragmentShadingRateUnknown(usize, spirv::Word),
RawAccessChainOperandsUnknown(usize, spirv::Word),
SourceLanguageUnknown(usize, spirv::Word),
ExecutionModelUnknown(usize, spirv::Word),
AddressingModelUnknown(usize, spirv::Word),
Expand Down Expand Up @@ -56,6 +57,8 @@ pub enum Error {
InitializationModeQualifierUnknown(usize, spirv::Word),
LoadCacheControlUnknown(usize, spirv::Word),
StoreCacheControlUnknown(usize, spirv::Word),
NamedMaximumNumberOfRegistersUnknown(usize, spirv::Word),
FPEncodingUnknown(usize, spirv::Word),
#[doc = r"Failed to decode a string."]
#[doc = r""]
#[doc = r"For structured error handling, the second element could be"]
Expand Down Expand Up @@ -120,6 +123,11 @@ impl fmt::Display for Error {
"unknown value {} for operand kind FragmentShadingRate at index {}",
word, index
),
Error::RawAccessChainOperandsUnknown(index, word) => write!(
f,
"unknown value {} for operand kind RawAccessChainOperands at index {}",
word, index
),
Error::SourceLanguageUnknown(index, word) => write!(
f,
"unknown value {} for operand kind SourceLanguage at index {}",
Expand Down Expand Up @@ -305,6 +313,16 @@ impl fmt::Display for Error {
"unknown value {} for operand kind StoreCacheControl at index {}",
word, index
),
Error::NamedMaximumNumberOfRegistersUnknown(index, word) => write!(
f,
"unknown value {} for operand kind NamedMaximumNumberOfRegisters at index {}",
word, index
),
Error::FPEncodingUnknown(index, word) => write!(
f,
"unknown value {} for operand kind FPEncoding at index {}",
word, index
),
Error::DecodeStringFailed(index, ref e) => {
write!(f, "cannot decode string at index {}: {}", index, e)
}
Expand Down
52 changes: 41 additions & 11 deletions rspirv/binary/autogen_parse_operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ impl<'c, 'd> Parser<'c, 'd> {
GOpKind::FragmentShadingRate => vec![dr::Operand::FragmentShadingRate(
self.decoder.fragment_shading_rate()?,
)],
GOpKind::RawAccessChainOperands => vec![dr::Operand::RawAccessChainOperands(
self.decoder.raw_access_chain_operands()?,
)],
GOpKind::SourceLanguage => {
vec![dr::Operand::SourceLanguage(self.decoder.source_language()?)]
}
Expand Down Expand Up @@ -117,6 +120,12 @@ impl<'c, 'd> Parser<'c, 'd> {
GOpKind::StoreCacheControl => vec![dr::Operand::StoreCacheControl(
self.decoder.store_cache_control()?,
)],
GOpKind::NamedMaximumNumberOfRegisters => {
vec![dr::Operand::NamedMaximumNumberOfRegisters(
self.decoder.named_maximum_number_of_registers()?,
)]
}
GOpKind::FPEncoding => vec![dr::Operand::FPEncoding(self.decoder.fp_encoding()?)],
GOpKind::IdMemorySemantics => vec![dr::Operand::IdMemorySemantics(self.decoder.id()?)],
GOpKind::IdScope => vec![dr::Operand::IdScope(self.decoder.id()?)],
GOpKind::IdRef => vec![dr::Operand::IdRef(self.decoder.id()?)],
Expand Down Expand Up @@ -361,7 +370,7 @@ impl<'c, 'd> Parser<'c, 'd> {
dr::Operand::IdRef(self.decoder.id()?),
dr::Operand::IdRef(self.decoder.id()?),
],
spirv::ExecutionMode::OutputPrimitivesNV => {
spirv::ExecutionMode::OutputPrimitivesEXT => {
vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
}
spirv::ExecutionMode::SharedLocalMemorySizeINTEL => {
Expand Down Expand Up @@ -393,6 +402,10 @@ impl<'c, 'd> Parser<'c, 'd> {
spirv::ExecutionMode::SchedulerTargetFmaxMhzINTEL => {
vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
}
spirv::ExecutionMode::FPFastMathDefault => vec![
dr::Operand::IdRef(self.decoder.id()?),
dr::Operand::IdRef(self.decoder.id()?),
],
spirv::ExecutionMode::StreamingInterfaceINTEL => {
vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
}
Expand All @@ -402,6 +415,17 @@ impl<'c, 'd> Parser<'c, 'd> {
spirv::ExecutionMode::NamedBarrierCountINTEL => {
vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
}
spirv::ExecutionMode::MaximumRegistersINTEL => {
vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
}
spirv::ExecutionMode::MaximumRegistersIdINTEL => {
vec![dr::Operand::IdRef(self.decoder.id()?)]
}
spirv::ExecutionMode::NamedMaximumRegistersINTEL => {
vec![dr::Operand::NamedMaximumNumberOfRegisters(
self.decoder.named_maximum_number_of_registers()?,
)]
}
_ => vec![],
})
}
Expand Down Expand Up @@ -515,6 +539,12 @@ impl<'c, 'd> Parser<'c, 'd> {
spirv::Decoration::ForcePow2DepthINTEL => {
vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
}
spirv::Decoration::StridesizeINTEL => {
vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
}
spirv::Decoration::WordsizeINTEL => {
vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
}
spirv::Decoration::CacheSizeINTEL => {
vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
}
Expand Down Expand Up @@ -546,16 +576,6 @@ impl<'c, 'd> Parser<'c, 'd> {
dr::Operand::LiteralBit32(self.decoder.bit32()?),
dr::Operand::FPOperationMode(self.decoder.fp_operation_mode()?),
],
spirv::Decoration::InitModeINTEL => vec![dr::Operand::InitializationModeQualifier(
self.decoder.initialization_mode_qualifier()?,
)],
spirv::Decoration::ImplementInRegisterMapINTEL => {
vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
}
spirv::Decoration::HostAccessINTEL => vec![
dr::Operand::HostAccessQualifier(self.decoder.host_access_qualifier()?),
dr::Operand::LiteralString(self.decoder.string()?),
],
spirv::Decoration::FPMaxErrorDecorationINTEL => {
vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
}
Expand Down Expand Up @@ -587,6 +607,16 @@ impl<'c, 'd> Parser<'c, 'd> {
spirv::Decoration::MMHostInterfaceWaitRequestINTEL => {
vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
}
spirv::Decoration::HostAccessINTEL => vec![
dr::Operand::HostAccessQualifier(self.decoder.host_access_qualifier()?),
dr::Operand::LiteralString(self.decoder.string()?),
],
spirv::Decoration::InitModeINTEL => vec![dr::Operand::InitializationModeQualifier(
self.decoder.initialization_mode_qualifier()?,
)],
spirv::Decoration::ImplementInRegisterMapINTEL => {
vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
}
spirv::Decoration::CacheControlLoadINTEL => vec![
dr::Operand::LiteralBit32(self.decoder.bit32()?),
dr::Operand::LoadCacheControl(self.decoder.load_cache_control()?),
Expand Down
10 changes: 5 additions & 5 deletions rspirv/binary/disassemble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ mod tests {
b.source(spirv::SourceLanguage::GLSL, 450, None, None::<String>);

let void = b.type_void();
let float32 = b.type_float(32);
let float32 = b.type_float(32, None);
let voidfvoid = b.type_function(void, vec![void]);

let f = b
Expand Down Expand Up @@ -370,8 +370,8 @@ mod tests {
let int64 = b.type_int(64, 1);
let uint32 = b.type_int(32, 0);
let uint64 = b.type_int(64, 0);
let float32 = b.type_float(32);
let float64 = b.type_float(64);
let float32 = b.type_float(32, None);
let float64 = b.type_float(64, None);
let voidfvoid = b.type_function(void, vec![void]);

let f = b
Expand Down Expand Up @@ -442,7 +442,7 @@ mod tests {
b.memory_model(spirv::AddressingModel::Logical, spirv::MemoryModel::Simple);

let void = b.type_void();
let float32 = b.type_float(32);
let float32 = b.type_float(32, None);
let voidfvoid = b.type_function(void, vec![void]);

assert!(b
Expand Down Expand Up @@ -484,7 +484,7 @@ mod tests {
b.memory_model(spirv::AddressingModel::Logical, spirv::MemoryModel::OpenCL);

let void = b.type_void();
let float32 = b.type_float(32);
let float32 = b.type_float(32, None);
let voidfvoid = b.type_function(void, vec![void]);

assert!(b
Expand Down
Loading
Loading