From 8f813ac8a242d8d20fa34a25320cc25a41293301 Mon Sep 17 00:00:00 2001 From: Idan Raiter Date: Tue, 11 Jun 2019 19:05:45 +0000 Subject: [PATCH] Fix indirect draw test for MSVC We need a negative number in a buffer of uint32_t, to test negative baseVertex. MSVC requires an explicit cast here. Bug: dawn:172 Change-Id: Iea6c609f11054ba02e5c041fff89def0557c8091 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8060 Commit-Queue: Idan Raiter Reviewed-by: Kai Ninomiya --- src/tests/end2end/DrawIndexedIndirectTests.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tests/end2end/DrawIndexedIndirectTests.cpp b/src/tests/end2end/DrawIndexedIndirectTests.cpp index c525735949..a02bd052f2 100644 --- a/src/tests/end2end/DrawIndexedIndirectTests.cpp +++ b/src/tests/end2end/DrawIndexedIndirectTests.cpp @@ -135,12 +135,16 @@ TEST_P(DrawIndexedIndirectTest, BaseVertex) { // Test a draw with only the last 3 indices of the second quad (bottom left triangle) Test({3, 1, 3, 4, 0}, 0, 0, filled, notFilled); + const int negFour = -4; + uint32_t unsignedNegFour; + std::memcpy(&unsignedNegFour, &negFour, sizeof(int)); + // Test negative baseVertex // Test a draw with only the first 3 indices of the first quad (bottom left triangle) - Test({3, 1, 0, -4, 0}, 6 * sizeof(uint32_t), 0, filled, notFilled); + Test({3, 1, 0, unsignedNegFour, 0}, 6 * sizeof(uint32_t), 0, filled, notFilled); // Test a draw with only the last 3 indices of the first quad (top right triangle) - Test({3, 1, 3, -4, 0}, 6 * sizeof(uint32_t), 0, notFilled, filled); + Test({3, 1, 3, unsignedNegFour, 0}, 6 * sizeof(uint32_t), 0, notFilled, filled); } TEST_P(DrawIndexedIndirectTest, IndirectOffset) {