Commit 4efa82ed by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Avoid INT_MAX resource limits

dEQP queries resource limits in all formats, including float. When INT_MAX is queried as float, the resulting value is INT_MAX+1 due to floating point imprecision. dEQP casts this value back to int for verification, and trips up on the resulting negative number. This change limits every ridiculously-large limit to INT_MAX/2 instead of INT_MAX. Bug: angleproject:4309 Change-Id: I11018c2c5a0c8bfb410928b0a4c34c526fab2269 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2006813 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarIan Elliott <ianelliott@google.com>
parent b46e6c2f
......@@ -28,8 +28,10 @@ namespace rx
GLint LimitToInt(const uint32_t physicalDeviceValue)
{
// Limit to INT_MAX / 2 instead of INT_MAX. If the limit is queried as float, the imprecision
// in floating point can cause the value to exceed INT_MAX. This trips dEQP up.
return std::min(physicalDeviceValue,
static_cast<uint32_t>(std::numeric_limits<int32_t>::max()));
static_cast<uint32_t>(std::numeric_limits<int32_t>::max() / 2));
}
void RendererVk::ensureCapsInitialized() const
......
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