1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
impl Builder {
#[doc = "Appends an OpSourceContinued instruction."]
pub fn source_continued<T: Into<String>>(&mut self, continued_source: T) {
#[allow(unused_mut)]
let mut inst = dr::Instruction::new(
spirv::Op::SourceContinued,
None,
None,
vec![dr::Operand::LiteralString(continued_source.into())],
);
self.module.debugs.push(inst);
}
#[doc = "Appends an OpSource instruction."]
pub fn source<T: Into<String>>(
&mut self,
source_language: spirv::SourceLanguage,
version: u32,
file: Option<spirv::Word>,
source: Option<T>,
) {
#[allow(unused_mut)]
let mut inst = dr::Instruction::new(
spirv::Op::Source,
None,
None,
vec![
dr::Operand::SourceLanguage(source_language),
dr::Operand::LiteralInt32(version),
],
);
if let Some(v) = file {
#[allow(clippy::identity_conversion)]
inst.operands.push(dr::Operand::IdRef(v.into()));
}
if let Some(v) = source {
#[allow(clippy::identity_conversion)]
inst.operands.push(dr::Operand::LiteralString(v.into()));
}
self.module.debugs.push(inst);
}
#[doc = "Appends an OpSourceExtension instruction."]
pub fn source_extension<T: Into<String>>(&mut self, extension: T) {
#[allow(unused_mut)]
let mut inst = dr::Instruction::new(
spirv::Op::SourceExtension,
None,
None,
vec![dr::Operand::LiteralString(extension.into())],
);
self.module.debugs.push(inst);
}
#[doc = "Appends an OpName instruction."]
pub fn name<T: Into<String>>(&mut self, target: spirv::Word, name: T) {
#[allow(unused_mut)]
let mut inst = dr::Instruction::new(
spirv::Op::Name,
None,
None,
vec![
dr::Operand::IdRef(target),
dr::Operand::LiteralString(name.into()),
],
);
self.module.debugs.push(inst);
}
#[doc = "Appends an OpMemberName instruction."]
pub fn member_name<T: Into<String>>(&mut self, ty: spirv::Word, member: u32, name: T) {
#[allow(unused_mut)]
let mut inst = dr::Instruction::new(
spirv::Op::MemberName,
None,
None,
vec![
dr::Operand::IdRef(ty),
dr::Operand::LiteralInt32(member),
dr::Operand::LiteralString(name.into()),
],
);
self.module.debugs.push(inst);
}
#[doc = "Appends an OpModuleProcessed instruction."]
pub fn module_processed<T: Into<String>>(&mut self, process: T) {
#[allow(unused_mut)]
let mut inst = dr::Instruction::new(
spirv::Op::ModuleProcessed,
None,
None,
vec![dr::Operand::LiteralString(process.into())],
);
self.module.debugs.push(inst);
}
}