summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorJosh Bell <josh@lindenlab.com>2007-03-09 01:09:20 +0000
committerJosh Bell <josh@lindenlab.com>2007-03-09 01:09:20 +0000
commitb36dc363061ec5bf6b092c14193198e9a5eef816 (patch)
treeb067586bd545dfa6dce9dd0b1243b9c0aa143f33 /indra/llrender
parent6fa974fc64b172a7324b28d40f08f2a861d87f8d (diff)
svn merge -r 58902:58986 svn+ssh://svn.lindenlab.com/svn/linden/branches/maintenance --> release
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llimagegl.cpp2
-rw-r--r--indra/llrender/llvertexbuffer.cpp32
-rw-r--r--indra/llrender/llvertexbuffer.h6
3 files changed, 23 insertions, 17 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 9c1178b9f7..1196db18fa 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -713,6 +713,8 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3
if (!res) llerrs << "LLImageGL::setSubImage(): bindTexture failed" << llendl;
stop_glerror();
+ LLGLEnable tex( GL_TEXTURE_2D );
+
glTexSubImage2D(mTarget, 0, x_pos, y_pos,
width, height, mFormatPrimary, mFormatType, datap);
stop_glerror();
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index d6477d69ec..b94f593d7f 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -12,8 +12,8 @@
S32 LLVertexBuffer::sCount = 0;
S32 LLVertexBuffer::sGLCount = 0;
BOOL LLVertexBuffer::sEnableVBOs = TRUE;
-S32 LLVertexBuffer::sGLRenderBuffer = 0;
-S32 LLVertexBuffer::sGLRenderIndices = 0;
+U32 LLVertexBuffer::sGLRenderBuffer = 0;
+U32 LLVertexBuffer::sGLRenderIndices = 0;
U32 LLVertexBuffer::sLastMask = 0;
BOOL LLVertexBuffer::sVBOActive = FALSE;
BOOL LLVertexBuffer::sIBOActive = FALSE;
@@ -92,7 +92,7 @@ void LLVertexBuffer::stopRender()
sRenderActive = FALSE;
}
-void LLVertexBuffer::clientCopy()
+void LLVertexBuffer::clientCopy(F64 max_time)
{
if (!sDeleteList.empty())
{
@@ -122,7 +122,7 @@ void LLVertexBuffer::clientCopy()
}
else
{
- if (timer.getElapsedTimeF64() > 0.005)
+ if (timer.getElapsedTimeF64() > max_time)
{
break;
}
@@ -191,7 +191,10 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) :
mNumVerts(0), mNumIndices(0), mUsage(usage), mGLBuffer(0), mGLIndices(0),
mMappedData(NULL),
mMappedIndexData(NULL), mLocked(FALSE),
- mResized(FALSE), mEmpty(TRUE), mFinal(FALSE), mFilthy(FALSE)
+ mFinal(FALSE),
+ mFilthy(FALSE),
+ mEmpty(TRUE),
+ mResized(FALSE)
{
LLMemType mt(LLMemType::MTYPE_VERTEX_DATA);
if (!sEnableVBOs)
@@ -614,7 +617,6 @@ void LLVertexBuffer::unmapBuffer()
{
DirtyRegion& region = *i;
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, region.mIndex*mStride, region.mCount*mStride, mMappedData + region.mIndex*mStride);
- glFlush();
}
}
}
@@ -639,7 +641,6 @@ void LLVertexBuffer::unmapBuffer()
DirtyRegion& region = *i;
glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, region.mIndicesIndex*sizeof(U32),
region.mIndicesCount*sizeof(U32), mMappedIndexData + region.mIndicesIndex*sizeof(U32));
- glFlush();
}
}
}
@@ -786,13 +787,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
unmapBuffer();
}
else
- {
- if (!mDirtyRegions.empty())
- {
- mFilthy = TRUE;
- mDirtyRegions.clear();
- }
-
+ {
if (mGLBuffer)
{
if (sEnableVBOs && sVBOActive)
@@ -890,6 +885,15 @@ void LLVertexBuffer::markDirty(U32 vert_index, U32 vert_count, U32 indices_index
if (!mDirtyRegions.empty())
{
DirtyRegion& region = *(mDirtyRegions.rbegin());
+
+ if (region.mIndex+region.mCount > vert_index)
+ {
+ //this buffer has received multiple updates since the last copy, mark it filthy
+ mFilthy = TRUE;
+ mDirtyRegions.clear();
+ return;
+ }
+
if (region.mIndex + region.mCount == vert_index &&
region.mIndicesIndex + region.mIndicesCount == indices_index)
{
diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h
index e672321e76..b221d35ee3 100644
--- a/indra/llrender/llvertexbuffer.h
+++ b/indra/llrender/llvertexbuffer.h
@@ -29,7 +29,7 @@ public:
static void cleanupClass();
static void startRender(); //between start and stop render, no client copies will occur
static void stopRender(); //any buffer not copied to GL will be rendered from client memory
- static void clientCopy(); //copy data from client to GL
+ static void clientCopy(F64 max_time = 0.005); //copy data from client to GL
static void unbind(); //unbind any bound vertex buffer
enum {
@@ -167,8 +167,8 @@ public:
static BOOL sEnableVBOs;
static S32 sTypeOffsets[TYPE_MAX];
- static S32 sGLRenderBuffer;
- static S32 sGLRenderIndices;
+ static U32 sGLRenderBuffer;
+ static U32 sGLRenderIndices;
static BOOL sVBOActive;
static BOOL sIBOActive;
static U32 sLastMask;