Fix ResourceManager create-on-bind reallocations.
*re-land with build fix for Clang*
We had a funny bug where the Handle Allocator would re-allocate
reserved handles after the app layer creates one with Bind rather
than using Gen. This affects Textures, Buffers and Renderbuffers.
Fix this by using a different allocation scheme. It should still
be fast on the "good" case (using Gen) and use tree lookups on the
bind case. Also add some unit tests.
BUG=angleproject:942
Change-Id: I63ce608fcd6a11f92e2b5421f090551934e729ed
Reviewed-on: https://chromium-review.googlesource.com/261591
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/ResourceManager.h b/src/libANGLE/ResourceManager.h
index 14858ad..a0da0d0 100644
--- a/src/libANGLE/ResourceManager.h
+++ b/src/libANGLE/ResourceManager.h
@@ -68,9 +68,9 @@
void setRenderbuffer(GLuint handle, Renderbuffer *renderbuffer);
- void checkBufferAllocation(unsigned int buffer);
- void checkTextureAllocation(GLuint texture, GLenum type);
- void checkRenderbufferAllocation(GLuint renderbuffer);
+ void checkBufferAllocation(GLuint handle);
+ void checkTextureAllocation(GLuint handle, GLenum type);
+ void checkRenderbufferAllocation(GLuint handle);
void checkSamplerAllocation(GLuint sampler);
bool isSampler(GLuint sampler);
@@ -78,6 +78,8 @@
private:
DISALLOW_COPY_AND_ASSIGN(ResourceManager);
+ void createTextureInternal(GLuint handle);
+
rx::ImplFactory *mFactory;
std::size_t mRefCount;