BlamKiwi / angleproject

Automatically exported from code.google.com/p/angleproject
Other
0 stars 0 forks source link

glGenTextures after glBindTexture(GL_TEXTURE_2D, MAX_UINT) could cause an assert failure. #1052

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Consider this code snippet:
glBindTexture(GL_TEXTURE_2D, MAX_UINT);
glGenTextures(1, &tex);

In debug mode, there is an assert failure in HandleAllocator::allocate. In 
Release mode, tex = 0 after glGenTextures, which is wrong.

The problem is inside HandleAllocator::reserve. If calling it with MAX_UINT, 
mUnallocatedList is wrongly split into 2 elements: [0, MAX_UINT - 1] and [1, 
MAX_UINT]. When glGen* is called, HandleAllocator::allocate returns the begin 
of the first element, which is 0.

Original issue reported on code.google.com by mg...@microsoft.com on 29 Jun 2015 at 11:27

GoogleCodeExporter commented 9 years ago
The following revision refers to this bug:
  https://chromium.googlesource.com/angle/angle/+/d3e7aa33e04f7215a69abeec6b9004662aadb155

commit d3e7aa33e04f7215a69abeec6b9004662aadb155
Author: Minmin Gong <mgong@microsoft.com>
Date: Mon Jun 29 19:25:24 2015

Allow calling HandleAllocator::reserve with MAX_UINT.

BUG=angleproject:1052

Change-Id: I03883799ef334f39c9e855a0a4b7af1ab02d5da9
Reviewed-on: https://chromium-review.googlesource.com/282414
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Minmin Gong <mgong@microsoft.com>

[modify] 
http://crrev.com/d3e7aa33e04f7215a69abeec6b9004662aadb155/src/libANGLE/HandleAll
ocator_unittest.cpp
[modify] 
http://crrev.com/d3e7aa33e04f7215a69abeec6b9004662aadb155/src/libANGLE/HandleAll
ocator.cpp

Original comment by bugdroid1@chromium.org on 30 Jun 2015 at 5:15