Skip to content

Commit

Permalink
tests: Change set_memory_type for SetMemoryType
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-lunarg committed Sep 28, 2024
1 parent 980bdc2 commit b6993fa
Show file tree
Hide file tree
Showing 31 changed files with 135 additions and 137 deletions.
6 changes: 3 additions & 3 deletions tests/framework/binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ std::vector<VkExtensionProperties> PhysicalDevice::extensions(const char *pLayer
}
}

bool PhysicalDevice::set_memory_type(const uint32_t type_bits, VkMemoryAllocateInfo *info, const VkFlags properties,
const VkFlags forbid) const {
bool PhysicalDevice::SetMemoryType(const uint32_t type_bits, VkMemoryAllocateInfo *info, const VkFlags properties,
const VkFlags forbid) const {
uint32_t type_mask = type_bits;
// Search memtypes to find first index with those properties
for (uint32_t i = 0; i < memory_properties_.memoryTypeCount; i++) {
Expand Down Expand Up @@ -788,7 +788,7 @@ VkMemoryAllocateInfo DeviceMemory::get_resource_alloc_info(const Device &dev, co
VkMemoryPropertyFlags mem_props, void *alloc_info_pnext) {
VkMemoryAllocateInfo alloc_info = vku::InitStructHelper(alloc_info_pnext);
alloc_info.allocationSize = reqs.size;
EXPECT_TRUE(dev.phy().set_memory_type(reqs.memoryTypeBits, &alloc_info, mem_props));
EXPECT_TRUE(dev.phy().SetMemoryType(reqs.memoryTypeBits, &alloc_info, mem_props));
return alloc_info;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/framework/binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ class PhysicalDevice : public internal::Handle<VkPhysicalDevice> {
}
VkPhysicalDeviceFeatures features() const;

bool set_memory_type(const uint32_t type_bits, VkMemoryAllocateInfo *info, const VkMemoryPropertyFlags properties,
const VkMemoryPropertyFlags forbid = 0) const;
bool SetMemoryType(const uint32_t type_bits, VkMemoryAllocateInfo *info, const VkMemoryPropertyFlags properties,
const VkMemoryPropertyFlags forbid = 0) const;

// vkEnumerateDeviceExtensionProperties()
std::vector<VkExtensionProperties> extensions(const char *pLayerName = nullptr) const;
Expand Down
6 changes: 3 additions & 3 deletions tests/framework/video_objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ class BitstreamBuffer {

VkMemoryAllocateInfo alloc_info = vku::InitStructHelper();
VkMemoryPropertyFlags mem_props = is_protected ? VK_MEMORY_PROPERTY_PROTECTED_BIT : 0;
ASSERT_TRUE(device_->phy().set_memory_type(mem_req.memoryTypeBits, &alloc_info, mem_props));
ASSERT_TRUE(device_->phy().SetMemoryType(mem_req.memoryTypeBits, &alloc_info, mem_props));
alloc_info.allocationSize = mem_req.size;

ASSERT_EQ(VK_SUCCESS, vk::AllocateMemory(device_->handle(), &alloc_info, nullptr, &memory_));
Expand Down Expand Up @@ -448,7 +448,7 @@ class VideoPictureResource {

VkMemoryAllocateInfo alloc_info = vku::InitStructHelper();
VkMemoryPropertyFlags mem_props = is_protected ? VK_MEMORY_PROPERTY_PROTECTED_BIT : 0;
ASSERT_TRUE(device_->phy().set_memory_type(mem_req.memoryTypeBits, &alloc_info, mem_props));
ASSERT_TRUE(device_->phy().SetMemoryType(mem_req.memoryTypeBits, &alloc_info, mem_props));
alloc_info.allocationSize = mem_req.size;

ASSERT_EQ(VK_SUCCESS, vk::AllocateMemory(device_->handle(), &alloc_info, nullptr, &memory_));
Expand Down Expand Up @@ -1961,7 +1961,7 @@ class VideoContext {
for (uint32_t i = 0; i < mem_req_count; ++i) {
VkMemoryAllocateInfo alloc_info = vku::InitStructHelper();

ASSERT_TRUE(device_->phy().set_memory_type(mem_reqs[i].memoryRequirements.memoryTypeBits, &alloc_info, 0));
ASSERT_TRUE(device_->phy().SetMemoryType(mem_reqs[i].memoryRequirements.memoryTypeBits, &alloc_info, 0));
alloc_info.allocationSize = mem_reqs[i].memoryRequirements.size;

VkDeviceMemory memory = VK_NULL_HANDLE;
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/android_hardware_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ TEST_F(NegativeAndroidHardwareBuffer, ExportBufferAllocationSize) {
VkMemoryAllocateInfo memory_info = vku::InitStructHelper(&export_memory_info);
memory_info.allocationSize = 0;

bool has_memtype = m_device->phy().set_memory_type(mem_reqs.memoryTypeBits, &memory_info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
bool has_memtype = m_device->phy().SetMemoryType(mem_reqs.memoryTypeBits, &memory_info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
if (!has_memtype) {
GTEST_SKIP() << "No valid memory type index could be found";
}
Expand Down Expand Up @@ -1035,7 +1035,7 @@ TEST_F(NegativeAndroidHardwareBuffer, ExportImageNonBound) {
memory_info.allocationSize = 0;

// Use any DEVICE_LOCAL memory found
bool has_memtype = m_device->phy().set_memory_type(0xFFFFFFFF, &memory_info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
bool has_memtype = m_device->phy().SetMemoryType(0xFFFFFFFF, &memory_info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
if (!has_memtype) {
GTEST_SKIP() << "No valid memory type index could be found";
}
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/android_hardware_buffer_positive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ TEST_F(PositiveAndroidHardwareBuffer, ExportBuffer) {
VkMemoryAllocateInfo memory_info = vku::InitStructHelper(&export_memory_info);
memory_info.allocationSize = mem_reqs.size;

bool has_memtype = m_device->phy().set_memory_type(mem_reqs.memoryTypeBits, &memory_info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
bool has_memtype = m_device->phy().SetMemoryType(mem_reqs.memoryTypeBits, &memory_info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
if (!has_memtype) {
GTEST_SKIP() << "No valid memory type index could be found";
}
Expand Down Expand Up @@ -238,7 +238,7 @@ TEST_F(PositiveAndroidHardwareBuffer, ExportImage) {
memory_info.allocationSize = 0;

// Use any DEVICE_LOCAL memory found
bool has_memtype = m_device->phy().set_memory_type(0xFFFFFFFF, &memory_info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
bool has_memtype = m_device->phy().SetMemoryType(0xFFFFFFFF, &memory_info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
if (!has_memtype) {
GTEST_SKIP() << "No valid memory type index could be found";
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ TEST_F(NegativeBuffer, BindNull) {
vk::GetBufferMemoryRequirements(device(), buffer, &buffer_mem_reqs);
VkMemoryAllocateInfo buffer_alloc_info = vku::InitStructHelper();
buffer_alloc_info.allocationSize = buffer_mem_reqs.size;
m_device->phy().set_memory_type(buffer_mem_reqs.memoryTypeBits, &buffer_alloc_info, 0);
m_device->phy().SetMemoryType(buffer_mem_reqs.memoryTypeBits, &buffer_alloc_info, 0);
vkt::DeviceMemory memory(*m_device, buffer_alloc_info);

vk::DestroyBuffer(device(), buffer, nullptr);
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/copy_buffer_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2394,7 +2394,7 @@ TEST_F(NegativeCopyBufferImage, DISABLED_ImageOverlappingMemory) {
vkt::DeviceMemory mem;
VkMemoryAllocateInfo alloc_info = vku::InitStructHelper();
alloc_info.allocationSize = (std::max)(buffer_memory_requirements.size, image_memory_requirements.size);
bool has_memtype = m_device->phy().set_memory_type(
bool has_memtype = m_device->phy().SetMemoryType(
buffer_memory_requirements.memoryTypeBits & image_memory_requirements.memoryTypeBits, &alloc_info, 0);
if (!has_memtype) {
GTEST_SKIP() << "Failed to find a memory type for both a buffer and an image";
Expand Down Expand Up @@ -2617,7 +2617,7 @@ TEST_F(NegativeCopyBufferImage, BufferToCompressedImage) {
mem_alloc.memoryTypeIndex = 1;
vk::GetImageMemoryRequirements(device(), depth_image, &mem_reqs);
mem_alloc.allocationSize = mem_reqs.size;
bool pass = m_device->phy().set_memory_type(mem_reqs.memoryTypeBits, &mem_alloc, 0);
bool pass = m_device->phy().SetMemoryType(mem_reqs.memoryTypeBits, &mem_alloc, 0);
ASSERT_TRUE(pass);
err = vk::AllocateMemory(device(), &mem_alloc, NULL, &mem1);
ASSERT_EQ(VK_SUCCESS, err);
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/copy_buffer_image_positive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ TEST_F(PositiveCopyBufferImage, ImageOverlappingMemory) {
vkt::DeviceMemory mem;
VkMemoryAllocateInfo alloc_info = vku::InitStructHelper();
alloc_info.allocationSize = buffer_memory_requirements.size + image_memory_requirements.size;
bool has_memtype = m_device->phy().set_memory_type(
bool has_memtype = m_device->phy().SetMemoryType(
buffer_memory_requirements.memoryTypeBits & image_memory_requirements.memoryTypeBits, &alloc_info, 0);
if (!has_memtype) {
GTEST_SKIP() << "Failed to find a memory type for both a buffer and an image";
Expand Down Expand Up @@ -225,7 +225,7 @@ TEST_F(PositiveCopyBufferImage, ImageOverlappingMemory) {
vkt::DeviceMemory mem2;
alloc_info = vku::InitStructHelper();
alloc_info.allocationSize = buffer_memory_requirements.size + image_memory_requirements.size;
has_memtype = m_device->phy().set_memory_type(
has_memtype = m_device->phy().SetMemoryType(
buffer_memory_requirements.memoryTypeBits & image_memory_requirements.memoryTypeBits, &alloc_info, 0);
if (!has_memtype) {
GTEST_SKIP() << "Failed to find a memory type for both a buffer and an image";
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/descriptor_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ TEST_F(NegativeDescriptorBuffer, BindingAndOffsets) {
alloc_flags.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR;
VkMemoryAllocateInfo alloc_info = vku::InitStructHelper(&alloc_flags);
alloc_info.allocationSize = buffer_mem_reqs.size;
m_device->phy().set_memory_type(buffer_mem_reqs.memoryTypeBits, &alloc_info, 0);
m_device->phy().SetMemoryType(buffer_mem_reqs.memoryTypeBits, &alloc_info, 0);
vkt::DeviceMemory buffer_memory(*m_device, alloc_info);

// Bind those buffers to the same buffer memory
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/descriptors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ TEST_F(NegativeDescriptors, CmdBufferDescriptorSetImageSamplerDestroyed) {
VkDeviceSize align_mod = memory_reqs.size % memory_reqs.alignment;
VkDeviceSize aligned_size = ((align_mod == 0) ? memory_reqs.size : (memory_reqs.size + memory_reqs.alignment - align_mod));
memory_info.allocationSize = aligned_size * 2;
pass = m_device->phy().set_memory_type(memory_reqs.memoryTypeBits, &memory_info, 0);
pass = m_device->phy().SetMemoryType(memory_reqs.memoryTypeBits, &memory_info, 0);
ASSERT_TRUE(pass);
vkt::DeviceMemory image_memory(*m_device, memory_info);

Expand Down Expand Up @@ -1959,7 +1959,7 @@ TEST_F(NegativeDescriptors, DSBufferLimit) {

VkMemoryAllocateInfo mem_alloc = vku::InitStructHelper();
mem_alloc.allocationSize = mem_reqs.size;
bool pass = m_device->phy().set_memory_type(mem_reqs.memoryTypeBits, &mem_alloc, 0);
bool pass = m_device->phy().SetMemoryType(mem_reqs.memoryTypeBits, &mem_alloc, 0);
if (!pass) {
printf("Failed to allocate memory in DSBufferLimitErrors; skipped.\n");
continue;
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/external_memory_sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2552,7 +2552,7 @@ TEST_F(NegativeExternalMemorySync, ImportMemoryHostDedicated) {

VkMemoryAllocateInfo alloc_info = vku::InitStructHelper(&import_info);
alloc_info.allocationSize = alloc_size;
if (!m_device->phy().set_memory_type(host_pointer_props.memoryTypeBits, &alloc_info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)) {
if (!m_device->phy().SetMemoryType(host_pointer_props.memoryTypeBits, &alloc_info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)) {
free(host_memory);
GTEST_SKIP() << "Failed to set memory type.";
}
Expand Down Expand Up @@ -2593,7 +2593,7 @@ TEST_F(NegativeExternalMemorySync, ImportMemoryHostMemoryIndex) {

uint32_t unsupported_mem_type =
((1 << m_device->phy().memory_properties_.memoryTypeCount) - 1) & ~host_pointer_props.memoryTypeBits;
bool found_type = m_device->phy().set_memory_type(unsupported_mem_type, &alloc_info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
bool found_type = m_device->phy().SetMemoryType(unsupported_mem_type, &alloc_info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
if (unsupported_mem_type == 0 || !found_type) {
free(host_memory);
GTEST_SKIP() << "Failed to find unsupported memory type.";
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/external_memory_sync_positive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ TEST_F(PositiveExternalMemorySync, ImportMemoryHost) {

VkMemoryAllocateInfo alloc_info = vku::InitStructHelper(&import_info);
alloc_info.allocationSize = alloc_size;
if (!m_device->phy().set_memory_type(host_pointer_props.memoryTypeBits, &alloc_info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)) {
if (!m_device->phy().SetMemoryType(host_pointer_props.memoryTypeBits, &alloc_info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)) {
free(host_memory);
GTEST_SKIP() << "Failed to set memory type.";
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/gpu_av_descriptor_indexing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2387,7 +2387,7 @@ TEST_F(NegativeGpuAVDescriptorIndexing, MixingProtectedResources) {

VkMemoryAllocateInfo alloc_info = vku::InitStructHelper();
alloc_info.allocationSize = mem_reqs_image_protected.size;
if (!m_device->phy().set_memory_type(mem_reqs_image_protected.memoryTypeBits, &alloc_info, VK_MEMORY_PROPERTY_PROTECTED_BIT)) {
if (!m_device->phy().SetMemoryType(mem_reqs_image_protected.memoryTypeBits, &alloc_info, VK_MEMORY_PROPERTY_PROTECTED_BIT)) {
GTEST_SKIP() << "Memory type not found";
}
vkt::DeviceMemory memory_image_protected(*m_device, alloc_info);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/gpu_av_descriptor_indexing_positive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ TEST_F(PositiveGpuAVDescriptorIndexing, MixingProtectedResources) {

VkMemoryAllocateInfo alloc_info = vku::InitStructHelper();
alloc_info.allocationSize = mem_reqs_image_protected.size;
if (!m_device->phy().set_memory_type(mem_reqs_image_protected.memoryTypeBits, &alloc_info, VK_MEMORY_PROPERTY_PROTECTED_BIT)) {
if (!m_device->phy().SetMemoryType(mem_reqs_image_protected.memoryTypeBits, &alloc_info, VK_MEMORY_PROPERTY_PROTECTED_BIT)) {
GTEST_SKIP() << "Memory type not found";
}
vkt::DeviceMemory memory_image_protected(*m_device, alloc_info);
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/host_image_copy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1736,13 +1736,13 @@ TEST_F(NegativeHostImageCopy, TransitionImageLayoutMultiPlanar) {
// Find a valid memory type index to memory to be allocated from
VkMemoryAllocateInfo alloc_info = vku::InitStructHelper();
alloc_info.allocationSize = mem_req2.memoryRequirements.size;
m_device->phy().set_memory_type(mem_req2.memoryRequirements.memoryTypeBits, &alloc_info, 0);
m_device->phy().SetMemoryType(mem_req2.memoryRequirements.memoryTypeBits, &alloc_info, 0);
vk::AllocateMemory(device(), &alloc_info, NULL, &plane_0_memory);

image_plane_req.planeAspect = VK_IMAGE_ASPECT_PLANE_1_BIT;
vk::GetImageMemoryRequirements2(device(), &mem_req_info2, &mem_req2);
alloc_info.allocationSize = mem_req2.memoryRequirements.size;
m_device->phy().set_memory_type(mem_req2.memoryRequirements.memoryTypeBits, &alloc_info, 0);
m_device->phy().SetMemoryType(mem_req2.memoryRequirements.memoryTypeBits, &alloc_info, 0);
vk::AllocateMemory(device(), &alloc_info, NULL, &plane_1_memory);

VkBindImagePlaneMemoryInfo plane_0_memory_info = vku::InitStructHelper();
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3941,7 +3941,7 @@ TEST_F(NegativeImage, BindIMageMemoryDeviceGroupInfo) {
mem_alloc.allocationSize = mem_reqs.size;
mem_alloc.memoryTypeIndex = mem_reqs.memoryTypeBits;

bool pass = m_device->phy().set_memory_type(mem_reqs.memoryTypeBits, &mem_alloc, 0);
bool pass = m_device->phy().SetMemoryType(mem_reqs.memoryTypeBits, &mem_alloc, 0);
if (!pass) {
GTEST_SKIP() << "Failed to set memory type.";
}
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/image_positive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ TEST_F(PositiveImage, AliasedMemoryTracking) {
VkMemoryAllocateInfo alloc_info = vku::InitStructHelper();
alloc_info.allocationSize = (std::max)(buffer_memory_requirements.size, image_memory_requirements.size);
bool has_memtype =
m_device->phy().set_memory_type(buffer_memory_requirements.memoryTypeBits & image_memory_requirements.memoryTypeBits,
&alloc_info, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
m_device->phy().SetMemoryType(buffer_memory_requirements.memoryTypeBits & image_memory_requirements.memoryTypeBits,
&alloc_info, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
if (!has_memtype) {
GTEST_SKIP() << "Failed to find a host visible memory type for both a buffer and an image";
}
Expand Down
Loading

0 comments on commit b6993fa

Please sign in to comment.