A pass at cleaning up LLVertexBuffer a bit. Also removing extra unbinds that caused synchronization issues with mapped vbos.
This commit is contained in:
@@ -88,7 +88,7 @@ void LLVBOPool::releaseName(GLuint name)
|
||||
}
|
||||
|
||||
|
||||
S32 LLVertexBuffer::sTypeOffsets[LLVertexBuffer::TYPE_MAX] =
|
||||
S32 LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_MAX] =
|
||||
{
|
||||
sizeof(LLVector4), // TYPE_VERTEX,
|
||||
sizeof(LLVector4), // TYPE_NORMAL,
|
||||
@@ -506,7 +506,7 @@ S32 LLVertexBuffer::calcStride(const U32& typemask, S32* offsets)
|
||||
{
|
||||
offsets[i] = stride;
|
||||
}
|
||||
stride += sTypeOffsets[i];
|
||||
stride += sTypeSize[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,7 +690,7 @@ void LLVertexBuffer::destroyGLBuffer()
|
||||
}
|
||||
|
||||
mGLBuffer = 0;
|
||||
unbind();
|
||||
//unbind();
|
||||
}
|
||||
|
||||
void LLVertexBuffer::destroyGLIndices()
|
||||
@@ -719,7 +719,7 @@ void LLVertexBuffer::destroyGLIndices()
|
||||
}
|
||||
|
||||
mGLIndices = 0;
|
||||
unbind();
|
||||
//unbind();
|
||||
}
|
||||
|
||||
void LLVertexBuffer::updateNumVerts(S32 nverts)
|
||||
@@ -1277,7 +1277,7 @@ void LLVertexBuffer::setStride(S32 type, S32 new_stride)
|
||||
llerrs << "LLVertexBuffer::setOffset called with mNumVerts = " << mNumVerts << llendl;
|
||||
}
|
||||
// This code assumes that setStride() will only be called once per VBO per type.
|
||||
S32 delta = new_stride - sTypeOffsets[type];
|
||||
S32 delta = new_stride - sTypeSize[type];
|
||||
for (S32 i=type+1; i<TYPE_MAX; i++)
|
||||
{
|
||||
if (mTypeMask & (1<<i))
|
||||
|
||||
@@ -81,6 +81,7 @@ public:
|
||||
llerrs << "Illegal operation!" << llendl;
|
||||
return *this;
|
||||
}
|
||||
|
||||
static LLVBOPool sStreamVBOPool;
|
||||
static LLVBOPool sDynamicVBOPool;
|
||||
static LLVBOPool sStreamIBOPool;
|
||||
@@ -91,11 +92,12 @@ public:
|
||||
static BOOL sUseStreamDraw;
|
||||
static BOOL sOmitBlank;
|
||||
static BOOL sPreferStreamDraw;
|
||||
|
||||
|
||||
static void initClass(bool use_vbo, bool no_vbo_mapping);
|
||||
static void cleanupClass();
|
||||
static void setupClientArrays(U32 data_mask);
|
||||
static void drawArrays(U32 mode, const std::vector<LLVector3>& pos, const std::vector<LLVector3>& norm);
|
||||
|
||||
static void clientCopy(F64 max_time = 0.005); //copy data from client to GL
|
||||
static void unbind(); //unbind any bound vertex buffer
|
||||
|
||||
@@ -197,8 +199,8 @@ public:
|
||||
S32 getRequestedVerts() const { return mRequestedNumVerts; }
|
||||
S32 getRequestedIndices() const { return mRequestedNumIndices; }
|
||||
|
||||
volatile U8* getIndicesPointer() const { return useVBOs() ? NULL : mMappedIndexData; }
|
||||
volatile U8* getVerticesPointer() const { return useVBOs() ? NULL : mMappedData; }
|
||||
volatile U8* getIndicesPointer() const { return useVBOs() ? (U8*) mAlignedIndexOffset : mMappedIndexData; }
|
||||
volatile U8* getVerticesPointer() const { return useVBOs() ? (U8*) mAlignedOffset : mMappedData; }
|
||||
S32 getStride() const { return mStride; }
|
||||
S32 getTypeMask() const { return mTypeMask; }
|
||||
BOOL hasDataType(S32 type) const { return ((1 << type) & getTypeMask()) ? TRUE : FALSE; }
|
||||
@@ -246,21 +248,6 @@ protected:
|
||||
BOOL mDynamicSize; // if TRUE, buffer has been resized at least once (and should be padded)
|
||||
S32 mOffsets[TYPE_MAX];
|
||||
|
||||
class DirtyRegion
|
||||
{
|
||||
public:
|
||||
U32 mIndex;
|
||||
U32 mCount;
|
||||
U32 mIndicesIndex;
|
||||
U32 mIndicesCount;
|
||||
|
||||
DirtyRegion(U32 vi, U32 vc, U32 ii, U32 ic)
|
||||
: mIndex(vi), mCount(vc), mIndicesIndex(ii), mIndicesCount(ic)
|
||||
{ }
|
||||
};
|
||||
|
||||
std::vector<DirtyRegion> mDirtyRegions; //vector of dirty regions to rebuild
|
||||
|
||||
public:
|
||||
static S32 sCount;
|
||||
static S32 sGLCount;
|
||||
@@ -271,7 +258,7 @@ public:
|
||||
|
||||
static BOOL sDisableVBOMapping; //disable glMapBufferARB
|
||||
static BOOL sEnableVBOs;
|
||||
static S32 sTypeOffsets[TYPE_MAX];
|
||||
static S32 sTypeSize[TYPE_MAX];
|
||||
static U32 sGLMode[LLRender::NUM_MODES];
|
||||
static U32 sGLRenderBuffer;
|
||||
static U32 sGLRenderIndices;
|
||||
|
||||
@@ -70,6 +70,7 @@ void LLDrawPoolSky::prerender()
|
||||
void LLDrawPoolSky::render(S32 pass)
|
||||
{
|
||||
gGL.flush();
|
||||
|
||||
if (mDrawFace.empty())
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -222,6 +222,8 @@ void LLDrawPoolTerrain::render(S32 pass)
|
||||
sShader->unbind();
|
||||
sShader = &gObjectFullbrightProgram;
|
||||
sShader->bind();
|
||||
LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(-1.0f, -1.0f);
|
||||
renderOwnership();
|
||||
sShader = old_shader;
|
||||
sShader->bind();
|
||||
|
||||
Reference in New Issue
Block a user