mirror of
https://github.com/zhigang1992/libpag.git
synced 2026-04-29 12:35:45 +08:00
Fix a reuse issue with GLBuffer.
This commit is contained in:
@@ -38,9 +38,7 @@ std::shared_ptr<GLBuffer> GLBuffer::Make(Context* context, const uint16_t* buffe
|
||||
return glBuffer;
|
||||
}
|
||||
const auto* gl = GLContext::Unwrap(context);
|
||||
glBuffer = Resource::Wrap(context, new GLBuffer());
|
||||
glBuffer->uniqueKey = buffer;
|
||||
glBuffer->_length = length;
|
||||
glBuffer = Resource::Wrap(context, new GLBuffer(buffer, length));
|
||||
gl->genBuffers(1, &glBuffer->_bufferID);
|
||||
if (buffer) {
|
||||
gl->bindBuffer(GL::ELEMENT_ARRAY_BUFFER, glBuffer->_bufferID);
|
||||
|
||||
@@ -37,6 +37,9 @@ class GLBuffer : public Resource {
|
||||
void computeRecycleKey(BytesKey*) const override;
|
||||
|
||||
private:
|
||||
GLBuffer(const void* uniqueKey, size_t length) : uniqueKey(uniqueKey), _length(length) {
|
||||
}
|
||||
|
||||
void onRelease(Context* context) override;
|
||||
|
||||
const void* uniqueKey = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user