Fix ResourceManager create-on-bind reallocations.
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: I2e3f4c31b28cb86bd3699035f5d55568a2a1d7d5
Reviewed-on: https://chromium-review.googlesource.com/258904
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Jamie Madill <jmadill@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;