Merge branch 'scygan_image_reinterpret_snorm_magic_0x80' into 'master'
authorPyry Haulos <phaulos@google.com>
Mon, 4 Jan 2016 19:14:37 +0000 (14:14 -0500)
committerPyry Haulos <phaulos@google.com>
Mon, 4 Jan 2016 19:14:37 +0000 (14:14 -0500)
commit6b6bfc611f53d31b775c74a9ade3bd3cc9e91f5a
treeb654fa3df0df094ff851338c05d7c8f6ca3b854f
parent394d041f5e798c4c2a3f71157250fa9296d25b82
parent48433c31c61a8c020bbc60f4add1103af1886879
Merge branch 'scygan_image_reinterpret_snorm_magic_0x80' into 'master'

dEQP-VK.image.reinterpret: bad handling of -128 SNORM value

Some tests in reintepret group create images of R32I type, than issue an imageLoad()-ed in shader, reinterpreting the image as RGBA8_SNORM. Than the value is imageStore()-ed again as RGBA8_SNORM.

Effectively each channel undergoes SNORM8 -> float -> SNORM8 conversion.

The problem is test requires the stored image to match exactly the loaded one, while the loaded image contains bytes of -128 value.

-128 (same as 127) converts to -1.0 float, however according to following equation in spec, the -1.0 float value can convert only to 0x81, what makes test fail.

```
f′=convertFloatToInt(f*(2^(b−1)−1),b)
```

The proposed fix here is to replace all 0x80 values in loaded image - same it is already done for NaNs and Infs for float format.

See merge request !233