From c842060dc5057b8e5871af38ceb6823261591c3b Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Tue, 4 Nov 2014 14:51:57 -0800 Subject: [PATCH] fix names for stream and Batch interface --- interface/src/gpu/Batch.cpp | 26 ++-- interface/src/gpu/Batch.h | 22 +--- interface/src/gpu/Format.h | 150 ++++++++++++++--------- interface/src/gpu/GLBackend.cpp | 70 +++++------ interface/src/gpu/GLBackend.h | 23 ++-- interface/src/gpu/Resource.h | 4 +- interface/src/gpu/Stream.cpp | 12 +- interface/src/gpu/Stream.h | 124 ++++++++++--------- interface/src/renderer/GeometryCache.cpp | 40 +++--- interface/src/renderer/GeometryCache.h | 8 +- interface/src/renderer/Model.cpp | 22 ++-- interface/src/ui/TextRenderer.cpp | 12 +- interface/src/ui/TextRenderer.h | 8 +- 13 files changed, 273 insertions(+), 248 deletions(-) diff --git a/interface/src/gpu/Batch.cpp b/interface/src/gpu/Batch.cpp index 7e36854769..e213007191 100644 --- a/interface/src/gpu/Batch.cpp +++ b/interface/src/gpu/Batch.cpp @@ -16,7 +16,7 @@ using namespace gpu; -const int Element::TYPE_SIZE[Element::NUM_TYPES] = { +const int TYPE_SIZE[NUM_TYPES] = { 4, 4, 4, @@ -35,7 +35,7 @@ const int Element::TYPE_SIZE[Element::NUM_TYPES] = { 1 }; -const int Element::DIMENSION_COUNT[Element::NUM_DIMENSIONS] = { +const int DIMENSION_COUNT[NUM_DIMENSIONS] = { 1, 2, 3, @@ -123,26 +123,24 @@ void Batch::drawIndexedInstanced(uint32 nbInstances, Primitive primitiveType, ui _params.push_back(nbInstances); } -void Batch::setInputFormat(const StreamFormatPtr format) { +void Batch::setInputFormat(const Stream::FormatPointer& format) { ADD_COMMAND(setInputFormat); _params.push_back(_streamFormats.cache(format)); } -void Batch::setInputStream(uint8 startChannel, const StreamPtr& stream) { - if (!stream.isNull()) { - if (stream->getNumBuffers()) { - const Buffers& buffers = stream->getBuffers(); - const Offsets& offsets = stream->getOffsets(); - const Offsets& strides = stream->getStrides(); - for (int i = 0; i < buffers.size(); i++) { - setInputBuffer(startChannel + i, buffers[i], offsets[i], strides[i]); - } +void Batch::setInputStream(Slot startChannel, const BufferStream& stream) { + if (stream.getNumBuffers()) { + const Buffers& buffers = stream.getBuffers(); + const Offsets& offsets = stream.getOffsets(); + const Offsets& strides = stream.getStrides(); + for (int i = 0; i < buffers.size(); i++) { + setInputBuffer(startChannel + i, buffers[i], offsets[i], strides[i]); } } } -void Batch::setInputBuffer(uint8 channel, const BufferPtr& buffer, Offset offset, Offset stride) { +void Batch::setInputBuffer(Slot channel, const BufferPointer& buffer, Offset offset, Offset stride) { ADD_COMMAND(setInputBuffer); _params.push_back(stride); @@ -151,7 +149,7 @@ void Batch::setInputBuffer(uint8 channel, const BufferPtr& buffer, Offset offset _params.push_back(channel); } -void Batch::setIndexBuffer(Element::Type type, const BufferPtr& buffer, Offset offset) { +void Batch::setIndexBuffer(Type type, const BufferPointer& buffer, Offset offset) { ADD_COMMAND(setIndexBuffer); _params.push_back(offset); diff --git a/interface/src/gpu/Batch.h b/interface/src/gpu/Batch.h index fc789320b8..c894afc99a 100644 --- a/interface/src/gpu/Batch.h +++ b/interface/src/gpu/Batch.h @@ -39,12 +39,6 @@ namespace gpu { -class Buffer; -class Resource; - -typedef int Stamp; - - enum Primitive { PRIMITIVE_POINTS = 0, PRIMITIVE_LINES, @@ -56,11 +50,9 @@ enum Primitive { NUM_PRIMITIVES, }; -typedef std::vector< BufferPtr > Buffers; -typedef std::vector< Offset > Offsets; - class Batch { public: + typedef Stream::Slot Slot; Batch(); Batch(const Batch& batch); @@ -73,12 +65,12 @@ public: void drawInstanced(uint32 nbInstances, Primitive primitiveType, uint32 nbVertices, uint32 startVertex = 0, uint32 startInstance = 0); void drawIndexedInstanced(uint32 nbInstances, Primitive primitiveType, uint32 nbIndices, uint32 startIndex = 0, uint32 startInstance = 0); - void setInputFormat(const StreamFormatPtr format); + void setInputFormat(const Stream::FormatPointer& format); - void setInputStream(uint8 startChannel, const StreamPtr& stream); // not a command, just multiples - void setInputBuffer(uint8 channel, const BufferPtr& buffer, Offset offset, Offset stride); + void setInputStream(Slot startChannel, const BufferStream& stream); // not a command, just unroll into a loop of setInputBuffer + void setInputBuffer(Slot channel, const BufferPointer& buffer, Offset offset, Offset stride); - void setIndexBuffer(Element::Type type, const BufferPtr& buffer, Offset offset); + void setIndexBuffer(Type type, const BufferPointer& buffer, Offset offset); // TODO: As long as we have gl calls explicitely issued from interface @@ -272,8 +264,7 @@ public: }; typedef Cache::Vector BufferCaches; - typedef Cache::Vector StreamCaches; - typedef Cache::Vector StreamFormatCaches; + typedef Cache::Vector StreamFormatCaches; typedef unsigned char Byte; typedef std::vector Bytes; @@ -306,7 +297,6 @@ public: Resources _resources; BufferCaches _buffers; - StreamCaches _streams; StreamFormatCaches _streamFormats; Bytes _data; diff --git a/interface/src/gpu/Format.h b/interface/src/gpu/Format.h index f0cfe52ddf..a372d4086e 100644 --- a/interface/src/gpu/Format.h +++ b/interface/src/gpu/Format.h @@ -17,72 +17,102 @@ namespace gpu { - typedef unsigned int uint32; - typedef int int32; - typedef unsigned short uint16; - typedef short int16; - typedef unsigned char uint8; - typedef char int8; +typedef unsigned int uint32; +typedef int int32; +typedef unsigned short uint16; +typedef short int16; +typedef unsigned char uint8; +typedef char int8; - typedef uint32 Offset; +typedef uint32 Offset; -// Format is a simple 32bit value that contains everything we need to know about an element +// Description of a scalar type +enum Type { + + TYPE_FLOAT = 0, + TYPE_INT32, + TYPE_UINT32, + TYPE_HALF, + TYPE_INT16, + TYPE_UINT16, + TYPE_INT8, + TYPE_UINT8, + + TYPE_NFLOAT, + TYPE_NINT32, + TYPE_NUINT32, + TYPE_NHALF, + TYPE_NINT16, + TYPE_NUINT16, + TYPE_NINT8, + TYPE_NUINT8, + + NUM_TYPES, +}; +// Array providing the size in bytes for a given scalar type +static const int TYPE_SIZE[NUM_TYPES] = { + 4, + 4, + 4, + 2, + 2, + 2, + 1, + 1, + 4, + 4, + 4, + 2, + 2, + 2, + 1, + 1 +}; + + +// Dimension of an Element +enum Dimension { + DIM_SCALAR = 0, + DIM_VEC2, + DIM_VEC3, + DIM_VEC4, + DIM_MAT3, + DIM_MAT4, + + NUM_DIMENSIONS, +}; +// Count (of scalars) in an Element for a given Dimension +static const int DIMENSION_COUNT[NUM_DIMENSIONS] = { + 1, + 2, + 3, + 4, + 9, + 16 +}; + +// Semantic of an Element +// Provide information on how to use the element +enum Semantic { + SEMANTIC_RGB = 0, + SEMANTIC_RGBA, + SEMANTIC_XYZ, + SEMANTIC_XYZW, + SEMANTIC_POS_XYZ, + SEMANTIC_POS_XYZW, + SEMANTIC_QUAT, + SEMANTIC_DIR_XYZ, + SEMANTIC_UV, + SEMANTIC_R8, + + NUM_SEMANTICS, +}; + +// Element is a simple 16bit value that contains everything we need to know about an element // of a buffer, a pixel of a texture, a varying input/output or uniform from a shader pipeline. // Type and dimension of the element, and semantic class Element { public: - - enum Type { - - TYPE_FLOAT = 0, - TYPE_INT32, - TYPE_UINT32, - TYPE_HALF, - TYPE_INT16, - TYPE_UINT16, - TYPE_INT8, - TYPE_UINT8, - - TYPE_NFLOAT, - TYPE_NINT32, - TYPE_NUINT32, - TYPE_NHALF, - TYPE_NINT16, - TYPE_NUINT16, - TYPE_NINT8, - TYPE_NUINT8, - - NUM_TYPES, - }; - static const int TYPE_SIZE[NUM_TYPES]; - - enum Dimension { - DIM_SCALAR = 0, - DIM_VEC2, - DIM_VEC3, - DIM_VEC4, - DIM_MAT3, - DIM_MAT4, - - NUM_DIMENSIONS, - }; - static const int DIMENSION_COUNT[NUM_DIMENSIONS]; - - enum Semantic { - SEMANTIC_RGB = 0, - SEMANTIC_RGBA, - SEMANTIC_XYZ, - SEMANTIC_XYZW, - SEMANTIC_POS_XYZ, - SEMANTIC_POS_XYZW, - SEMANTIC_QUAT, - SEMANTIC_DIR_XYZ, - SEMANTIC_UV, - SEMANTIC_R8, - - NUM_SEMANTICS, - }; - Element(Dimension dim, Type type, Semantic sem) : _semantic(sem), _dimension(dim), diff --git a/interface/src/gpu/GLBackend.cpp b/interface/src/gpu/GLBackend.cpp index 8a38b30ae2..6d9676ac68 100644 --- a/interface/src/gpu/GLBackend.cpp +++ b/interface/src/gpu/GLBackend.cpp @@ -81,7 +81,7 @@ GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] = (&::gpu::GLBackend::do_glMaterialfv), }; -const GLenum GLBackend::_primitiveToGLmode[NUM_PRIMITIVES] = { +static const GLenum _primitiveToGLmode[NUM_PRIMITIVES] = { GL_POINTS, GL_LINES, GL_LINE_STRIP, @@ -90,7 +90,7 @@ const GLenum GLBackend::_primitiveToGLmode[NUM_PRIMITIVES] = { GL_QUADS, }; -static const GLenum _elementTypeToGLType[Element::NUM_TYPES]= { +static const GLenum _elementTypeToGLType[NUM_TYPES]= { GL_FLOAT, GL_INT, GL_UNSIGNED_INT, @@ -116,10 +116,10 @@ GLBackend::GLBackend() : _inputAttributeActivation(0), _needInputFormatUpdate(true), - _vertexBuffersState(0), - _vertexBuffers(_vertexBuffersState.size(), BufferPtr(0)), - _vertexBufferOffsets(_vertexBuffersState.size(), 0), - _vertexBufferStrides(_vertexBuffersState.size(), 0), + _inputBuffersState(0), + _inputBuffers(_inputBuffersState.size(), BufferPointer(0)), + _inputBufferOffsets(_inputBuffersState.size(), 0), + _inputBufferStrides(_inputBuffersState.size(), 0), _indexBuffer(0), _indexBufferOffset(0) @@ -216,7 +216,7 @@ void GLBackend::do_drawIndexedInstanced(Batch& batch, uint32 paramOffset) { } void GLBackend::do_setInputFormat(Batch& batch, uint32 paramOffset) { - StreamFormatPtr format = batch._streamFormats.get(batch._params[paramOffset]._uint); + Stream::FormatPointer format = batch._streamFormats.get(batch._params[paramOffset]._uint); if (format != _inputFormat) { _inputFormat = format; @@ -227,20 +227,20 @@ void GLBackend::do_setInputFormat(Batch& batch, uint32 paramOffset) { void GLBackend::do_setInputBuffer(Batch& batch, uint32 paramOffset) { Offset stride = batch._params[paramOffset + 0]._uint; Offset offset = batch._params[paramOffset + 1]._uint; - BufferPtr buffer = batch._buffers.get(batch._params[paramOffset + 2]._uint); + BufferPointer buffer = batch._buffers.get(batch._params[paramOffset + 2]._uint); uint32 channel = batch._params[paramOffset + 3]._uint; if (channel < getNumInputBuffers()) { - _vertexBuffers[channel] = buffer; - _vertexBufferOffsets[channel] = offset; - _vertexBufferStrides[channel] = stride; - _vertexBuffersState.set(channel); + _inputBuffers[channel] = buffer; + _inputBufferOffsets[channel] = offset; + _inputBufferStrides[channel] = stride; + _inputBuffersState.set(channel); } } #define SUPPORT_LEGACY_OPENGL #if defined(SUPPORT_LEGACY_OPENGL) -static const int NUM_CLASSIC_ATTRIBS = StreamFormat::SLOT_TANGENT; +static const int NUM_CLASSIC_ATTRIBS = Stream::INPUT_SLOT_TANGENT; static const GLenum attributeSlotToClassicAttribName[NUM_CLASSIC_ATTRIBS] = { GL_VERTEX_ARRAY, GL_NORMAL_ARRAY, @@ -250,16 +250,16 @@ static const GLenum attributeSlotToClassicAttribName[NUM_CLASSIC_ATTRIBS] = { #endif void GLBackend::updateInput() { - if (_needInputFormatUpdate || _vertexBuffersState.any()) { + if (_needInputFormatUpdate || _inputBuffersState.any()) { if (_needInputFormatUpdate) { InputActivationCache newActivation; // Check expected activation if (_inputFormat) { - const StreamFormat::AttributeMap& attributes = _inputFormat->getAttributes(); - for (StreamFormat::AttributeMap::const_iterator it = attributes.begin(); it != attributes.end(); it++) { - const StreamFormat::Attribute& attrib = (*it).second; + const Stream::Format::AttributeMap& attributes = _inputFormat->getAttributes(); + for (Stream::Format::AttributeMap::const_iterator it = attributes.begin(); it != attributes.end(); it++) { + const Stream::Attribute& attrib = (*it).second; newActivation.set(attrib._slot); } } @@ -295,27 +295,27 @@ void GLBackend::updateInput() { // now we need to bind the buffers and assign the attrib pointers if (_inputFormat) { - const Buffers& buffers = _vertexBuffers; - const Offsets& offsets = _vertexBufferOffsets; - const Offsets& strides = _vertexBufferStrides; + const Buffers& buffers = _inputBuffers; + const Offsets& offsets = _inputBufferOffsets; + const Offsets& strides = _inputBufferStrides; - const StreamFormat::AttributeMap& attributes = _inputFormat->getAttributes(); + const Stream::Format::AttributeMap& attributes = _inputFormat->getAttributes(); - for (StreamFormat::ChannelMap::const_iterator channelIt = _inputFormat->getChannels().begin(); + for (Stream::Format::ChannelMap::const_iterator channelIt = _inputFormat->getChannels().begin(); channelIt != _inputFormat->getChannels().end(); channelIt++) { - const StreamFormat::ChannelMap::value_type::second_type& channel = (*channelIt).second; + const Stream::Format::ChannelMap::value_type::second_type& channel = (*channelIt).second; if ((*channelIt).first < buffers.size()) { int bufferNum = (*channelIt).first; - if (_vertexBuffersState.at(bufferNum) || _needInputFormatUpdate) { + if (_inputBuffersState.at(bufferNum) || _needInputFormatUpdate) { GLuint vbo = gpu::GLBackend::getBufferID((*buffers[bufferNum])); glBindBuffer(GL_ARRAY_BUFFER, vbo); CHECK_GL_ERROR(); - _vertexBuffersState[bufferNum] = false; + _inputBuffersState[bufferNum] = false; for (int i = 0; i < channel._slots.size(); i++) { - const StreamFormat::Attribute& attrib = attributes.at(channel._slots[i]); + const Stream::Attribute& attrib = attributes.at(channel._slots[i]); GLuint slot = attrib._slot; GLuint count = attrib._element.getDimensionCount(); GLenum type = _elementTypeToGLType[attrib._element.getType()]; @@ -324,18 +324,18 @@ void GLBackend::updateInput() { #if defined(SUPPORT_LEGACY_OPENGL) if (slot < NUM_CLASSIC_ATTRIBS) { switch (slot) { - case StreamFormat::SLOT_POSITION: + case Stream::INPUT_SLOT_POSITION: glVertexPointer(count, type, stride, (GLvoid*)pointer); break; - case StreamFormat::SLOT_COLOR: + case Stream::INPUT_SLOT_NORMAL: + glNormalPointer(type, stride, (GLvoid*)pointer); + break; + case Stream::INPUT_SLOT_COLOR: glColorPointer(count, type, stride, (GLvoid*)pointer); break; - case StreamFormat::SLOT_TEXCOORD: + case Stream::INPUT_SLOT_TEXCOORD: glTexCoordPointer(count, type, stride, (GLvoid*)pointer); break; - case StreamFormat::SLOT_NORMAL: - glNormalPointer(type, stride, (GLvoid*)pointer); - break; }; } else { #else @@ -354,7 +354,7 @@ void GLBackend::updateInput() { _needInputFormatUpdate = false; } -/* Fancy version GL4.4 +/* TODO: Fancy version GL4.4 if (_needInputFormatUpdate) { InputActivationCache newActivation; @@ -412,8 +412,8 @@ void GLBackend::updateInput() { void GLBackend::do_setIndexBuffer(Batch& batch, uint32 paramOffset) { - _indexBufferType = (Element::Type) batch._params[paramOffset + 2]._uint; - BufferPtr indexBuffer = batch._buffers.get(batch._params[paramOffset + 1]._uint); + _indexBufferType = (Type) batch._params[paramOffset + 2]._uint; + BufferPointer indexBuffer = batch._buffers.get(batch._params[paramOffset + 1]._uint); _indexBufferOffset = batch._params[paramOffset + 0]._uint; _indexBuffer = indexBuffer; if (indexBuffer) { diff --git a/interface/src/gpu/GLBackend.h b/interface/src/gpu/GLBackend.h index a3bd483f89..2cce6cbedc 100644 --- a/interface/src/gpu/GLBackend.h +++ b/interface/src/gpu/GLBackend.h @@ -45,25 +45,25 @@ public: static GLuint getBufferID(const Buffer& buffer); - static const int MAX_NUM_ATTRIBUTES = StreamFormat::NUM_SLOTS; + static const int MAX_NUM_ATTRIBUTES = Stream::NUM_INPUT_SLOTS; static const int MAX_NUM_INPUT_BUFFERS = 16; - uint32 getNumInputBuffers() const { return _vertexBuffersState.size(); } + uint32 getNumInputBuffers() const { return _inputBuffersState.size(); } protected: bool _needInputFormatUpdate; - StreamFormatPtr _inputFormat; + Stream::FormatPointer _inputFormat; typedef std::bitset InputBuffersState; - InputBuffersState _vertexBuffersState; - Buffers _vertexBuffers; - Offsets _vertexBufferOffsets; - Offsets _vertexBufferStrides; + InputBuffersState _inputBuffersState; + Buffers _inputBuffers; + Offsets _inputBufferOffsets; + Offsets _inputBufferStrides; - BufferPtr _indexBuffer; + BufferPointer _indexBuffer; Offset _indexBufferOffset; - Element::Type _indexBufferType; + Type _indexBufferType; typedef std::bitset InputActivationCache; InputActivationCache _inputAttributeActivation; @@ -138,11 +138,6 @@ protected: typedef void (GLBackend::*CommandCall)(Batch&, uint32); static CommandCall _commandCalls[Batch::NUM_COMMANDS]; - static const GLenum _primitiveToGLmode[NUM_PRIMITIVES]; - - static const GLenum _elementTypeToGLtype[Element::NUM_TYPES]; - - }; diff --git a/interface/src/gpu/Resource.h b/interface/src/gpu/Resource.h index d5305744ac..52108c215a 100644 --- a/interface/src/gpu/Resource.h +++ b/interface/src/gpu/Resource.h @@ -147,8 +147,8 @@ protected: friend class Backend; }; -typedef QSharedPointer BufferPtr; -typedef std::vector< BufferPtr > Buffers; +typedef QSharedPointer BufferPointer; +typedef std::vector< BufferPointer > Buffers; }; diff --git a/interface/src/gpu/Stream.cpp b/interface/src/gpu/Stream.cpp index 953efd57a2..68b1392f73 100644 --- a/interface/src/gpu/Stream.cpp +++ b/interface/src/gpu/Stream.cpp @@ -13,7 +13,7 @@ using namespace gpu; -void StreamFormat::evaluateCache() { +void Stream::Format::evaluateCache() { _channels.clear(); _elementTotalSize = 0; for(AttributeMap::iterator it = _attributes.begin(); it != _attributes.end(); it++) { @@ -26,24 +26,24 @@ void StreamFormat::evaluateCache() { } } -bool StreamFormat::setAttribute(Slot slot, uint8 channel, Element element, Offset offset, Frequency frequency) { - _attributes[slot] = Attribute(slot, channel, element, offset, frequency); +bool Stream::Format::setAttribute(Slot slot, Slot channel, Element element, Offset offset, Frequency frequency) { + _attributes[slot] = Attribute((InputSlot) slot, channel, element, offset, frequency); evaluateCache(); return true; } -Stream::Stream() : +BufferStream::BufferStream() : _buffers(), _offsets() {} -Stream::~Stream() +BufferStream::~BufferStream() { _buffers.clear(); _offsets.clear(); } -void Stream::addBuffer(BufferPtr& buffer, uint32 offset, uint32 stride) { +void BufferStream::addBuffer(BufferPointer& buffer, Offset offset, Offset stride) { _buffers.push_back(buffer); _offsets.push_back(offset); _strides.push_back(stride); diff --git a/interface/src/gpu/Stream.h b/interface/src/gpu/Stream.h index 81ca344199..21d4ea422c 100644 --- a/interface/src/gpu/Stream.h +++ b/interface/src/gpu/Stream.h @@ -21,31 +21,36 @@ namespace gpu { -class StreamFormat { +// Stream namespace class +class Stream { public: - enum Slot { - SLOT_POSITION = 0, - SLOT_NORMAL, - SLOT_COLOR, - SLOT_TEXCOORD, - SLOT_TANGENT, - SLOT_SKIN_CLUSTER_INDEX, - SLOT_SKIN_CLUSTER_WEIGHT, + // Possible input slots identifiers + enum InputSlot { + INPUT_SLOT_POSITION = 0, + INPUT_SLOT_NORMAL, + INPUT_SLOT_COLOR, + INPUT_SLOT_TEXCOORD, + INPUT_SLOT_TANGENT, + INPUT_SLOT_SKIN_CLUSTER_INDEX, + INPUT_SLOT_SKIN_CLUSTER_WEIGHT, - NUM_SLOTS, + NUM_INPUT_SLOTS, }; + typedef uint8 Slot; + + // Frequency describer enum Frequency { FREQUENCY_PER_VERTEX = 0, FREQUENCY_PER_INSTANCE, }; + // The attribute description + // Every thing that is needed to detail a stream attribute and how to interpret it class Attribute { public: - typedef std::vector< Attribute > vector; - - Attribute(Slot slot, uint8 channel, Element element, Offset offset = 0, Frequency frequency = FREQUENCY_PER_VERTEX) : + Attribute(Slot slot, Slot channel, Element element, Offset offset = 0, Frequency frequency = FREQUENCY_PER_VERTEX) : _slot(slot), _channel(channel), _element(element), @@ -53,7 +58,7 @@ public: _frequency(frequency) {} Attribute() : - _slot(SLOT_POSITION), + _slot(INPUT_SLOT_POSITION), _channel(0), _element(), _offset(0), @@ -61,63 +66,71 @@ public: {} - uint8 _slot; // Logical slot assigned to the attribute - uint8 _channel; // index of the channel where to get the data from + Slot _slot; // Logical slot assigned to the attribute + Slot _channel; // index of the channel where to get the data from Element _element; Offset _offset; uint32 _frequency; + // Size of the uint32 getSize() const { return _element.getSize(); } - }; - typedef std::map< uint8, Attribute > AttributeMap; - - class Channel { + // Stream Format is describing how to feed a list of attributes from a bunch of stream buffer channels + class Format { public: - std::vector< uint8 > _slots; - std::vector< uint32 > _offsets; - uint32 _stride; - uint32 _netSize; + typedef std::map< Slot, Attribute > AttributeMap; - Channel() : _stride(0), _netSize(0) {} + class Channel { + public: + std::vector< Slot > _slots; + std::vector< Offset > _offsets; + Offset _stride; + uint32 _netSize; + + Channel() : _stride(0), _netSize(0) {} + }; + typedef std::map< Slot, Channel > ChannelMap; + + Format() : + _attributes(), + _elementTotalSize(0) {} + ~Format() {} + + uint32 getNumAttributes() const { return _attributes.size(); } + const AttributeMap& getAttributes() const { return _attributes; } + + uint8 getNumChannels() const { return _channels.size(); } + const ChannelMap& getChannels() const { return _channels; } + + uint32 getElementTotalSize() const { return _elementTotalSize; } + + bool setAttribute(Slot slot, Slot channel, Element element, Offset offset = 0, Frequency frequency = FREQUENCY_PER_VERTEX); + + protected: + AttributeMap _attributes; + ChannelMap _channels; + uint32 _elementTotalSize; + + void evaluateCache(); }; - typedef std::map< uint8, Channel > ChannelMap; - StreamFormat() : - _attributes(), - _elementTotalSize(0) {} - ~StreamFormat() {} - - uint32 getNumAttributes() const { return _attributes.size(); } - const AttributeMap& getAttributes() const { return _attributes; } - - uint8 getNumChannels() const { return _channels.size(); } - const ChannelMap& getChannels() const { return _channels; } - - uint32 getElementTotalSize() const { return _elementTotalSize; } - - bool setAttribute(Slot slot, uint8 channel, Element element, Offset offset = 0, Frequency frequency = FREQUENCY_PER_VERTEX); - -protected: - AttributeMap _attributes; - ChannelMap _channels; - uint32 _elementTotalSize; - - void evaluateCache(); + typedef QSharedPointer FormatPointer; }; -class Stream { +typedef std::vector< Offset > Offsets; + +// Buffer Stream is a container of N Buffers and their respective Offsets and Srides representing N consecutive channels. +// A Buffer Stream can be assigned to the Batch to set several stream channels in one call +class BufferStream { public: - typedef std::vector< BufferPtr > Buffers; - typedef std::vector< uint32 > Offsets; - typedef std::vector< uint32 > Strides; + typedef Offsets Strides; - Stream(); - ~Stream(); + BufferStream(); + ~BufferStream(); - void addBuffer(BufferPtr& buffer, uint32 offset, uint32 stride); + void addBuffer(BufferPointer& buffer, Offset offset, Offset stride); const Buffers& getBuffers() const { return _buffers; } const Offsets& getOffsets() const { return _offsets; } @@ -129,8 +142,7 @@ protected: Offsets _offsets; Strides _strides; }; -typedef QSharedPointer StreamFormatPtr; -typedef QSharedPointer StreamPtr; +typedef QSharedPointer BufferStreamPointer; }; diff --git a/interface/src/renderer/GeometryCache.cpp b/interface/src/renderer/GeometryCache.cpp index be00eebfea..9249b33031 100644 --- a/interface/src/renderer/GeometryCache.cpp +++ b/interface/src/renderer/GeometryCache.cpp @@ -775,7 +775,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) { } { - networkMesh._indexBuffer = gpu::BufferPtr(new gpu::Buffer()); + networkMesh._indexBuffer = gpu::BufferPointer(new gpu::Buffer()); networkMesh._indexBuffer->resize(totalIndices * sizeof(int)); int offset = 0; foreach(const FBXMeshPart& part, mesh.parts) { @@ -789,7 +789,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) { } { - networkMesh._vertexBuffer = gpu::BufferPtr(new gpu::Buffer()); + networkMesh._vertexBuffer = gpu::BufferPointer(new gpu::Buffer()); // if we don't need to do any blending, the positions/normals can be static if (mesh.blendshapes.isEmpty()) { int normalsOffset = mesh.vertices.size() * sizeof(glm::vec3); @@ -815,7 +815,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) { mesh.clusterWeights.size() * sizeof(glm::vec4), (gpu::Resource::Byte*) mesh.clusterWeights.constData()); // otherwise, at least the cluster indices/weights can be static - networkMesh._vertexStream = gpu::StreamPtr(new gpu::Stream()); + networkMesh._vertexStream = gpu::BufferStreamPointer(new gpu::BufferStream()); networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, 0, sizeof(glm::vec3)); if (mesh.normals.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, normalsOffset, sizeof(glm::vec3)); if (mesh.tangents.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, tangentsOffset, sizeof(glm::vec3)); @@ -825,14 +825,14 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) { if (mesh.clusterWeights.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, clusterWeightsOffset, sizeof(glm::vec4)); int channelNum = 0; - networkMesh._vertexFormat = gpu::StreamFormatPtr(new gpu::StreamFormat()); - networkMesh._vertexFormat->setAttribute(gpu::StreamFormat::SLOT_POSITION, channelNum++, gpu::Element(gpu::Element::DIM_VEC3, gpu::Element::TYPE_FLOAT, gpu::Element::SEMANTIC_POS_XYZ), 0); - if (mesh.normals.size()) networkMesh._vertexFormat->setAttribute(gpu::StreamFormat::SLOT_NORMAL, channelNum++, gpu::Element(gpu::Element::DIM_VEC3, gpu::Element::TYPE_FLOAT, gpu::Element::SEMANTIC_POS_XYZ), 0); - if (mesh.tangents.size()) networkMesh._vertexFormat->setAttribute(gpu::StreamFormat::SLOT_TANGENT, channelNum++, gpu::Element(gpu::Element::DIM_VEC3, gpu::Element::TYPE_FLOAT, gpu::Element::SEMANTIC_POS_XYZ), 0); - if (mesh.colors.size()) networkMesh._vertexFormat->setAttribute(gpu::StreamFormat::SLOT_COLOR, channelNum++, gpu::Element(gpu::Element::DIM_VEC3, gpu::Element::TYPE_FLOAT, gpu::Element::SEMANTIC_POS_XYZ), 0); - if (mesh.texCoords.size()) networkMesh._vertexFormat->setAttribute(gpu::StreamFormat::SLOT_TEXCOORD, channelNum++, gpu::Element(gpu::Element::DIM_VEC2, gpu::Element::TYPE_FLOAT, gpu::Element::SEMANTIC_POS_XYZ), 0); - if (mesh.clusterIndices.size()) networkMesh._vertexFormat->setAttribute(gpu::StreamFormat::SLOT_SKIN_CLUSTER_INDEX, channelNum++, gpu::Element(gpu::Element::DIM_VEC4, gpu::Element::TYPE_NFLOAT, gpu::Element::SEMANTIC_POS_XYZ), 0); - if (mesh.clusterWeights.size()) networkMesh._vertexFormat->setAttribute(gpu::StreamFormat::SLOT_SKIN_CLUSTER_WEIGHT, channelNum++, gpu::Element(gpu::Element::DIM_VEC4, gpu::Element::TYPE_NFLOAT, gpu::Element::SEMANTIC_POS_XYZ), 0); + networkMesh._vertexFormat = gpu::Stream::FormatPointer(new gpu::Stream::Format()); + networkMesh._vertexFormat->setAttribute(gpu::Stream::INPUT_SLOT_POSITION, channelNum++, gpu::Element(gpu::DIM_VEC3, gpu::TYPE_FLOAT, gpu::SEMANTIC_POS_XYZ), 0); + if (mesh.normals.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::INPUT_SLOT_NORMAL, channelNum++, gpu::Element(gpu::DIM_VEC3, gpu::TYPE_FLOAT, gpu::SEMANTIC_XYZ), 0); + if (mesh.tangents.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::INPUT_SLOT_TANGENT, channelNum++, gpu::Element(gpu::DIM_VEC3, gpu::TYPE_FLOAT, gpu::SEMANTIC_XYZ), 0); + if (mesh.colors.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::INPUT_SLOT_COLOR, channelNum++, gpu::Element(gpu::DIM_VEC3, gpu::TYPE_FLOAT, gpu::SEMANTIC_RGB), 0); + if (mesh.texCoords.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::INPUT_SLOT_TEXCOORD, channelNum++, gpu::Element(gpu::DIM_VEC2, gpu::TYPE_FLOAT, gpu::SEMANTIC_UV), 0); + if (mesh.clusterIndices.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::INPUT_SLOT_SKIN_CLUSTER_INDEX, channelNum++, gpu::Element(gpu::DIM_VEC4, gpu::TYPE_NFLOAT, gpu::SEMANTIC_XYZW), 0); + if (mesh.clusterWeights.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::INPUT_SLOT_SKIN_CLUSTER_WEIGHT, channelNum++, gpu::Element(gpu::DIM_VEC4, gpu::TYPE_NFLOAT, gpu::SEMANTIC_XYZW), 0); } else { int colorsOffset = mesh.tangents.size() * sizeof(glm::vec3); @@ -850,7 +850,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) { networkMesh._vertexBuffer->setSubData(clusterWeightsOffset, mesh.clusterWeights.size() * sizeof(glm::vec4), (gpu::Resource::Byte*) mesh.clusterWeights.constData()); - networkMesh._vertexStream = gpu::StreamPtr(new gpu::Stream()); + networkMesh._vertexStream = gpu::BufferStreamPointer(new gpu::BufferStream()); if (mesh.tangents.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, 0, sizeof(glm::vec3)); if (mesh.colors.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, colorsOffset, sizeof(glm::vec3)); if (mesh.texCoords.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, texCoordsOffset, sizeof(glm::vec2)); @@ -858,14 +858,14 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) { if (mesh.clusterWeights.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, clusterWeightsOffset, sizeof(glm::vec4)); int channelNum = 0; - networkMesh._vertexFormat = gpu::StreamFormatPtr(new gpu::StreamFormat()); - networkMesh._vertexFormat->setAttribute(gpu::StreamFormat::SLOT_POSITION, channelNum++, gpu::Element(gpu::Element::DIM_VEC3, gpu::Element::TYPE_FLOAT, gpu::Element::SEMANTIC_POS_XYZ), 0); - if (mesh.normals.size()) networkMesh._vertexFormat->setAttribute(gpu::StreamFormat::SLOT_NORMAL, channelNum++, gpu::Element(gpu::Element::DIM_VEC3, gpu::Element::TYPE_FLOAT, gpu::Element::SEMANTIC_POS_XYZ), 0); - if (mesh.tangents.size()) networkMesh._vertexFormat->setAttribute(gpu::StreamFormat::SLOT_TANGENT, channelNum++, gpu::Element(gpu::Element::DIM_VEC3, gpu::Element::TYPE_FLOAT, gpu::Element::SEMANTIC_POS_XYZ), 0); - if (mesh.colors.size()) networkMesh._vertexFormat->setAttribute(gpu::StreamFormat::SLOT_COLOR, channelNum++, gpu::Element(gpu::Element::DIM_VEC3, gpu::Element::TYPE_FLOAT, gpu::Element::SEMANTIC_POS_XYZ), 0); - if (mesh.texCoords.size()) networkMesh._vertexFormat->setAttribute(gpu::StreamFormat::SLOT_TEXCOORD, channelNum++, gpu::Element(gpu::Element::DIM_VEC2, gpu::Element::TYPE_FLOAT, gpu::Element::SEMANTIC_POS_XYZ), 0); - if (mesh.clusterIndices.size()) networkMesh._vertexFormat->setAttribute(gpu::StreamFormat::SLOT_SKIN_CLUSTER_INDEX, channelNum++, gpu::Element(gpu::Element::DIM_VEC4, gpu::Element::TYPE_NFLOAT, gpu::Element::SEMANTIC_POS_XYZ), 0); - if (mesh.clusterWeights.size()) networkMesh._vertexFormat->setAttribute(gpu::StreamFormat::SLOT_SKIN_CLUSTER_WEIGHT, channelNum++, gpu::Element(gpu::Element::DIM_VEC4, gpu::Element::TYPE_NFLOAT, gpu::Element::SEMANTIC_POS_XYZ), 0); + networkMesh._vertexFormat = gpu::Stream::FormatPointer(new gpu::Stream::Format()); + networkMesh._vertexFormat->setAttribute(gpu::Stream::INPUT_SLOT_POSITION, channelNum++, gpu::Element(gpu::DIM_VEC3, gpu::TYPE_FLOAT, gpu::SEMANTIC_POS_XYZ), 0); + if (mesh.normals.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::INPUT_SLOT_NORMAL, channelNum++, gpu::Element(gpu::DIM_VEC3, gpu::TYPE_FLOAT, gpu::SEMANTIC_XYZ), 0); + if (mesh.tangents.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::INPUT_SLOT_TANGENT, channelNum++, gpu::Element(gpu::DIM_VEC3, gpu::TYPE_FLOAT, gpu::SEMANTIC_XYZ), 0); + if (mesh.colors.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::INPUT_SLOT_COLOR, channelNum++, gpu::Element(gpu::DIM_VEC3, gpu::TYPE_FLOAT, gpu::SEMANTIC_RGB), 0); + if (mesh.texCoords.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::INPUT_SLOT_TEXCOORD, channelNum++, gpu::Element(gpu::DIM_VEC2, gpu::TYPE_FLOAT, gpu::SEMANTIC_UV), 0); + if (mesh.clusterIndices.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::INPUT_SLOT_SKIN_CLUSTER_INDEX, channelNum++, gpu::Element(gpu::DIM_VEC4, gpu::TYPE_NFLOAT, gpu::SEMANTIC_XYZW), 0); + if (mesh.clusterWeights.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::INPUT_SLOT_SKIN_CLUSTER_WEIGHT, channelNum++, gpu::Element(gpu::DIM_VEC4, gpu::TYPE_NFLOAT, gpu::SEMANTIC_XYZW), 0); } } diff --git a/interface/src/renderer/GeometryCache.h b/interface/src/renderer/GeometryCache.h index 307c957511..0fb04cf028 100644 --- a/interface/src/renderer/GeometryCache.h +++ b/interface/src/renderer/GeometryCache.h @@ -155,12 +155,12 @@ public: /// The state associated with a single mesh. class NetworkMesh { public: - gpu::BufferPtr _indexBuffer; - gpu::BufferPtr _vertexBuffer; + gpu::BufferPointer _indexBuffer; + gpu::BufferPointer _vertexBuffer; - gpu::StreamPtr _vertexStream; + gpu::BufferStreamPointer _vertexStream; - gpu::StreamFormatPtr _vertexFormat; + gpu::Stream::FormatPointer _vertexFormat; QVector parts; diff --git a/interface/src/renderer/Model.cpp b/interface/src/renderer/Model.cpp index 758039b32a..7ae4bb4a7d 100644 --- a/interface/src/renderer/Model.cpp +++ b/interface/src/renderer/Model.cpp @@ -137,7 +137,7 @@ void Model::initProgram(ProgramObject& program, Model::Locations& locations, int - glBindAttribLocation(program.programId(), gpu::StreamFormat::SLOT_TANGENT, "tangent"); + glBindAttribLocation(program.programId(), gpu::Stream::INPUT_SLOT_TANGENT, "tangent"); glLinkProgram(program.programId()); @@ -177,9 +177,9 @@ void Model::initSkinProgram(ProgramObject& program, Model::SkinLocations& locati // HACK: Assign explicitely the attribute channel to avoid a bug on Yosemite - glBindAttribLocation(program.programId(), gpu::StreamFormat::SLOT_SKIN_CLUSTER_INDEX, "clusterIndices"); + glBindAttribLocation(program.programId(), gpu::Stream::INPUT_SLOT_SKIN_CLUSTER_INDEX, "clusterIndices"); - glBindAttribLocation(program.programId(), gpu::StreamFormat::SLOT_SKIN_CLUSTER_WEIGHT, "clusterWeights"); + glBindAttribLocation(program.programId(), gpu::Stream::INPUT_SLOT_SKIN_CLUSTER_WEIGHT, "clusterWeights"); glLinkProgram(program.programId()); @@ -406,7 +406,7 @@ bool Model::updateGeometry() { state.clusterMatrices.resize(mesh.clusters.size()); _meshStates.append(state); - gpu::BufferPtr buffer(new gpu::Buffer()); + gpu::BufferPointer buffer(new gpu::Buffer()); if (!mesh.blendshapes.isEmpty()) { buffer->resize((mesh.vertices.size() + mesh.normals.size()) * sizeof(glm::vec3)); buffer->setSubData(0, mesh.vertices.size() * sizeof(glm::vec3), (gpu::Resource::Byte*) mesh.vertices.constData()); @@ -670,9 +670,9 @@ bool Model::render(float alpha, RenderMode mode, RenderArgs* args) { GLBATCH(glDisableClientState)(GL_VERTEX_ARRAY); GLBATCH(glDisableClientState)(GL_TEXTURE_COORD_ARRAY); GLBATCH(glDisableClientState)(GL_COLOR_ARRAY); - GLBATCH(glDisableVertexAttribArray)(gpu::StreamFormat::SLOT_TANGENT); - GLBATCH(glDisableVertexAttribArray)(gpu::StreamFormat::SLOT_SKIN_CLUSTER_INDEX); - GLBATCH(glDisableVertexAttribArray)(gpu::StreamFormat::SLOT_SKIN_CLUSTER_WEIGHT); + GLBATCH(glDisableVertexAttribArray)(gpu::Stream::INPUT_SLOT_TANGENT); + GLBATCH(glDisableVertexAttribArray)(gpu::Stream::INPUT_SLOT_SKIN_CLUSTER_INDEX); + GLBATCH(glDisableVertexAttribArray)(gpu::Stream::INPUT_SLOT_SKIN_CLUSTER_WEIGHT); // bind with 0 to switch back to normal operation GLBATCH(glBindBuffer)(GL_ARRAY_BUFFER, 0); @@ -1411,7 +1411,7 @@ void Model::setBlendedVertices(int blendNumber, const QWeakPointersetSubData(0, mesh.vertices.size() * sizeof(glm::vec3), (gpu::Resource::Byte*) vertices.constData() + index*sizeof(glm::vec3)); buffer->setSubData(mesh.vertices.size() * sizeof(glm::vec3), mesh.normals.size() * sizeof(glm::vec3), (gpu::Resource::Byte*) normals.constData() + index*sizeof(glm::vec3)); @@ -1816,7 +1816,7 @@ int Model::renderMeshes(gpu::Batch& batch, RenderMode mode, bool translucent, fl const NetworkMesh& networkMesh = networkMeshes.at(i); const FBXMesh& mesh = geometry.meshes.at(i); - batch.setIndexBuffer(gpu::Element::TYPE_UINT32, (networkMesh._indexBuffer), 0); + batch.setIndexBuffer(gpu::TYPE_UINT32, (networkMesh._indexBuffer), 0); int vertexCount = mesh.vertices.size(); if (vertexCount == 0) { // sanity check @@ -1867,12 +1867,12 @@ int Model::renderMeshes(gpu::Batch& batch, RenderMode mode, bool translucent, fl if (mesh.blendshapes.isEmpty()) { batch.setInputFormat(networkMesh._vertexFormat); - batch.setInputStream(0, networkMesh._vertexStream); + batch.setInputStream(0, *networkMesh._vertexStream); } else { batch.setInputFormat(networkMesh._vertexFormat); batch.setInputBuffer(0, _blendedVertexBuffers[i], 0, sizeof(glm::vec3)); batch.setInputBuffer(1, _blendedVertexBuffers[i], vertexCount * sizeof(glm::vec3), sizeof(glm::vec3)); - batch.setInputStream(2, networkMesh._vertexStream); + batch.setInputStream(2, *networkMesh._vertexStream); } if (mesh.colors.isEmpty()) { diff --git a/interface/src/ui/TextRenderer.cpp b/interface/src/ui/TextRenderer.cpp index fe109752fe..ff366d50c6 100644 --- a/interface/src/ui/TextRenderer.cpp +++ b/interface/src/ui/TextRenderer.cpp @@ -182,15 +182,15 @@ TextRenderer::TextRenderer(const Properties& properties) : _glyphsBuffer(new gpu::Buffer()), _glyphsColorBuffer(new gpu::Buffer()), _numGlyphsBatched(0), - _glyphsStreamFormat(new gpu::StreamFormat()), - _glyphsStream(new gpu::Stream()) + _glyphsStreamFormat(new gpu::Stream::Format()), + _glyphsStream(new gpu::BufferStream()) { - _glyphsStreamFormat->setAttribute(gpu::StreamFormat::SLOT_POSITION, 0, gpu::Element(gpu::Element::DIM_VEC2, gpu::Element::TYPE_FLOAT, gpu::Element::SEMANTIC_POS_XYZ), 0); + _glyphsStreamFormat->setAttribute(gpu::Stream::INPUT_SLOT_POSITION, 0, gpu::Element(gpu::DIM_VEC2, gpu::TYPE_FLOAT, gpu::SEMANTIC_POS_XYZ), 0); const int NUM_POS_COORDS = 2; const int VERTEX_TEXCOORD_OFFSET = NUM_POS_COORDS * sizeof(float); - _glyphsStreamFormat->setAttribute(gpu::StreamFormat::SLOT_TEXCOORD, 0, gpu::Element(gpu::Element::DIM_VEC2, gpu::Element::TYPE_FLOAT, gpu::Element::SEMANTIC_UV), VERTEX_TEXCOORD_OFFSET); + _glyphsStreamFormat->setAttribute(gpu::Stream::INPUT_SLOT_TEXCOORD, 0, gpu::Element(gpu::DIM_VEC2, gpu::TYPE_FLOAT, gpu::SEMANTIC_UV), VERTEX_TEXCOORD_OFFSET); - _glyphsStreamFormat->setAttribute(gpu::StreamFormat::SLOT_COLOR, 1, gpu::Element(gpu::Element::DIM_VEC4, gpu::Element::TYPE_UINT8, gpu::Element::SEMANTIC_RGBA)); + _glyphsStreamFormat->setAttribute(gpu::Stream::INPUT_SLOT_COLOR, 1, gpu::Element(gpu::DIM_VEC4, gpu::TYPE_UINT8, gpu::SEMANTIC_RGBA)); _glyphsStream->addBuffer(_glyphsBuffer, 0, _glyphsStreamFormat->getChannels().at(0)._stride); _glyphsStream->addBuffer(_glyphsColorBuffer, 0, _glyphsStreamFormat->getChannels().at(1)._stride); @@ -335,7 +335,7 @@ void TextRenderer::drawBatch() { glColorPointer(4, GL_UNSIGNED_BYTE, 0, (GLvoid*) 0 ); */ batch.setInputFormat(_glyphsStreamFormat); - batch.setInputStream(0, _glyphsStream); + batch.setInputStream(0, *_glyphsStream); batch.draw(gpu::PRIMITIVE_QUADS, _numGlyphsBatched * 4, 0); gpu::GLBackend::renderBatch(batch); diff --git a/interface/src/ui/TextRenderer.h b/interface/src/ui/TextRenderer.h index 552ac5b158..bcb0ce8890 100644 --- a/interface/src/ui/TextRenderer.h +++ b/interface/src/ui/TextRenderer.h @@ -107,10 +107,10 @@ private: QColor _color; // Graphics Buffer containing the current accumulated glyphs to render - gpu::BufferPtr _glyphsBuffer; - gpu::BufferPtr _glyphsColorBuffer; - gpu::StreamFormatPtr _glyphsStreamFormat; - gpu::StreamPtr _glyphsStream; + gpu::BufferPointer _glyphsBuffer; + gpu::BufferPointer _glyphsColorBuffer; + gpu::Stream::FormatPointer _glyphsStreamFormat; + gpu::BufferStreamPointer _glyphsStream; int _numGlyphsBatched; static QHash _instances;