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

Function TEST_F

tests/unit/debug_extensions.cpp:19–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17class NegativeDebugExtensions : public VkLayerTest {};
18
19TEST_F(NegativeDebugExtensions, DebugMarkerName) {
20 TEST_DESCRIPTION("Ensure debug marker object names are printed in debug report output");
21 AddRequiredExtensions(VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
22 AddRequiredExtensions(VK_EXT_DEBUG_MARKER_EXTENSION_NAME);
23 RETURN_IF_SKIP(Init());
24
25 if (IsPlatformMockICD()) {
26 GTEST_SKIP() << "Skipping object naming test with MockICD.";
27 }
28
29 std::string memory_name = "memory_name";
30
31 VkBufferCreateInfo buffer_create_info = vku::InitStructHelper();
32 buffer_create_info.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;
33 buffer_create_info.size = 1;
34 vkt::Buffer buffer(*m_device, buffer_create_info, vkt::no_mem);
35
36 VkMemoryRequirements memRequirements;
37 vk::GetBufferMemoryRequirements(device(), buffer, &memRequirements);
38
39 VkMemoryAllocateInfo memory_allocate_info = vku::InitStructHelper();
40 memory_allocate_info.allocationSize = memRequirements.size;
41 memory_allocate_info.memoryTypeIndex = 0;
42
43 vkt::DeviceMemory memory_1(*m_device, memory_allocate_info);
44 vkt::DeviceMemory memory_2(*m_device, memory_allocate_info);
45 VkDebugMarkerObjectNameInfoEXT name_info = vku::InitStructHelper();
46 name_info.object = (uint64_t)memory_2.handle();
47 name_info.objectType = VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT;
48 name_info.pObjectName = memory_name.c_str();
49 vk::DebugMarkerSetObjectNameEXT(device(), &name_info);
50
51 vk::BindBufferMemory(device(), buffer, memory_1, 0);
52
53 // Test core_validation layer
54 m_errorMonitor->SetDesiredError(memory_name.c_str());
55 vk::BindBufferMemory(device(), buffer, memory_2, 0);
56 m_errorMonitor->VerifyFound();
57
58 VkCommandBuffer commandBuffer;
59 std::string commandBuffer_name = "command_buffer_name";
60 VkCommandPoolCreateInfo pool_create_info = vku::InitStructHelper();
61 pool_create_info.queueFamilyIndex = m_device->graphics_queue_node_index_;
62 pool_create_info.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
63 vkt::CommandPool command_pool_1(*m_device, pool_create_info);
64 vkt::CommandPool command_pool_2(*m_device, pool_create_info);
65
66 VkCommandBufferAllocateInfo command_buffer_allocate_info = vku::InitStructHelper();
67 command_buffer_allocate_info.commandPool = command_pool_1;
68 command_buffer_allocate_info.commandBufferCount = 1;
69 command_buffer_allocate_info.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
70 vk::AllocateCommandBuffers(device(), &command_buffer_allocate_info, &commandBuffer);
71
72 name_info.object = (uint64_t)commandBuffer;
73 name_info.objectType = VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT;
74 name_info.pObjectName = commandBuffer_name.c_str();
75 vk::DebugMarkerSetObjectNameEXT(device(), &name_info);
76

Callers

nothing calls this directly

Calls 15

BindBufferMemoryFunction · 0.85
AllocateCommandBuffersFunction · 0.85
CmdSetScissorFunction · 0.85
FreeCommandBuffersFunction · 0.85

Tested by

no test coverage detected