Skip to content
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
20 changes: 18 additions & 2 deletions rspirv/dr/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,24 @@ impl Builder {
dr::Operand::IdRef(entry_point),
dr::Operand::ExecutionMode(execution_mode),
];
for v in params.as_ref() {
operands.push(dr::Operand::LiteralBit32(*v));

// Different execution modes require different operand types
match execution_mode {
// From SPIRV spec section 3.6.38:
// "Same as the LocalSize Mode, but using <id> operands instead of literals.
// The operands are consumed as unsigned and each must be an integer type
// scalar."
spirv::ExecutionMode::LocalSizeId => {
for v in params.as_ref() {
operands.push(dr::Operand::IdRef(*v));
}
}
// Other execution modes use literal values
_ => {
for v in params.as_ref() {
operands.push(dr::Operand::LiteralBit32(*v));
}
}
}

let inst = dr::Instruction::new(spirv::Op::ExecutionModeId, None, None, operands);
Expand Down
1 change: 1 addition & 0 deletions rspirv/dr/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ impl binary::Consumer for Loader {
spirv::Op::MemoryModel => self.module.memory_model = Some(inst),
spirv::Op::EntryPoint => self.module.entry_points.push(inst),
spirv::Op::ExecutionMode => self.module.execution_modes.push(inst),
spirv::Op::ExecutionModeId => self.module.execution_modes.push(inst),
spirv::Op::String
| spirv::Op::SourceExtension
| spirv::Op::Source
Expand Down