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

Add OpFunctionCall explicitly #148

Merged
merged 1 commit into from
Aug 12, 2020
Merged
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
2 changes: 1 addition & 1 deletion autogen/dr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ pub fn gen_dr_builder_normal_insts(grammar: &structs::Grammar) -> TokenStream {
inst.class == Some(Type) ||
inst.class == Some(Constant) ||
inst.class == Some(ExtensionDecl) ||
inst.class == Some(FunctionStruct) ||
(inst.class == Some(FunctionStruct) && inst.opname != "OpFunctionCall") ||
inst.class == Some(Debug) ||
inst.class == Some(Annotation) ||
inst.class == Some(Terminator) ||
Expand Down
53 changes: 53 additions & 0 deletions rspirv/dr/build/autogen_norm_insts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,59 @@ impl Builder {
self.insert_into_block(insert_point, inst)?;
Ok(())
}
#[doc = "Appends an OpFunctionCall instruction to the current block."]
pub fn function_call<T: AsRef<[spirv::Word]>>(
&mut self,
result_type: spirv::Word,
result_id: Option<spirv::Word>,
function: spirv::Word,
argument_0_argument_1: T,
) -> BuildResult<spirv::Word> {
let _id = result_id.unwrap_or_else(|| self.id());
#[allow(unused_mut)]
let mut inst = dr::Instruction::new(
spirv::Op::FunctionCall,
Some(result_type),
Some(_id),
vec![dr::Operand::IdRef(function)],
);
inst.operands.extend(
argument_0_argument_1
.as_ref()
.iter()
.cloned()
.map(dr::Operand::IdRef),
);
self.insert_into_block(InsertPoint::End, inst)?;
Ok(_id)
}
#[doc = "Appends an OpFunctionCall instruction to the current block."]
pub fn insert_function_call<T: AsRef<[spirv::Word]>>(
&mut self,
insert_point: InsertPoint,
result_type: spirv::Word,
result_id: Option<spirv::Word>,
function: spirv::Word,
argument_0_argument_1: T,
) -> BuildResult<spirv::Word> {
let _id = result_id.unwrap_or_else(|| self.id());
#[allow(unused_mut)]
let mut inst = dr::Instruction::new(
spirv::Op::FunctionCall,
Some(result_type),
Some(_id),
vec![dr::Operand::IdRef(function)],
);
inst.operands.extend(
argument_0_argument_1
.as_ref()
.iter()
.cloned()
.map(dr::Operand::IdRef),
);
self.insert_into_block(insert_point, inst)?;
Ok(_id)
}
#[doc = "Appends an OpImageTexelPointer instruction to the current block."]
pub fn image_texel_pointer(
&mut self,
Expand Down