From 4f81dc7aeeb1bc6e6542e5460b81eb647273d360 Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Tue, 15 Nov 2016 09:38:51 -0700 Subject: [PATCH] tests: Add LVTs for MapMemRange device limits Tacked them onto InvalidMemoryMapping test. Change-Id: I62a094461730bcac14649a2ad6adf5cfdd0f2c58 --- tests/layer_validation_tests.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp index d10b5cf..97a8008 100644 --- a/tests/layer_validation_tests.cpp +++ b/tests/layer_validation_tests.cpp @@ -1484,6 +1484,29 @@ TEST_F(VkLayerTest, InvalidMemoryMapping) { vkFlushMappedMemoryRanges(m_device->device(), 1, &mmr); m_errorMonitor->VerifyFound(); + // Some platforms have an atomsize of 1 which makes the test meaningless + if (atom_size > 3) { + // Now with an offset NOT a multiple of the device limit + vkUnmapMemory(m_device->device(), mem); + err = vkMapMemory(m_device->device(), mem, 0, 4 * atom_size, 0, (void **)&pData); + ASSERT_VK_SUCCESS(err); + mmr.offset = 3; // Not a multiple of atom_size + mmr.size = VK_WHOLE_SIZE; + m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00644); + vkFlushMappedMemoryRanges(m_device->device(), 1, &mmr); + m_errorMonitor->VerifyFound(); + + // Now with a size NOT a multiple of the device limit + vkUnmapMemory(m_device->device(), mem); + err = vkMapMemory(m_device->device(), mem, 0, 4 * atom_size, 0, (void **)&pData); + ASSERT_VK_SUCCESS(err); + mmr.offset = atom_size; + mmr.size = 2 * atom_size + 1; // Not a multiple of atom_size + m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, VALIDATION_ERROR_00645); + vkFlushMappedMemoryRanges(m_device->device(), 1, &mmr); + m_errorMonitor->VerifyFound(); + } + pass = m_device->phy().set_memory_type(mem_reqs.memoryTypeBits, &alloc_info, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); if (!pass) { -- 2.7.4