diff options
author | Chris Forbes <chrisforbes@google.com> | 2017-05-01 10:20:17 -0700 |
---|---|---|
committer | Chris Forbes <chrisf@ijw.co.nz> | 2017-05-01 11:21:04 -0700 |
commit | ca472cf81919f5b020ccba721d2b7b56c39301aa (patch) | |
tree | 2012bcf25be7a1baa27bf1b3f593b5d265c35f96 | |
parent | 05477536556e06581582baff88020ecb05411216 (diff) |
tests: Fix LongSemaphoreChain bad indexing
If semaphores.size() == 1, we'd call operator[] with -1. You get away
with this on most STLs, but the MS debug STL (right) complains that this
is nonsense.
-rw-r--r-- | tests/layer_validation_tests.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp index c28c4a40..ddf23458 100644 --- a/tests/layer_validation_tests.cpp +++ b/tests/layer_validation_tests.cpp @@ -23286,8 +23286,15 @@ TEST_F(VkPositiveLayerTest, LongSemaphoreChain) semaphores.push_back(semaphore); - VkSubmitInfo si = { VK_STRUCTURE_TYPE_SUBMIT_INFO, nullptr, semaphores.size() > 1 ? 1u : 0u, &semaphores[semaphores.size() - 2], &flags, - 0, nullptr, 1, &semaphores[semaphores.size() - 1] }; + VkSubmitInfo si = {VK_STRUCTURE_TYPE_SUBMIT_INFO, + nullptr, + semaphores.size() > 1 ? 1u : 0u, + semaphores.size() > 1 ? &semaphores[semaphores.size() - 2] : nullptr, + &flags, + 0, + nullptr, + 1, + &semaphores[semaphores.size() - 1]}; err = vkQueueSubmit(m_device->m_queue, 1, &si, VK_NULL_HANDLE); ASSERT_VK_SUCCESS(err); } |