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

Method SetMemoryType

tests/framework/binding.cpp:166–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166bool PhysicalDevice::SetMemoryType(const uint32_t type_bits, VkMemoryAllocateInfo* info, const VkFlags properties,
167 const VkFlags forbid, const VkMemoryHeapFlags heapFlags) const {
168 uint32_t type_mask = type_bits;
169 // Search memtypes to find first index with those properties
170 for (uint32_t i = 0; i < memory_properties_.memoryTypeCount; i++) {
171 if ((type_mask & 1) == 1) {
172 // Type is available, does it match user properties?
173 if ((memory_properties_.memoryTypes[i].propertyFlags & properties) == properties &&
174 (memory_properties_.memoryTypes[i].propertyFlags & forbid) == 0 &&
175 (memory_properties_.memoryHeaps[memory_properties_.memoryTypes[i].heapIndex].size >= info->allocationSize)) {
176 // Memory properties available, does it match user heap flags?
177 if ((heapFlags == 0) ||
178 ((heapFlags & memory_properties_.memoryHeaps[memory_properties_.memoryTypes[i].heapIndex].flags) ==
179 heapFlags)) {
180 info->memoryTypeIndex = i;
181 return true;
182 }
183 }
184 }
185 type_mask >>= 1;
186 }
187 // No memory types matched, return failure
188 return false;
189}
190
191/*
192 * Return list of PhysicalDevice layers

Callers 15

GetResourceAllocInfoMethod · 0.80
BindToMemMethod · 0.80
AllocSessionMemMethod · 0.80
InitMethod · 0.80
InitMethod · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected