MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / GetAtomicInfo

Method GetAtomicInfo

layers/state_tracker/shader_module.cpp:3088–3120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3086}
3087
3088AtomicInstructionInfo Module::GetAtomicInfo(const Instruction& insn) const {
3089 AtomicInstructionInfo info;
3090
3091 // All atomics have a pointer referenced
3092 const uint32_t pointer_index = insn.Opcode() == spv::OpAtomicStore ? 1 : 3;
3093 const Instruction* access = FindDef(insn.Word(pointer_index));
3094 const Instruction* pointer = FindDef(access->Word(1));
3095 info.storage_class = pointer->StorageClass();
3096
3097 const bool is_untyped = (pointer->Opcode() == spv::OpTypeUntypedPointerKHR);
3098
3099 const Instruction* data_type = nullptr;
3100 if (is_untyped) {
3101 if (insn.Opcode() == spv::OpAtomicStore) {
3102 const Instruction* value_id = FindDef(insn.Word(4));
3103 data_type = FindDef(value_id->TypeId());
3104 } else {
3105 data_type = FindDef(insn.TypeId());
3106 }
3107 } else {
3108 data_type = FindDef(pointer->Word(3));
3109 }
3110
3111 if (data_type->IsVector()) {
3112 info.vector_size = GetNumComponentsInBaseType(data_type);
3113 data_type = FindDef(data_type->Word(2));
3114 }
3115
3116 info.type = data_type->Opcode();
3117 info.bit_width = data_type->GetBitWidth();
3118
3119 return info;
3120}
3121
3122spv::StorageClass Module::StorageClass(const Instruction& insn) const {
3123 spv::StorageClass storage_class = spv::StorageClassMax;

Callers 1

ValidateAtomicsTypesMethod · 0.80

Calls 6

OpcodeMethod · 0.80
WordMethod · 0.80
TypeIdMethod · 0.80
IsVectorMethod · 0.80
GetBitWidthMethod · 0.80
StorageClassMethod · 0.45

Tested by

no test coverage detected