Commit bc6f52f3 by Jamie Madill Committed by Commit Bot

Make BindingPointer::set non-virtual.

This should give more potential for inlining the function. Makes the non-parameterized set and assign private in OffsetBindingPointer to prevent user errors. Bug: angleproject:2891 Change-Id: I0d581a96154c0cd33a93b06ef4a3c162809a8208 Reviewed-on: https://chromium-review.googlesource.com/c/1286378 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent cd0a0a3c
......@@ -93,7 +93,7 @@ class BindingPointer
ASSERT(mObject == nullptr);
}
virtual void set(const ContextType *context, ObjectType *newObject)
void set(const ContextType *context, ObjectType *newObject)
{
// addRef first in case newObject == mObject and this is the last reference to it.
if (newObject != nullptr)
......@@ -180,16 +180,9 @@ class OffsetBindingPointer : public BindingPointer<ObjectType>
OffsetBindingPointer() : mOffset(0), mSize(0) { }
void set(const ContextType *context, ObjectType *newObject) override
{
BindingPointer<ObjectType>::set(context, newObject);
mOffset = 0;
mSize = 0;
}
void set(const ContextType *context, ObjectType *newObject, GLintptr offset, GLsizeiptr size)
{
BindingPointer<ObjectType>::set(context, newObject);
set(context, newObject);
mOffset = offset;
mSize = size;
}
......@@ -209,12 +202,16 @@ class OffsetBindingPointer : public BindingPointer<ObjectType>
void assign(ObjectType *object, GLintptr offset, GLsizeiptr size)
{
BindingPointer<ObjectType>::assign(object);
assign(object);
mOffset = offset;
mSize = size;
}
private:
// Delete the unparameterized functions. This forces an explicit offset and size.
using BindingPointer<ObjectType>::set;
using BindingPointer<ObjectType>::assign;
GLintptr mOffset;
GLsizeiptr mSize;
};
......
......@@ -92,7 +92,7 @@ void TransformFeedback::onDestroy(const Context *context)
ASSERT(!mState.mProgram);
for (size_t i = 0; i < mState.mIndexedBuffers.size(); i++)
{
mState.mIndexedBuffers[i].set(context, nullptr);
mState.mIndexedBuffers[i].set(context, nullptr, 0, 0);
}
}
......@@ -233,7 +233,7 @@ void TransformFeedback::detachBuffer(const Context *context, GLuint bufferName)
{
mState.mIndexedBuffers[index]->onTFBindingChanged(context, false, true);
}
mState.mIndexedBuffers[index].set(context, nullptr);
mState.mIndexedBuffers[index].set(context, nullptr, 0, 0);
mImplementation->bindIndexedBuffer(index, mState.mIndexedBuffers[index]);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment