[spv-in] defer function call patching to the end of the module

This commit is contained in:
Dzmitry Malyshau
2021-03-08 21:22:23 -05:00
committed by Dzmitry Malyshau
parent d433ee81e6
commit 7c26320cce
2 changed files with 10 additions and 3 deletions

View File

@@ -157,9 +157,6 @@ impl<I: Iterator<Item = u32>> super::Parser<I> {
fun.body = flow_graph.to_naga()?;
// done
self.patch_function_calls(&mut fun)?;
match self.lookup_entry_point.remove(&fun_id) {
Some(ep) => {
module.entry_points.push(crate::EntryPoint {

View File

@@ -1754,6 +1754,16 @@ impl<I: Iterator<Item = u32>> Parser<I> {
}?;
}
log::info!("Patching...");
// patch all the function calls
for (_, fun) in module.functions.iter_mut() {
self.patch_function_calls(fun)?;
}
for ep in module.entry_points.iter_mut() {
self.patch_function_calls(&mut ep.function)?;
}
self.lookup_function.clear();
// Check all the images and samplers to have consistent comparison property.
for (handle, flags) in self.handle_sampling.drain() {
if !image::patch_comparison_type(