Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 13881af

Browse files
courtney-gCommit Bot
authored andcommitted
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: Geoff Lang <geofflang@chromium.org>
1 parent b36e46a commit 13881af

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/libANGLE/queryconversions.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,16 @@ NativeT CastQueryValueToInt(GLenum pname, QueryT value)
6161

6262
if (queryType == GL_FLOAT)
6363
{
64-
return static_cast<NativeT>(std::round(value));
64+
// ARM devices cast float to uint differently than Intel.
65+
// Basically, any negative floating point number becomes 0
66+
// when converted to unsigned int. Instead, convert to a signed
67+
// int and then convert to unsigned int to "preserve the value"
68+
// E.g. common case for tests is to pass in -1 as an invalid query
69+
// value. If cast to a unsigned int it becomes 0 (GL_NONE) and is now
70+
// a valid enum and negative tests fail. But converting to int
71+
// and then to final unsigned int gives us 4294967295 (0xffffffff)
72+
// which is what we want.
73+
return static_cast<NativeT>(static_cast<GLint64>(std::round(value)));
6574
}
6675

6776
return static_cast<NativeT>(value);

src/tests/deqp_support/deqp_gles31_test_expectations.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -661,10 +661,6 @@
661661
4110 ANDROID VULKAN : dEQP-GLES31.functional.shaders.helper_invocation.value.points_8_samples = FAIL
662662
4110 ANDROID VULKAN : dEQP-GLES31.functional.shaders.helper_invocation.value.triangles_max_samples = FAIL
663663

664-
// Debug failures that occur on Android:
665-
4323 VULKAN ANDROID : dEQP-GLES31.functional.debug.negative_coverage.get_error.texture.texparameterf = FAIL
666-
4323 VULKAN ANDROID : dEQP-GLES31.functional.debug.negative_coverage.get_error.texture.texparameterfv = FAIL
667-
668664
// Passing on recent drivers:
669665
3726 VULKAN ANDROID : dEQP-GLES31.functional.ssbo.layout.* = FAIL
670666
3726 VULKAN ANDROID : dEQP-GLES31.functional.atomic_counter.* = FAIL

0 commit comments

Comments
 (0)