diff options
Diffstat (limited to 'indra/llrender/llvertexbuffer.h')
-rw-r--r-- | indra/llrender/llvertexbuffer.h | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 293f740497..d4c6fbaf18 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -38,6 +38,7 @@ #include <set> #include <vector> #include <list> +#include <glm/gtc/matrix_transform.hpp> #define LL_MAX_VERTEX_ATTRIB_LOCATION 64 @@ -53,6 +54,40 @@ //============================================================================ // base class class LLPrivateMemoryPool; +class LLVertexBuffer; + +class LLVertexBufferData +{ +public: + LLVertexBufferData() + : mVB(nullptr) + , mMode(0) + , mCount(0) + , mTexName(0) + , mProjection(glm::identity<glm::mat4>()) + , mModelView(glm::identity<glm::mat4>()) + , mTexture0(glm::identity<glm::mat4>()) + {} + LLVertexBufferData(LLVertexBuffer* buffer, U8 mode, U32 count, U32 tex_name, const glm::mat4& model_view, const glm::mat4& projection, const glm::mat4& texture0) + : mVB(buffer) + , mMode(mode) + , mCount(count) + , mTexName(tex_name) + , mProjection(model_view) + , mModelView(projection) + , mTexture0(texture0) + {} + void draw(); + LLPointer<LLVertexBuffer> mVB; + U8 mMode; + U32 mCount; + U32 mTexName; + glm::mat4 mProjection; + glm::mat4 mModelView; + glm::mat4 mTexture0; +}; +typedef std::list<LLVertexBufferData> buffer_data_list_t; + class LLVertexBuffer final : public LLRefCount { public: @@ -89,6 +124,9 @@ public: // indexed by the following enum static U32 calcOffsets(const U32& typemask, U32* offsets, U32 num_vertices); + // flush any pending mapped buffers + static void flushBuffers(); + //WARNING -- when updating these enums you MUST // 1 - update LLVertexBuffer::sTypeSize // 2 - update LLVertexBuffer::vb_type_name @@ -159,6 +197,8 @@ public: // map for data access (see also getFooStrider below) U8* mapVertexBuffer(AttributeType type, U32 index, S32 count = -1); U8* mapIndexBuffer(U32 index, S32 count = -1); + + // synonym for flushBuffers void unmapBuffer(); // set for rendering @@ -281,6 +321,13 @@ private: bool allocateBuffer(S32 nverts, S32 nindices, bool create) { return allocateBuffer(nverts, nindices); } + // actually unmap buffer + void _unmapBuffer(); + + // add to set of mapped buffers + void _mapBuffer(); + bool mMapped = false; + public: static U64 getBytesAllocated(); @@ -290,8 +337,6 @@ public: static U32 sGLRenderIndices; static U32 sLastMask; static U32 sVertexCount; - - static U32 sMappingMode; }; #ifdef LL_PROFILER_ENABLE_RENDER_DOC |