From 53e3a7b4eb4d0d14d936c9a55bfdbb5019973729 Mon Sep 17 00:00:00 2001 From: Joe Withers Date: Mon, 30 Jan 2023 17:32:24 +0000 Subject: [PATCH] Fix tolerance values when VK_COMPONENT_SWIZZLE_ONE is in use Tolerance values were being increased unnecessarily for tests using VK_COMPONENT_SWIZZLE_ONE. This change overwrites any SWIZZLE_ONE with SWIZZLE_ZERO when applying a swizzle to the threshold values, to maintain a strict tolerance. Affects: dEQP-VK.pipeline.sampler.border_swizzle.* Components: Vulkan Change-Id: Ie72e4a97e502bdbb74ea412951f5a9481434d489 --- .../pipeline/vktPipelineSamplerBorderSwizzleTests.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineSamplerBorderSwizzleTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineSamplerBorderSwizzleTests.cpp index aa15eaf..89b73e7 100644 --- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineSamplerBorderSwizzleTests.cpp +++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineSamplerBorderSwizzleTests.cpp @@ -452,6 +452,15 @@ bool comparePixelToColorClearValue (const TestParams& params, const auto channelClass = getTextureChannelClass(textureFormat.type); // We must compare all available channels in the color buffer to check RGBA conversion. const auto channelMask = getTextureFormatChannelMask(bufferFormat); + // If the component mapping contains a SWIZZLE_ONE, overwrite this with a SWIZZLE_ZERO to ensure + // a strict tolerance when applying a swizzle of SWIZZLE_ONE to the threshold. + const VkComponentMapping thresholdComponentMapping = + { + (params.componentMapping.r == VK_COMPONENT_SWIZZLE_ONE ? VK_COMPONENT_SWIZZLE_ZERO : params.componentMapping.r), + (params.componentMapping.g == VK_COMPONENT_SWIZZLE_ONE ? VK_COMPONENT_SWIZZLE_ZERO : params.componentMapping.g), + (params.componentMapping.b == VK_COMPONENT_SWIZZLE_ONE ? VK_COMPONENT_SWIZZLE_ZERO : params.componentMapping.b), + (params.componentMapping.a == VK_COMPONENT_SWIZZLE_ONE ? VK_COMPONENT_SWIZZLE_ZERO : params.componentMapping.a), + }; switch (channelClass) { @@ -484,7 +493,7 @@ bool comparePixelToColorClearValue (const TestParams& params, } // Apply swizzle and gather to thresholds. - threshold = applySwizzle(threshold, params.componentMapping); + threshold = applySwizzle(threshold, thresholdComponentMapping); if (params.componentGather) threshold = applyGather(threshold, *params.componentGather); @@ -530,7 +539,7 @@ bool comparePixelToColorClearValue (const TestParams& params, } // Apply swizzle and gather to thresholds. - threshold = applySwizzle(threshold, params.componentMapping); + threshold = applySwizzle(threshold, thresholdComponentMapping); if (params.componentGather) threshold = applyGather(threshold, *params.componentGather); @@ -576,7 +585,7 @@ bool comparePixelToColorClearValue (const TestParams& params, } // Apply swizzle and gather to thresholds. - threshold = applySwizzle(threshold, params.componentMapping); + threshold = applySwizzle(threshold, thresholdComponentMapping); if (params.componentGather) threshold = applyGather(threshold, *params.componentGather); @@ -625,7 +634,7 @@ bool comparePixelToColorClearValue (const TestParams& params, } // Apply swizzle and gather to thresholds. - threshold = applySwizzle(threshold, params.componentMapping); + threshold = applySwizzle(threshold, thresholdComponentMapping); if (params.componentGather) threshold = applyGather(threshold, *params.componentGather); -- 2.7.4