Skip to content

Commit bf3a482

Browse files
ConvertUBOToPushConstantPass: invalidated analyses after corresponding modifications
1 parent 79deb9f commit bf3a482

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Graphics/ShaderTools/src/ConvertUBOToPushConstant.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,12 @@ class ConvertUBOToPushConstantPass : public spvtools::opt::Pass
246246
context()->UpdateDefUse(target_var);
247247
modified = true;
248248

249+
// IMPORTANT: We changed pointer types + storage class; TypeManager and other analyses may be stale.
250+
// Invalidate analyses that can cache type information and def-use.
251+
context()->InvalidateAnalyses(spvtools::opt::IRContext::kAnalysisTypes |
252+
spvtools::opt::IRContext::kAnalysisDefUse |
253+
spvtools::opt::IRContext::kAnalysisDecorations);
254+
249255
// Propagate storage class change to all users of this variable
250256
std::vector<spvtools::opt::Instruction*> users;
251257
get_def_use_mgr()->ForEachUser(target_var, [&users](spvtools::opt::Instruction* user) {
@@ -271,6 +277,9 @@ class ConvertUBOToPushConstantPass : public spvtools::opt::Pass
271277
decoration == spv::Decoration::DescriptorSet;
272278
});
273279

280+
// Invalidate decoration analysis since we modified decorations
281+
context()->InvalidateAnalyses(spvtools::opt::IRContext::kAnalysisDecorations);
282+
274283
return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange;
275284
}
276285

0 commit comments

Comments
 (0)