From: Piers Daniell Date: Wed, 25 Nov 2020 21:53:32 +0000 (-0700) Subject: Update AccessInstance::verifyResult() to support 64-bit types X-Git-Tag: upstream/1.3.5~320^2~51 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e64b33d236f1bcce47e46e42b248164951b916b4;p=platform%2Fupstream%2FVK-GL-CTS.git Update AccessInstance::verifyResult() to support 64-bit types When 64-bit support was added to the dEQP-VK.robustness.buffer_access.through_pointers.* tests in https://gerrit.khronos.org/#/c/5835/ the AccessInstance::verifyResult() function was not updated to take the new 8 byte element sizes. It assumed all accesses were in units of 4 bytes, which doesn't work for 64-bit types which have accesses in units of 8 bytes. Affects: dEQP-VK.robustness.buffer_access.through_pointers.* Components: Vulkan VK-GL-CTS issue: 2670 Change-Id: I4656376f127bc4cf6eeaa80ed71aaa3f265e0aac (cherry picked from commit 96ce07e58b7a6ec199c9e4b01de43f5b610a5461) --- diff --git a/external/vulkancts/modules/vulkan/robustness/vktRobustBufferAccessWithVariablePointersTests.cpp b/external/vulkancts/modules/vulkan/robustness/vktRobustBufferAccessWithVariablePointersTests.cpp index ba95be4..52ff86d 100644 --- a/external/vulkancts/modules/vulkan/robustness/vktRobustBufferAccessWithVariablePointersTests.cpp +++ b/external/vulkancts/modules/vulkan/robustness/vktRobustBufferAccessWithVariablePointersTests.cpp @@ -1550,9 +1550,9 @@ bool AccessInstance::isExpectedValueFromInBuffer (VkDeviceSize offsetInBytes, bool AccessInstance::isOutBufferValueUnchanged (VkDeviceSize offsetInBytes, VkDeviceSize valueSize) { - DE_ASSERT(valueSize <= 4); + DE_ASSERT(valueSize <= 8); const deUint8 *const outValuePtr = (deUint8*)m_outBufferAlloc->getHostPtr() + offsetInBytes; - const deUint32 defaultValue = 0xBABABABAu; + const deUint64 defaultValue = 0xBABABABABABABABAull; return !deMemCmp(outValuePtr, &defaultValue, (size_t)valueSize); } @@ -1612,11 +1612,13 @@ bool AccessInstance::verifyResult (void) bool allOk = true; deUint32 valueNdx = 0; const VkDeviceSize maxAccessRange = isReadAccess ? m_inBufferAccess.maxAccessRange : m_outBufferAccess.maxAccessRange; + const bool isR64 = (m_bufferFormat == VK_FORMAT_R64_UINT || m_bufferFormat == VK_FORMAT_R64_SINT); + const deUint32 elementSize = isR64 ? 8 : 4; - for (VkDeviceSize offsetInBytes = 0; offsetInBytes < m_outBufferAccess.allocSize; offsetInBytes += 4) + for (VkDeviceSize offsetInBytes = 0; offsetInBytes < m_outBufferAccess.allocSize; offsetInBytes += elementSize) { const deUint8* outValuePtr = static_cast(outDataPtr) + offsetInBytes; - const size_t outValueSize = static_cast(deMinu64(4, (m_outBufferAccess.allocSize - offsetInBytes))); + const size_t outValueSize = static_cast(deMinu64(elementSize, (m_outBufferAccess.allocSize - offsetInBytes))); if (offsetInBytes >= RobustAccessWithPointersTest::s_numberOfBytesAccessed) { @@ -1642,23 +1644,23 @@ bool AccessInstance::verifyResult (void) isOutOfBoundsAccess = true; // Check if the shader operation accessed an operand located less than 16 bytes away - // from the out of bounds address. - if (!isOutOfBoundsAccess && distanceToOutOfBounds < 16) + // from the out of bounds address. Less than 32 bytes away for 64 bit accesses. + if (!isOutOfBoundsAccess && distanceToOutOfBounds < (isR64 ? 32 : 16)) { deUint32 operandSize = 0; switch (m_shaderType) { case SHADER_TYPE_SCALAR_COPY: - operandSize = 4; // Size of scalar + operandSize = elementSize; // Size of scalar break; case SHADER_TYPE_VECTOR_COPY: - operandSize = 4 * 4; // Size of vec4 + operandSize = elementSize * 4; // Size of vec4 break; case SHADER_TYPE_MATRIX_COPY: - operandSize = 4 * 16; // Size of mat4 + operandSize = elementSize * 16; // Size of mat4 break; default: @@ -1672,7 +1674,7 @@ bool AccessInstance::verifyResult (void) { logMsg << " (out of bounds " << (isReadAccess ? "read": "write") << ")"; - const bool isValuePartiallyOutOfBounds = ((distanceToOutOfBounds > 0) && ((deUint32)distanceToOutOfBounds < 4)); + const bool isValuePartiallyOutOfBounds = ((distanceToOutOfBounds > 0) && ((deUint32)distanceToOutOfBounds < elementSize)); bool isValidValue = false; if (isValuePartiallyOutOfBounds && !m_accessOutOfBackingMemory)