Skip to content

Commit 2d95dd0

Browse files
committed
Hackity in assoc consts for now
1 parent d5b7f23 commit 2d95dd0

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

autogen/src/table.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ pub fn gen_grammar_inst_table_operand_kinds(
7676
// Instruction table.
7777
let table = gen_instruction_table(instructions, ext_op_name, name);
7878

79-
let operand_kinds = if operand_kinds.is_empty() {
80-
None
81-
} else {
79+
let operand_kinds = if ext_op_name.is_none() {
8280
Some(quote! {
8381
#[doc = "All operand kinds in the SPIR-V grammar."]
8482
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
@@ -87,6 +85,15 @@ pub fn gen_grammar_inst_table_operand_kinds(
8785
#(#elements),*
8886
}
8987
})
88+
} else if operand_kinds.is_empty() {
89+
None
90+
} else {
91+
let elements = elements.map(|e| quote!(const #e: u32 = 1337));
92+
Some(quote! {
93+
impl OperandKind {
94+
#(#elements;)*
95+
}
96+
})
9097
};
9198

9299
quote! {

rspirv/grammar/autogen_debuginfo.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22
// external/spirv.core.grammar.json.
33
// DO NOT MODIFY!
44

5-
#[doc = "All operand kinds in the SPIR-V grammar."]
6-
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
7-
#[allow(clippy::upper_case_acronyms)]
8-
pub enum OperandKind {
9-
DebugInfoFlags,
10-
DebugBaseTypeAttributeEncoding,
11-
DebugCompositeType,
12-
DebugTypeQualifier,
13-
DebugOperation,
5+
impl OperandKind {
6+
const DebugInfoFlags: u32 = 1337;
7+
const DebugBaseTypeAttributeEncoding: u32 = 1337;
8+
const DebugCompositeType: u32 = 1337;
9+
const DebugTypeQualifier: u32 = 1337;
10+
const DebugOperation: u32 = 1337;
1411
}
1512
static DEBUGINFO_INSTRUCTIONS: &[ExtendedInstruction<'static>] = &[
1613
ext_inst!(DebugInfoOp, DebugInfoNone, [], [], []),

rspirv/grammar/autogen_opencl_debuginfo_100.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@
22
// external/spirv.core.grammar.json.
33
// DO NOT MODIFY!
44

5-
#[doc = "All operand kinds in the SPIR-V grammar."]
6-
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
7-
#[allow(clippy::upper_case_acronyms)]
8-
pub enum OperandKind {
9-
DebugInfoFlags,
10-
DebugBaseTypeAttributeEncoding,
11-
DebugCompositeType,
12-
DebugTypeQualifier,
13-
DebugOperation,
14-
DebugImportedEntity,
5+
impl OperandKind {
6+
const DebugInfoFlags: u32 = 1337;
7+
const DebugBaseTypeAttributeEncoding: u32 = 1337;
8+
const DebugCompositeType: u32 = 1337;
9+
const DebugTypeQualifier: u32 = 1337;
10+
const DebugOperation: u32 = 1337;
11+
const DebugImportedEntity: u32 = 1337;
1512
}
1613
static OPENCL_DEBUGINFO_100_INSTRUCTIONS: &[ExtendedInstruction<'static>] = &[
1714
ext_inst!(CLDebugInfoOp, DebugInfoNone, [], [], []),

0 commit comments

Comments
 (0)