Skip to content

Commit 3291252

Browse files
ConvertUBOToPushConstantPass: do not cache type mgr
It may become stale after analyses invalidation
1 parent c3b47c2 commit 3291252

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Graphics/ShaderTools/src/ConvertUBOToPushConstant.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,8 @@ class ConvertUBOToPushConstantPass : public spvtools::opt::Pass
214214
uint32_t pointee_type_id = ptr_type_inst->GetSingleWordInOperand(1);
215215

216216
// Create or find a pointer type with PushConstant storage class
217-
spvtools::opt::analysis::TypeManager* type_mgr = context()->get_type_mgr();
218-
uint32_t new_ptr_type_id =
219-
type_mgr->FindPointerToType(pointee_type_id, spv::StorageClass::PushConstant);
217+
uint32_t new_ptr_type_id =
218+
context()->get_type_mgr()->FindPointerToType(pointee_type_id, spv::StorageClass::PushConstant);
220219

221220
if (new_ptr_type_id == 0)
222221
{
@@ -456,15 +455,13 @@ class ConvertUBOToPushConstantPass : public spvtools::opt::Pass
456455
// Changes the result type of an instruction to use the new storage class.
457456
void ChangeResultStorageClass(spvtools::opt::Instruction& inst)
458457
{
459-
spvtools::opt::analysis::TypeManager* type_mgr = context()->get_type_mgr();
460-
spvtools::opt::Instruction* result_type_inst = get_def_use_mgr()->GetDef(inst.type_id());
461-
458+
spvtools::opt::Instruction* result_type_inst = get_def_use_mgr()->GetDef(inst.type_id());
462459
if (result_type_inst == nullptr || result_type_inst->opcode() != spv::Op::OpTypePointer)
463460
return;
464461

465462
uint32_t pointee_type_id = result_type_inst->GetSingleWordInOperand(1);
466463
uint32_t new_result_type_id =
467-
type_mgr->FindPointerToType(pointee_type_id, spv::StorageClass::PushConstant);
464+
context()->get_type_mgr()->FindPointerToType(pointee_type_id, spv::StorageClass::PushConstant);
468465

469466
if (new_result_type_id == 0)
470467
return;

0 commit comments

Comments
 (0)