// // Copyright 2002 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. //
// RefCountObject.h: Defines the gl::RefCountObject base class that provides // lifecycle support for GL objects using the traditional BindObject scheme, but // that need to be reference counted for correct cross-context deletion. // (Concretely, textures, buffers and renderbuffers.)
virtual ~BindingPointer()
{ // Objects have to be released before the resource manager is destroyed, so they must be // explicitly cleaned up.
ASSERT(mObject == nullptr);
}
RefCountObjectReleaser<ObjectType, ContextType, ErrorT> set(const ContextType *context,
ObjectType *newObject)
{ // addRef first in case newObject == mObject and this is the last reference to it. if (newObject != nullptr)
{ reinterpret_cast<RefCountObject<ContextType, ErrorType> *>(newObject)->addRef();
}
// Store the old pointer in a temporary so we can set the pointer before calling release. // Otherwise the object could still be referenced when its destructor is called.
ObjectType *oldObject = mObject;
mObject = newObject; return RefCountObjectReleaser<ObjectType, ContextType, ErrorT>(context, oldObject);
}
template <class ObjectType> class OffsetBindingPointer : public BindingPointer<ObjectType>
{ public: using ContextType = typename BindingPointer<ObjectType>::ContextType; using ErrorType = typename BindingPointer<ObjectType>::ErrorType;
// Delete the unparameterized functions. This forces an explicit offset and size. using BindingPointer<ObjectType>::set; using BindingPointer<ObjectType>::assign;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.