Commit d3e7aa33 by Minmin Gong Committed by Jamie Madill

Allow calling HandleAllocator::reserve with MAX_UINT.

BUG=angleproject:1052 Change-Id: I03883799ef334f39c9e855a0a4b7af1ab02d5da9 Reviewed-on: https://chromium-review.googlesource.com/282414Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarMinmin Gong <mgong@microsoft.com>
parent 006909d6
...@@ -26,7 +26,7 @@ struct HandleAllocator::HandleRangeComparator ...@@ -26,7 +26,7 @@ struct HandleAllocator::HandleRangeComparator
HandleAllocator::HandleAllocator() : mBaseValue(1), mNextValue(1) HandleAllocator::HandleAllocator() : mBaseValue(1), mNextValue(1)
{ {
mUnallocatedList.push_back(HandleRange(1, std::numeric_limits<GLuint>::max() - 1)); mUnallocatedList.push_back(HandleRange(1, std::numeric_limits<GLuint>::max()));
} }
HandleAllocator::HandleAllocator(GLuint maximumHandleValue) : mBaseValue(1), mNextValue(1) HandleAllocator::HandleAllocator(GLuint maximumHandleValue) : mBaseValue(1), mNextValue(1)
......
...@@ -90,4 +90,17 @@ TEST(HandleAllocatorTest, Reallocation) ...@@ -90,4 +90,17 @@ TEST(HandleAllocatorTest, Reallocation)
EXPECT_EQ(finalResult, 1); EXPECT_EQ(finalResult, 1);
} }
// The following test covers reserving a handle with max uint value.
// See http://anglebug.com/1052
TEST(HandleAllocatorTest, ReserveMaxUintHandle)
{
gl::HandleAllocator allocator;
GLuint maxUintHandle = std::numeric_limits<GLuint>::max();
allocator.reserve(maxUintHandle);
GLuint normalHandle = allocator.allocate();
EXPECT_EQ(1u, normalHandle);
}
} }
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