// // Copyright 2013 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. // // This class contains prototypes for representing GLES 3 Vertex Array Objects: // // The buffer objects that are to be used by the vertex stage of the GL are collected // together to form a vertex array object. All state related to the definition of data used // by the vertex processor is encapsulated in a vertex array object. //
// This is a performance optimization for buffer binding. Allows element array buffer updates. friendclass State;
// From the GLES 3.1 spec: // When a generic attribute array is sourced from client memory, the vertex attribute binding // state is ignored. Thus we don't have to worry about binding state when using client memory // attribs.
gl::AttributesMask mClientMemoryAttribsMask;
gl::AttributesMask mNullPointerClientMemoryAttribsMask;
// Used for validation cache. Indexed by attribute.
AttributesMask mCachedMappedArrayBuffers;
AttributesMask mCachedMutableOrImpersistentArrayBuffers;
AttributesMask mCachedInvalidMappedArrayBuffer;
};
class VertexArrayBufferContentsObservers final : angle::NonCopyable
{ public:
VertexArrayBufferContentsObservers(VertexArray *vertexArray); void enableForBuffer(Buffer *buffer, uint32_t bufferIndex); void disableForBuffer(Buffer *buffer, uint32_t bufferIndex);
private:
VertexArray *mVertexArray;
};
class VertexArray final : public angle::ObserverInterface, public LabeledObject, public angle::Subject
{ public: // Dirty bits for VertexArrays use a hierarchical design. At the top level, each attribute // has a single dirty bit. Then an array of MAX_ATTRIBS dirty bits each has a dirty bit for // enabled/pointer/format/binding. Bindings are handled similarly. Note that because the // total number of dirty bits is 33, it will not be as fast on a 32-bit machine, which // can't support the advanced 64-bit scanning intrinsics. We could consider packing the // binding and attribute bits together if this becomes a problem. // // Special note on "DIRTY_ATTRIB_POINTER_BUFFER": this is a special case when the app // calls glVertexAttribPointer but only changes a VBO and/or offset binding. This allows // the Vulkan back-end to skip performing a pipeline change for performance. enum DirtyBitType
{
DIRTY_BIT_ELEMENT_ARRAY_BUFFER,
DIRTY_BIT_ELEMENT_ARRAY_BUFFER_DATA,
// We keep separate dirty bits for bound buffers whose data changed since last update.
DIRTY_BIT_BUFFER_DATA_0 = DIRTY_BIT_BINDING_MAX,
DIRTY_BIT_BUFFER_DATA_MAX = DIRTY_BIT_BUFFER_DATA_0 + gl::MAX_VERTEX_ATTRIB_BINDINGS,
// We want to keep the number of dirty bits within 64 to keep iteration times fast.
static_assert(DIRTY_BIT_MAX <= 64, "Too many vertex array dirty bits."); // The dirty bit processing has the logic to avoid redundant processing by removing other dirty // bits when it processes dirtyBits. This assertion ensures these dirty bit order matches what // VertexArrayVk::syncState expects.
static_assert(DIRTY_BIT_BINDING_0 < DIRTY_BIT_BUFFER_DATA_0, "BINDING dity bits should come before DATA.");
static_assert(DIRTY_BIT_BUFFER_DATA_0 < DIRTY_BIT_ATTRIB_0, "DATA dity bits should come before ATTRIB.");
using DirtyBits = angle::BitSet<DIRTY_BIT_MAX>; using DirtyAttribBits = angle::BitSet<DIRTY_ATTRIB_MAX>; using DirtyBindingBits = angle::BitSet<DIRTY_BINDING_MAX>; using DirtyAttribBitsArray = std::array<DirtyAttribBits, gl::MAX_VERTEX_ATTRIBS>; using DirtyBindingBitsArray = std::array<DirtyBindingBits, gl::MAX_VERTEX_ATTRIB_BINDINGS>; using DirtyObserverBindingBits = angle::BitSet<gl::MAX_VERTEX_ATTRIB_BINDINGS>;
std::vector<angle::ObserverBinding> mArrayBufferObserverBindings; // Track which observer in mArrayBufferObserverBindings is not currently been removed from // subject's observer list.
DirtyObserverBindingBits mDirtyObserverBindingBits;
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.