diff options
author | Ella Stanforth <ella@iglunix.org> | 2022-09-23 13:35:47 +0000 |
---|---|---|
committer | Chia-I Wu <olv@google.com> | 2023-08-16 23:58:11 +0000 |
commit | 1ca8937765a440e9897aeb6f7dac1a883410800b (patch) | |
tree | 9b49448529d2ba8fd87956e9f79d1d9bbfdd92b7 | |
parent | fcaca77d640e353d4a0a8738a667d2681f19bfba (diff) | |
download | deqp-1ca8937765a440e9897aeb6f7dac1a883410800b.tar.gz |
RESTRICT AUTOMERGE: Fix premature unmap of output buffer in dEQP-VK.ycbcr.storage_image_write.*
Components: Vulkan
VK-GL-CTS issue: 4068
Affects:
dEQP-VK.ycbcr.storage_image_write.*
(cherry picked from commit 4fa2b40411921b304f5dad8d106b212ad5b0f172)
Bug: 296156645
Test: dEQP-VK.ycbcr.storage_image_write.*
Change-Id: I863470a9a0314792c243853b02ae95bad3830f65
-rw-r--r-- | external/vulkancts/modules/vulkan/ycbcr/vktYCbCrStorageImageWriteTests.cpp | 170 |
1 files changed, 85 insertions, 85 deletions
diff --git a/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrStorageImageWriteTests.cpp b/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrStorageImageWriteTests.cpp index 327f52f28..ceda962c4 100644 --- a/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrStorageImageWriteTests.cpp +++ b/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrStorageImageWriteTests.cpp @@ -351,101 +351,101 @@ tcu::TestStatus testStorageImageWrite (Context& context, TestParameters params) for (deUint32 planeNdx = 0; planeNdx < formatDescription.numPlanes; ++planeNdx) planePointers[planeNdx] = outputData + static_cast<size_t>(planeOffsets[planeNdx]); - } - // write result images to log file - for (deUint32 channelNdx = 0; channelNdx < 4; ++channelNdx) - { - if (!formatDescription.hasChannelNdx(channelNdx)) - continue; - deUint32 planeNdx = formatDescription.channels[channelNdx].planeNdx; - vk::VkFormat planeCompatibleFormat = getPlaneCompatibleFormatForWriting(formatDescription, planeNdx); - vk::PlanarFormatDescription compatibleFormatDescription = (planeCompatibleFormat != getPlaneCompatibleFormat(formatDescription, planeNdx)) ? getPlanarFormatDescription(planeCompatibleFormat) : formatDescription; - const tcu::UVec3 compatibleShaderGridSize ( params.size.x() / formatDescription.blockWidth, params.size.y() / formatDescription.blockHeight, params.size.z() / 1u ); - tcu::ConstPixelBufferAccess pixelBuffer = vk::getChannelAccess(compatibleFormatDescription, compatibleShaderGridSize, planeRowPitches, (const void* const*)planePointers, channelNdx); - std::ostringstream str; - str << "image" << channelNdx; - context.getTestContext().getLog() << tcu::LogImage(str.str(), str.str(), pixelBuffer); - } + // write result images to log file + for (deUint32 channelNdx = 0; channelNdx < 4; ++channelNdx) + { + if (!formatDescription.hasChannelNdx(channelNdx)) + continue; + deUint32 planeNdx = formatDescription.channels[channelNdx].planeNdx; + vk::VkFormat planeCompatibleFormat = getPlaneCompatibleFormatForWriting(formatDescription, planeNdx); + vk::PlanarFormatDescription compatibleFormatDescription = (planeCompatibleFormat != getPlaneCompatibleFormat(formatDescription, planeNdx)) ? getPlanarFormatDescription(planeCompatibleFormat) : formatDescription; + const tcu::UVec3 compatibleShaderGridSize ( params.size.x() / formatDescription.blockWidth, params.size.y() / formatDescription.blockHeight, params.size.z() / 1u ); + tcu::ConstPixelBufferAccess pixelBuffer = vk::getChannelAccess(compatibleFormatDescription, compatibleShaderGridSize, planeRowPitches, (const void* const*)planePointers, channelNdx); + std::ostringstream str; + str << "image" << channelNdx; + context.getTestContext().getLog() << tcu::LogImage(str.str(), str.str(), pixelBuffer); + } - // verify data - const float epsilon = 1e-5f; - for (deUint32 channelNdx = 0; channelNdx < 4; ++channelNdx) - { - if (!formatDescription.hasChannelNdx(channelNdx)) - continue; - - deUint32 planeNdx = formatDescription.channels[channelNdx].planeNdx; - vk::VkFormat planeCompatibleFormat = getPlaneCompatibleFormatForWriting(formatDescription, planeNdx); - vk::PlanarFormatDescription compatibleFormatDescription = (planeCompatibleFormat != getPlaneCompatibleFormat(formatDescription, planeNdx)) ? getPlanarFormatDescription(planeCompatibleFormat) : formatDescription; - const tcu::UVec3 compatibleShaderGridSize ( params.size.x() / formatDescription.blockWidth, params.size.y() / formatDescription.blockHeight, params.size.z() / 1u ); - VkExtent3D compatibleImageSize { imageCreateInfo.extent.width / formatDescription.blockWidth, imageCreateInfo.extent.height / formatDescription.blockHeight, imageCreateInfo.extent.depth / 1u }; - tcu::ConstPixelBufferAccess pixelBuffer = vk::getChannelAccess(compatibleFormatDescription, compatibleShaderGridSize, planeRowPitches, (const void* const*)planePointers, channelNdx); - VkExtent3D planeExtent = getPlaneExtent(compatibleFormatDescription, compatibleImageSize, planeNdx, 0u); - tcu::IVec3 pixelDivider = pixelBuffer.getDivider(); - - for (deUint32 offsetZ = 0u; offsetZ < planeExtent.depth; ++offsetZ) - for (deUint32 offsetY = 0u; offsetY < planeExtent.height; ++offsetY) - for (deUint32 offsetX = 0u; offsetX < planeExtent.width; ++offsetX) + // verify data + const float epsilon = 1e-5f; + for (deUint32 channelNdx = 0; channelNdx < 4; ++channelNdx) { - deUint32 iReferenceValue; - float fReferenceValue; - switch (channelNdx) - { - case 0: - iReferenceValue = offsetX % 127u; - fReferenceValue = static_cast<float>(iReferenceValue) / 127.f; - break; - case 1: - iReferenceValue = offsetY % 127u; - fReferenceValue = static_cast<float>(iReferenceValue) / 127.f; - break; - case 2: - iReferenceValue = offsetZ % 127u; - fReferenceValue = static_cast<float>(iReferenceValue) / 127.f; - break; - case 3: - iReferenceValue = 0u; - fReferenceValue = 0.f; - break; - default: DE_FATAL("Unexpected channel index"); break; - } - float acceptableError = epsilon; + if (!formatDescription.hasChannelNdx(channelNdx)) + continue; - switch (formatDescription.channels[channelNdx].type) + deUint32 planeNdx = formatDescription.channels[channelNdx].planeNdx; + vk::VkFormat planeCompatibleFormat = getPlaneCompatibleFormatForWriting(formatDescription, planeNdx); + vk::PlanarFormatDescription compatibleFormatDescription = (planeCompatibleFormat != getPlaneCompatibleFormat(formatDescription, planeNdx)) ? getPlanarFormatDescription(planeCompatibleFormat) : formatDescription; + const tcu::UVec3 compatibleShaderGridSize ( params.size.x() / formatDescription.blockWidth, params.size.y() / formatDescription.blockHeight, params.size.z() / 1u ); + VkExtent3D compatibleImageSize { imageCreateInfo.extent.width / formatDescription.blockWidth, imageCreateInfo.extent.height / formatDescription.blockHeight, imageCreateInfo.extent.depth / 1u }; + tcu::ConstPixelBufferAccess pixelBuffer = vk::getChannelAccess(compatibleFormatDescription, compatibleShaderGridSize, planeRowPitches, (const void* const*)planePointers, channelNdx); + VkExtent3D planeExtent = getPlaneExtent(compatibleFormatDescription, compatibleImageSize, planeNdx, 0u); + tcu::IVec3 pixelDivider = pixelBuffer.getDivider(); + + for (deUint32 offsetZ = 0u; offsetZ < planeExtent.depth; ++offsetZ) + for (deUint32 offsetY = 0u; offsetY < planeExtent.height; ++offsetY) + for (deUint32 offsetX = 0u; offsetX < planeExtent.width; ++offsetX) { - case tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER: - case tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER: + deUint32 iReferenceValue; + float fReferenceValue; + switch (channelNdx) { - tcu::UVec4 outputValue = pixelBuffer.getPixelUint(offsetX * pixelDivider.x(), offsetY * pixelDivider.y(), 0); - - if (outputValue.x() != iReferenceValue) - return tcu::TestStatus::fail("Failed"); - - break; + case 0: + iReferenceValue = offsetX % 127u; + fReferenceValue = static_cast<float>(iReferenceValue) / 127.f; + break; + case 1: + iReferenceValue = offsetY % 127u; + fReferenceValue = static_cast<float>(iReferenceValue) / 127.f; + break; + case 2: + iReferenceValue = offsetZ % 127u; + fReferenceValue = static_cast<float>(iReferenceValue) / 127.f; + break; + case 3: + iReferenceValue = 0u; + fReferenceValue = 0.f; + break; + default: DE_FATAL("Unexpected channel index"); break; } - case tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT: - case tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT: - { - float fixedPointError = tcu::TexVerifierUtil::computeFixedPointError(formatDescription.channels[channelNdx].sizeBits); - acceptableError += fixedPointError; - tcu::Vec4 outputValue = pixelBuffer.getPixel(offsetX * pixelDivider.x(), offsetY * pixelDivider.y(), 0); - - if (deAbs(outputValue.x() - fReferenceValue) > acceptableError) - return tcu::TestStatus::fail("Failed"); + float acceptableError = epsilon; - break; - } - case tcu::TEXTURECHANNELCLASS_FLOATING_POINT: + switch (formatDescription.channels[channelNdx].type) { - const tcu::Vec4 outputValue = pixelBuffer.getPixel(offsetX * pixelDivider.x(), offsetY * pixelDivider.y(), 0); - - if (deAbs( outputValue.x() - fReferenceValue) > acceptableError) - return tcu::TestStatus::fail("Failed"); - - break; + case tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER: + case tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER: + { + tcu::UVec4 outputValue = pixelBuffer.getPixelUint(offsetX * pixelDivider.x(), offsetY * pixelDivider.y(), 0); + + if (outputValue.x() != iReferenceValue) + return tcu::TestStatus::fail("Failed"); + + break; + } + case tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT: + case tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT: + { + float fixedPointError = tcu::TexVerifierUtil::computeFixedPointError(formatDescription.channels[channelNdx].sizeBits); + acceptableError += fixedPointError; + tcu::Vec4 outputValue = pixelBuffer.getPixel(offsetX * pixelDivider.x(), offsetY * pixelDivider.y(), 0); + + if (deAbs(outputValue.x() - fReferenceValue) > acceptableError) + return tcu::TestStatus::fail("Failed"); + + break; + } + case tcu::TEXTURECHANNELCLASS_FLOATING_POINT: + { + const tcu::Vec4 outputValue = pixelBuffer.getPixel(offsetX * pixelDivider.x(), offsetY * pixelDivider.y(), 0); + + if (deAbs( outputValue.x() - fReferenceValue) > acceptableError) + return tcu::TestStatus::fail("Failed"); + + break; + } + default: DE_FATAL("Unexpected channel type"); break; } - default: DE_FATAL("Unexpected channel type"); break; } } } |