Commit 13881af3 by Courtney Goeltzenleuchter Committed by Commit Bot

Vulkan: Fix cast of float to unsigned int for ARM

ARM devices cast float to unsigned int differently than Intel devices. Need to do additional work to ensure consistent behavior. This was causing negative API tests to fail because the invalid parameter was being turned into a 0 which is valid, but not what was intended (should have been 0xffffffff). Bug: angleproject:4323 Change-Id: I7447842d0f56362d9eb2db4d04b5416c78e51d27 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2012746 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent b36e46ab
...@@ -61,7 +61,16 @@ NativeT CastQueryValueToInt(GLenum pname, QueryT value) ...@@ -61,7 +61,16 @@ NativeT CastQueryValueToInt(GLenum pname, QueryT value)
if (queryType == GL_FLOAT) if (queryType == GL_FLOAT)
{ {
return static_cast<NativeT>(std::round(value)); // ARM devices cast float to uint differently than Intel.
// Basically, any negative floating point number becomes 0
// when converted to unsigned int. Instead, convert to a signed
// int and then convert to unsigned int to "preserve the value"
// E.g. common case for tests is to pass in -1 as an invalid query
// value. If cast to a unsigned int it becomes 0 (GL_NONE) and is now
// a valid enum and negative tests fail. But converting to int
// and then to final unsigned int gives us 4294967295 (0xffffffff)
// which is what we want.
return static_cast<NativeT>(static_cast<GLint64>(std::round(value)));
} }
return static_cast<NativeT>(value); return static_cast<NativeT>(value);
......
...@@ -661,10 +661,6 @@ ...@@ -661,10 +661,6 @@
4110 ANDROID VULKAN : dEQP-GLES31.functional.shaders.helper_invocation.value.points_8_samples = FAIL 4110 ANDROID VULKAN : dEQP-GLES31.functional.shaders.helper_invocation.value.points_8_samples = FAIL
4110 ANDROID VULKAN : dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_max_samples = FAIL 4110 ANDROID VULKAN : dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_max_samples = FAIL
// Debug failures that occur on Android:
4323 VULKAN ANDROID : dEQP-GLES31.functional.debug.negative_coverage.get_error.texture.texparameterf = FAIL
4323 VULKAN ANDROID : dEQP-GLES31.functional.debug.negative_coverage.get_error.texture.texparameterfv = FAIL
// Passing on recent drivers: // Passing on recent drivers:
3726 VULKAN ANDROID : dEQP-GLES31.functional.ssbo.layout.* = FAIL 3726 VULKAN ANDROID : dEQP-GLES31.functional.ssbo.layout.* = FAIL
3726 VULKAN ANDROID : dEQP-GLES31.functional.atomic_counter.* = FAIL 3726 VULKAN ANDROID : dEQP-GLES31.functional.atomic_counter.* = FAIL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment