| 25 | class NegativeDeviceAddressCommands : public DeviceAddressCommands {}; |
| 26 | |
| 27 | TEST_F(NegativeDeviceAddressCommands, CopyProtectedFlag) { |
| 28 | TEST_DESCRIPTION("Use addressFlags protected bit in an unprotected command buffer"); |
| 29 | RETURN_IF_SKIP(InitBasicDeviceAddressCommands()); |
| 30 | |
| 31 | VkPhysicalDeviceVulkan11Properties props11 = vku::InitStructHelper(); |
| 32 | GetPhysicalDeviceProperties2(props11); |
| 33 | if (props11.protectedNoFault) { |
| 34 | GTEST_SKIP() << "Test requires protectedNoFault to be VK_FALSE"; |
| 35 | } |
| 36 | |
| 37 | vkt::Buffer buffer(*m_device, 32u * 32u * 4u, VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, |
| 38 | vkt::device_address); |
| 39 | vkt::Image image(*m_device, 32u, 32u, VK_FORMAT_R8G8B8A8_UNORM, |
| 40 | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT); |
| 41 | |
| 42 | VkDeviceMemoryImageCopyKHR region = vku::InitStructHelper(); |
| 43 | region.addressRange = buffer.AddressRange(); |
| 44 | region.addressFlags = VK_ADDRESS_COMMAND_PROTECTED_BIT_KHR; |
| 45 | region.addressRowLength = 0u; |
| 46 | region.addressImageHeight = 0u; |
| 47 | region.imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0u, 0u, 1u}; |
| 48 | region.imageLayout = VK_IMAGE_LAYOUT_GENERAL; |
| 49 | region.imageOffset = {0, 0, 0}; |
| 50 | region.imageExtent = {32u, 32u, 1u}; |
| 51 | |
| 52 | VkCopyDeviceMemoryImageInfoKHR copy_memory_info = vku::InitStructHelper(); |
| 53 | copy_memory_info.image = image; |
| 54 | copy_memory_info.regionCount = 1u; |
| 55 | copy_memory_info.pRegions = ®ion; |
| 56 | |
| 57 | m_command_buffer.Begin(); |
| 58 | image.SetLayout(m_command_buffer, VK_IMAGE_LAYOUT_GENERAL); |
| 59 | |
| 60 | m_errorMonitor->SetDesiredError("VUID-VkDeviceMemoryImageCopyKHR-addressRange-13099"); |
| 61 | m_errorMonitor->SetDesiredError("VUID-vkCmdCopyMemoryToImageKHR-commandBuffer-13102"); |
| 62 | vk::CmdCopyMemoryToImageKHR(m_command_buffer, ©_memory_info); |
| 63 | m_errorMonitor->VerifyFound(); |
| 64 | |
| 65 | m_errorMonitor->SetDesiredError("VUID-VkDeviceMemoryImageCopyKHR-addressRange-13099"); |
| 66 | m_errorMonitor->SetDesiredError("VUID-vkCmdCopyImageToMemoryKHR-commandBuffer-13102"); |
| 67 | vk::CmdCopyImageToMemoryKHR(m_command_buffer, ©_memory_info); |
| 68 | m_errorMonitor->VerifyFound(); |
| 69 | |
| 70 | m_command_buffer.End(); |
| 71 | } |
| 72 | |
| 73 | TEST_F(NegativeDeviceAddressCommands, TransferQueueAddressRange) { |
| 74 | TEST_DESCRIPTION("Use invalid address in a transfer queue"); |
nothing calls this directly
no test coverage detected