copies_and_blitting: fix ambiguous signed normalized 1.0 value
authorSlawomir Cygan <slawomir.cygan@intel.com>
Thu, 6 Jul 2017 17:24:18 +0000 (19:24 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Sun, 16 Jul 2017 12:52:27 +0000 (08:52 -0400)
commitbce4ec47056a0473ccce9cf7951023da80c3b745
tree313c3121a829e296c69a23be0931cbcfa18754af
parent1bea8d8112a20b1380cca52b401ac035642afe3c
copies_and_blitting: fix ambiguous signed normalized 1.0 value

Below tests copy floats to signed normalized 8-bit values.
In that process it happens that 1.0 float value is copied to 8_snorm
elements as: {0x00, 0x00, 0x80, 0x3f}

According to spec, on SNORM values:

"Note that while zero is exactly expressible in this representation,
one value (-128 in the example) is outside the representable range,
and must be clamped before use."

The problem occurs when 0x80 == 128 value is copied to buffer:
as it falls outside of <-1,1> range, it may be clamped to 0x81 (both values
represent -1.0 SNORM value).

The change here processes all result and expected data buffers to remove
all ambiguites by converting to float and back to signed normalized format.

Affects:
dEQP-VK.api.copy_and_blit.*.image_to_image.all_formats.color.r32_sfloat.a8b8g8r8_snorm_pack32.*
dEQP-VK.api.copy_and_blit.*.image_to_image.all_formats.color.r32_sfloat.r8g8b8a8_snorm.*

Components: Vulkan

VK-GL-CTS issue: 563

Change-Id: I175665f39811cf6a80862967ad0a9bb8e13527e9
external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp