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

This commit is contained in:
Dzmitry Malyshau authored and Dzmitry Malyshau committed 2021-03-09 10:10:10 -05:00
1 parent d433ee81e6
commit 7c26320cce
2 files changed
+10 -3

No files matched your search

-3
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 {
+10
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(