gxquickly / 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