Skip to content
Permalink
Browse files

Fix vkGetPhysicalDevicePresentRectanglesKHR() call

Removed the 'if' that forced the execution of this function when
present mode was
VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR, so now it can
be tested on other present modes.

Affected tests:

   dEQP-VK.wsi.*.surface.query_devgroup_present_modes

Components: Vulkan
VK-GL-CTS issue: 1428

Change-Id: Ife8820e4f15091e350acf60d758d983c26056e5f
  • Loading branch information...
samuelig authored and alegal-arm committed Apr 12, 2019
1 parent 60bfdbb commit 3d219c93a4366f5167b4a49fc6df69f7987d7305
Showing with 37 additions and 40 deletions.
  1. +37 −40 external/vulkancts/modules/vulkan/wsi/vktWsiSurfaceTests.cpp
@@ -1061,58 +1061,55 @@ tcu::TestStatus queryDevGroupSurfacePresentModesTest (Context& context, Type wsi
*presentModeFlags > maxValidFlag)
return tcu::TestStatus::fail("queryDevGroupSurfacePresentModesTest flag not valid");

// Check presentation rectangles
if (*presentModeFlags == VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR)
for (size_t physDevIdx = 0; physDevIdx < deviceGroupProps[devGroupIdx].physicalDeviceCount; physDevIdx++)
{
for (size_t physDevIdx = 0; physDevIdx < deviceGroupProps[devGroupIdx].physicalDeviceCount; physDevIdx++)
{
VK_CHECK(instHelper.vki.getPhysicalDevicePresentRectanglesKHR(deviceGroupProps[devGroupIdx].physicalDevices[physDevIdx], *surface, &rectCount, DE_NULL));
rectanglesBuffer.resize(sizeof(VkRect2D) * rectCount + GUARD_SIZE);
presentRectangles = reinterpret_cast<VkRect2D*>(rectanglesBuffer.data());
deMemset(rectanglesBuffer.data(), GUARD_VALUE, rectanglesBuffer.size());
VK_CHECK(instHelper.vki.getPhysicalDevicePresentRectanglesKHR(deviceGroupProps[devGroupIdx].physicalDevices[physDevIdx], *surface, &rectCount, DE_NULL));
rectanglesBuffer.resize(sizeof(VkRect2D) * rectCount + GUARD_SIZE);
presentRectangles = reinterpret_cast<VkRect2D*>(rectanglesBuffer.data());
deMemset(rectanglesBuffer.data(), GUARD_VALUE, rectanglesBuffer.size());

VK_CHECK(instHelper.vki.getPhysicalDevicePresentRectanglesKHR(deviceGroupProps[devGroupIdx].physicalDevices[physDevIdx], *surface, &rectCount, presentRectangles));
VK_CHECK(instHelper.vki.getPhysicalDevicePresentRectanglesKHR(deviceGroupProps[devGroupIdx].physicalDevices[physDevIdx], *surface, &rectCount, presentRectangles));

// Guard check
for (deInt32 ndx = 0; ndx < GUARD_SIZE; ndx++)
// Guard check
for (deInt32 ndx = 0; ndx < GUARD_SIZE; ndx++)
{
if (rectanglesBuffer[ndx + sizeof(VkRect2D) * rectCount] != GUARD_VALUE)
{
if (rectanglesBuffer[ndx + sizeof(VkRect2D) * rectCount] != GUARD_VALUE)
{
log << TestLog::Message << "getPhysicalDevicePresentRectanglesKHR - Guard offset " << ndx << " not valid" << TestLog::EndMessage;
return tcu::TestStatus::fail("getPhysicalDevicePresentRectanglesKHR buffer overflow");
}
log << TestLog::Message << "getPhysicalDevicePresentRectanglesKHR - Guard offset " << ndx << " not valid" << TestLog::EndMessage;
return tcu::TestStatus::fail("getPhysicalDevicePresentRectanglesKHR buffer overflow");
}
}

// Check rectangles do not overlap
for (size_t rectIdx1 = 0; rectIdx1 < rectCount; rectIdx1++)
// Check rectangles do not overlap
for (size_t rectIdx1 = 0; rectIdx1 < rectCount; rectIdx1++)
{
for (size_t rectIdx2 = 0; rectIdx2 < rectCount; rectIdx2++)
{
for (size_t rectIdx2 = 0; rectIdx2 < rectCount; rectIdx2++)
if (rectIdx1 != rectIdx2)
{
if (rectIdx1 != rectIdx2)
{
deUint32 rectATop = presentRectangles[rectIdx1].offset.y;
deUint32 rectALeft = presentRectangles[rectIdx1].offset.x;
deUint32 rectABottom = presentRectangles[rectIdx1].offset.y + presentRectangles[rectIdx1].extent.height;
deUint32 rectARight = presentRectangles[rectIdx1].offset.x + presentRectangles[rectIdx1].extent.width;

deUint32 rectBTop = presentRectangles[rectIdx2].offset.y;
deUint32 rectBLeft = presentRectangles[rectIdx2].offset.x;
deUint32 rectBBottom = presentRectangles[rectIdx2].offset.y + presentRectangles[rectIdx2].extent.height;
deUint32 rectBRight = presentRectangles[rectIdx2].offset.x + presentRectangles[rectIdx2].extent.width;

if (rectALeft < rectBRight && rectARight > rectBLeft &&
rectATop < rectBBottom && rectABottom > rectBTop)
return tcu::TestStatus::fail("getPhysicalDevicePresentRectanglesKHR rectangles overlap");
}
deUint32 rectATop = presentRectangles[rectIdx1].offset.y;
deUint32 rectALeft = presentRectangles[rectIdx1].offset.x;
deUint32 rectABottom = presentRectangles[rectIdx1].offset.y + presentRectangles[rectIdx1].extent.height;
deUint32 rectARight = presentRectangles[rectIdx1].offset.x + presentRectangles[rectIdx1].extent.width;

deUint32 rectBTop = presentRectangles[rectIdx2].offset.y;
deUint32 rectBLeft = presentRectangles[rectIdx2].offset.x;
deUint32 rectBBottom = presentRectangles[rectIdx2].offset.y + presentRectangles[rectIdx2].extent.height;
deUint32 rectBRight = presentRectangles[rectIdx2].offset.x + presentRectangles[rectIdx2].extent.width;

if (rectALeft < rectBRight && rectARight > rectBLeft &&
rectATop < rectBBottom && rectABottom > rectBTop)
return tcu::TestStatus::fail("getPhysicalDevicePresentRectanglesKHR rectangles overlap");
}
}

// Check incomplete
incompleteRectCount = rectCount / 2;
result = instHelper.vki.getPhysicalDevicePresentRectanglesKHR(deviceGroupProps[devGroupIdx].physicalDevices[physDevIdx], *surface, &incompleteRectCount, presentRectangles);
results.check(result == VK_INCOMPLETE, "Expected VK_INCOMPLETE");
}

// Check incomplete
incompleteRectCount = rectCount / 2;
result = instHelper.vki.getPhysicalDevicePresentRectanglesKHR(deviceGroupProps[devGroupIdx].physicalDevices[physDevIdx], *surface, &incompleteRectCount, presentRectangles);
results.check(result == VK_INCOMPLETE, "Expected VK_INCOMPLETE");
}

return tcu::TestStatus(results.getResult(), results.getMessage());
}

0 comments on commit 3d219c9

Please sign in to comment.
You can’t perform that action at this time.