Streamlined writes to bus external memory
This commit is contained in:
@@ -491,7 +491,7 @@ void LLVertexBuffer::createGLBuffer()
|
||||
static int gl_buffer_idx = 0;
|
||||
mGLBuffer = ++gl_buffer_idx;
|
||||
mMappedData = new U8[size];
|
||||
memset(mMappedData, 0, size);
|
||||
//memset(mMappedData, 0, size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,7 +521,7 @@ void LLVertexBuffer::createGLIndices()
|
||||
else
|
||||
{
|
||||
mMappedIndexData = new U8[size];
|
||||
memset(mMappedIndexData, 0, size);
|
||||
//memset(mMappedIndexData, 0, size);
|
||||
static int gl_buffer_idx = 0;
|
||||
mGLIndices = ++gl_buffer_idx;
|
||||
}
|
||||
@@ -692,21 +692,21 @@ void LLVertexBuffer::resizeBuffer(S32 newnverts, S32 newnindices)
|
||||
//delete old buffer, keep GL buffer for now
|
||||
if (!useVBOs())
|
||||
{
|
||||
U8* old = mMappedData;
|
||||
volatile U8* old = mMappedData;
|
||||
mMappedData = new U8[newsize];
|
||||
if (old)
|
||||
{
|
||||
memcpy(mMappedData, old, llmin(newsize, oldsize));
|
||||
memcpy((void*)mMappedData, (void*)old, llmin(newsize, oldsize));
|
||||
if (newsize > oldsize)
|
||||
{
|
||||
memset(mMappedData+oldsize, 0, newsize-oldsize);
|
||||
//memset(mMappedData+oldsize, 0, newsize-oldsize);
|
||||
}
|
||||
|
||||
delete [] old;
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(mMappedData, 0, newsize);
|
||||
//memset(mMappedData, 0, newsize);
|
||||
mEmpty = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -729,21 +729,21 @@ void LLVertexBuffer::resizeBuffer(S32 newnverts, S32 newnindices)
|
||||
if (!useVBOs())
|
||||
{
|
||||
//delete old buffer, keep GL buffer for now
|
||||
U8* old = mMappedIndexData;
|
||||
volatile U8* old = mMappedIndexData;
|
||||
mMappedIndexData = new U8[new_index_size];
|
||||
|
||||
if (old)
|
||||
{
|
||||
memcpy(mMappedIndexData, old, llmin(new_index_size, old_index_size));
|
||||
memcpy((void*)mMappedIndexData, (void*)old, llmin(new_index_size, old_index_size));
|
||||
if (new_index_size > old_index_size)
|
||||
{
|
||||
memset(mMappedIndexData+old_index_size, 0, new_index_size - old_index_size);
|
||||
//memset(mMappedIndexData+old_index_size, 0, new_index_size - old_index_size);
|
||||
}
|
||||
delete [] old;
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(mMappedIndexData, 0, new_index_size);
|
||||
//memset(mMappedIndexData, 0, new_index_size);
|
||||
mEmpty = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -783,7 +783,7 @@ BOOL LLVertexBuffer::useVBOs() const
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// Map for data access
|
||||
U8* LLVertexBuffer::mapBuffer(S32 access)
|
||||
volatile U8* LLVertexBuffer::mapBuffer(S32 access)
|
||||
{
|
||||
LLMemType mt(LLMemType::MTYPE_VERTEX_DATA);
|
||||
if (mFinal)
|
||||
@@ -1130,7 +1130,7 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) const
|
||||
{
|
||||
LLMemType mt(LLMemType::MTYPE_VERTEX_DATA);
|
||||
stop_glerror();
|
||||
U8* base = useVBOs() ? NULL : mMappedData;
|
||||
volatile U8* base = useVBOs() ? NULL : mMappedData;
|
||||
S32 stride = mStride;
|
||||
|
||||
if ((data_mask & mTypeMask) != data_mask)
|
||||
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
LLVertexBuffer(U32 typemask, S32 usage);
|
||||
|
||||
// map for data access
|
||||
U8* mapBuffer(S32 access = -1);
|
||||
volatile U8* mapBuffer(S32 access = -1);
|
||||
// set for rendering
|
||||
virtual void setBuffer(U32 data_mask); // calls setupVertexBuffer() if data_mask is not 0
|
||||
// allocate buffer
|
||||
@@ -183,15 +183,15 @@ public:
|
||||
S32 getRequestedVerts() const { return mRequestedNumVerts; }
|
||||
S32 getRequestedIndices() const { return mRequestedNumIndices; }
|
||||
|
||||
U8* getIndicesPointer() const { return useVBOs() ? NULL : mMappedIndexData; }
|
||||
U8* getVerticesPointer() const { return useVBOs() ? NULL : mMappedData; }
|
||||
volatile U8* getIndicesPointer() const { return useVBOs() ? NULL : mMappedIndexData; }
|
||||
volatile U8* getVerticesPointer() const { return useVBOs() ? NULL : mMappedData; }
|
||||
S32 getStride() const { return mStride; }
|
||||
S32 getTypeMask() const { return mTypeMask; }
|
||||
BOOL hasDataType(S32 type) const { return ((1 << type) & getTypeMask()) ? TRUE : FALSE; }
|
||||
S32 getSize() const { return mNumVerts*mStride; }
|
||||
S32 getIndicesSize() const { return mNumIndices * sizeof(U16); }
|
||||
U8* getMappedData() const { return mMappedData; }
|
||||
U8* getMappedIndices() const { return mMappedIndexData; }
|
||||
volatile U8* getMappedData() const { return mMappedData; }
|
||||
volatile U8* getMappedIndices() const { return mMappedIndexData; }
|
||||
S32 getOffset(S32 type) const { return mOffsets[type]; }
|
||||
S32 getUsage() const { return mUsage; }
|
||||
|
||||
@@ -214,8 +214,8 @@ protected:
|
||||
S32 mUsage; // GL usage
|
||||
U32 mGLBuffer; // GL VBO handle
|
||||
U32 mGLIndices; // GL IBO handle
|
||||
U8* mMappedData; // pointer to currently mapped data (NULL if unmapped)
|
||||
U8* mMappedIndexData; // pointer to currently mapped indices (NULL if unmapped)
|
||||
volatile U8* mMappedData; // pointer to currently mapped data (NULL if unmapped)
|
||||
volatile U8* mMappedIndexData; // pointer to currently mapped indices (NULL if unmapped)
|
||||
BOOL mLocked; // if TRUE, buffer is being or has been written to in client memory
|
||||
BOOL mFinal; // if TRUE, buffer can not be mapped again
|
||||
BOOL mFilthy; // if TRUE, entire buffer must be copied (used to prevent redundant dirty flags)
|
||||
|
||||
@@ -873,7 +873,7 @@ void LLVertexBufferAvatar::setupVertexBuffer(U32 data_mask) const
|
||||
{
|
||||
if (sRenderingSkinned)
|
||||
{
|
||||
U8* base = useVBOs() ? NULL : mMappedData;
|
||||
volatile U8* base = useVBOs() ? NULL : mMappedData;
|
||||
|
||||
glVertexPointer(3,GL_FLOAT, mStride, (void*)(base + 0));
|
||||
glNormalPointer(GL_FLOAT, mStride, (void*)(base + mOffsets[TYPE_NORMAL]));
|
||||
|
||||
Reference in New Issue
Block a user