More should-be-safe changes. Prep for pipeline work.
This commit is contained in:
@@ -68,6 +68,17 @@ const U32 SILHOUETTE_HIGHLIGHT = 0;
|
|||||||
class LLDrawable : public LLRefCount
|
class LLDrawable : public LLRefCount
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
LLDrawable(const LLDrawable& rhs)
|
||||||
|
{
|
||||||
|
*this = rhs;
|
||||||
|
}
|
||||||
|
|
||||||
|
const LLDrawable& operator=(const LLDrawable& rhs)
|
||||||
|
{
|
||||||
|
llerrs << "Illegal operation!" << llendl;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
static void initClass();
|
static void initClass();
|
||||||
|
|
||||||
LLDrawable() { init(); }
|
LLDrawable() { init(); }
|
||||||
@@ -103,7 +114,7 @@ public:
|
|||||||
const LLQuaternion& getRotation() const { return mXform.getRotation(); }
|
const LLQuaternion& getRotation() const { return mXform.getRotation(); }
|
||||||
F32 getIntensity() const { return llmin(mXform.getScale().mV[0], 4.f); }
|
F32 getIntensity() const { return llmin(mXform.getScale().mV[0], 4.f); }
|
||||||
S32 getLOD() const { return mVObjp ? mVObjp->getLOD() : 1; }
|
S32 getLOD() const { return mVObjp ? mVObjp->getLOD() : 1; }
|
||||||
F64 getBinRadius() const { return mBinRadius; }
|
F32 getBinRadius() const { return mBinRadius; }
|
||||||
void getMinMax(LLVector3& min,LLVector3& max) const { mXform.getMinMax(min,max); }
|
void getMinMax(LLVector3& min,LLVector3& max) const { mXform.getMinMax(min,max); }
|
||||||
LLXformMatrix* getXform() { return &mXform; }
|
LLXformMatrix* getXform() { return &mXform; }
|
||||||
|
|
||||||
@@ -301,9 +312,9 @@ private:
|
|||||||
F32 mRadius;
|
F32 mRadius;
|
||||||
LLVector3 mExtents[2];
|
LLVector3 mExtents[2];
|
||||||
LLVector3d mPositionGroup;
|
LLVector3d mPositionGroup;
|
||||||
F64 mBinRadius;
|
F32 mBinRadius;
|
||||||
S32 mGeneration;
|
S32 mGeneration;
|
||||||
|
|
||||||
LLVector3 mCurrentScale;
|
LLVector3 mCurrentScale;
|
||||||
|
|
||||||
static U32 sCurVisible; // Counter for what value of mVisible means currently visible
|
static U32 sCurVisible; // Counter for what value of mVisible means currently visible
|
||||||
|
|||||||
@@ -198,7 +198,10 @@ void LLDrawPoolAlpha::render(S32 pass)
|
|||||||
simple_shader->bind();
|
simple_shader->bind();
|
||||||
pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask());
|
pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask());
|
||||||
}
|
}
|
||||||
fullbright_shader->bind();
|
if (fullbright_shader)
|
||||||
|
{
|
||||||
|
fullbright_shader->bind();
|
||||||
|
}
|
||||||
pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask());
|
pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask());
|
||||||
LLGLSLShader::bindNoShader();
|
LLGLSLShader::bindNoShader();
|
||||||
}
|
}
|
||||||
@@ -238,7 +241,7 @@ void LLDrawPoolAlpha::render(S32 pass)
|
|||||||
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
|
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
|
||||||
glColor4f(1,0,0,1);
|
glColor4f(1,0,0,1);
|
||||||
LLViewerFetchedTexture::sSmokeImagep->addTextureStats(1024.f*1024.f);
|
LLViewerFetchedTexture::sSmokeImagep->addTextureStats(1024.f*1024.f);
|
||||||
gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sSmokeImagep.get(), TRUE);
|
gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sSmokeImagep, TRUE) ;
|
||||||
renderAlphaHighlight(LLVertexBuffer::MAP_VERTEX |
|
renderAlphaHighlight(LLVertexBuffer::MAP_VERTEX |
|
||||||
LLVertexBuffer::MAP_TEXCOORD0);
|
LLVertexBuffer::MAP_TEXCOORD0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -228,6 +228,11 @@ void LLFace::setWorldMatrix(const LLMatrix4 &mat)
|
|||||||
llerrs << "Faces on this drawable are not independently modifiable\n" << llendl;
|
llerrs << "Faces on this drawable are not independently modifiable\n" << llendl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLFace::setPool(LLFacePool* pool)
|
||||||
|
{
|
||||||
|
mDrawPoolp = pool;
|
||||||
|
}
|
||||||
|
|
||||||
void LLFace::setPool(LLFacePool* new_pool, LLViewerTexture *texturep)
|
void LLFace::setPool(LLFacePool* new_pool, LLViewerTexture *texturep)
|
||||||
{
|
{
|
||||||
LLMemType mt1(LLMemType::MTYPE_DRAWABLE);
|
LLMemType mt1(LLMemType::MTYPE_DRAWABLE);
|
||||||
@@ -329,8 +334,13 @@ void LLFace::setDrawable(LLDrawable *drawable)
|
|||||||
mXform = &drawable->mXform;
|
mXform = &drawable->mXform;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLFace::setSize(const S32 num_vertices, const S32 num_indices)
|
void LLFace::setSize(S32 num_vertices, const S32 num_indices, bool align)
|
||||||
{
|
{
|
||||||
|
if (align)
|
||||||
|
{
|
||||||
|
//allocate vertices in blocks of 4 for alignment
|
||||||
|
num_vertices = (num_vertices + 0x3) & ~0x3;
|
||||||
|
}
|
||||||
if (mGeomCount != num_vertices ||
|
if (mGeomCount != num_vertices ||
|
||||||
mIndicesCount != num_indices)
|
mIndicesCount != num_indices)
|
||||||
{
|
{
|
||||||
@@ -339,6 +349,8 @@ void LLFace::setSize(const S32 num_vertices, const S32 num_indices)
|
|||||||
mVertexBuffer = NULL;
|
mVertexBuffer = NULL;
|
||||||
mLastVertexBuffer = NULL;
|
mLastVertexBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
llassert(verify());
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@@ -952,6 +964,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||||||
const LLMatrix4& mat_vert, const LLMatrix3& mat_normal,
|
const LLMatrix4& mat_vert, const LLMatrix3& mat_normal,
|
||||||
const U16 &index_offset)
|
const U16 &index_offset)
|
||||||
{
|
{
|
||||||
|
llassert(verify());
|
||||||
const LLVolumeFace &vf = volume.getVolumeFace(f);
|
const LLVolumeFace &vf = volume.getVolumeFace(f);
|
||||||
S32 num_vertices = (S32)vf.mVertices.size();
|
S32 num_vertices = (S32)vf.mVertices.size();
|
||||||
S32 num_indices = (S32)vf.mIndices.size();
|
S32 num_indices = (S32)vf.mIndices.size();
|
||||||
@@ -1678,3 +1691,16 @@ LLViewerTexture* LLFace::getTexture() const
|
|||||||
{
|
{
|
||||||
return mTexture ;
|
return mTexture ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLFace::setVertexBuffer(LLVertexBuffer* buffer)
|
||||||
|
{
|
||||||
|
mVertexBuffer = buffer;
|
||||||
|
llassert(verify());
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLFace::clearVertexBuffer()
|
||||||
|
{
|
||||||
|
mVertexBuffer = NULL;
|
||||||
|
mLastVertexBuffer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ void LLSpatialGroup::checkStates()
|
|||||||
void validate_draw_info(LLDrawInfo& params)
|
void validate_draw_info(LLDrawInfo& params)
|
||||||
{
|
{
|
||||||
#if LL_OCTREE_PARANOIA_CHECK
|
#if LL_OCTREE_PARANOIA_CHECK
|
||||||
if (params.mVertexBuffer.isNull())
|
if (!params.mVertexBuffer)
|
||||||
{
|
{
|
||||||
llerrs << "Draw batch has no vertex buffer." << llendl;
|
llerrs << "Draw batch has no vertex buffer." << llendl;
|
||||||
}
|
}
|
||||||
@@ -1309,8 +1309,7 @@ void LLSpatialGroup::destroyGL()
|
|||||||
for (S32 j = 0; j < drawable->getNumFaces(); j++)
|
for (S32 j = 0; j < drawable->getNumFaces(); j++)
|
||||||
{
|
{
|
||||||
LLFace* facep = drawable->getFace(j);
|
LLFace* facep = drawable->getFace(j);
|
||||||
facep->mVertexBuffer = NULL;
|
facep->clearVertexBuffer();
|
||||||
facep->mLastVertexBuffer = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1519,7 +1518,6 @@ LLSpatialPartition::LLSpatialPartition(U32 data_mask, BOOL render_by_group, U32
|
|||||||
mSlopRatio = 0.25f;
|
mSlopRatio = 0.25f;
|
||||||
mInfiniteFarClip = FALSE;
|
mInfiniteFarClip = FALSE;
|
||||||
|
|
||||||
LLGLNamePool::registerPool(&sQueryPool);
|
|
||||||
|
|
||||||
mOctree = new LLSpatialGroup::OctreeRoot(LLVector3d(0,0,0),
|
mOctree = new LLSpatialGroup::OctreeRoot(LLVector3d(0,0,0),
|
||||||
LLVector3d(1,1,1),
|
LLVector3d(1,1,1),
|
||||||
@@ -1934,6 +1932,8 @@ public:
|
|||||||
|
|
||||||
void drawBox(const LLVector3& c, const LLVector3& r)
|
void drawBox(const LLVector3& c, const LLVector3& r)
|
||||||
{
|
{
|
||||||
|
LLVertexBuffer::unbind();
|
||||||
|
|
||||||
gGL.begin(LLRender::TRIANGLE_STRIP);
|
gGL.begin(LLRender::TRIANGLE_STRIP);
|
||||||
//left front
|
//left front
|
||||||
gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,-1))).mV);
|
gGL.vertex3fv((c+r.scaledVec(LLVector3(-1,1,-1))).mV);
|
||||||
@@ -2179,7 +2179,7 @@ void pushVerts(LLSpatialGroup* group, U32 mask)
|
|||||||
|
|
||||||
void pushVerts(LLFace* face, U32 mask)
|
void pushVerts(LLFace* face, U32 mask)
|
||||||
{
|
{
|
||||||
LLVertexBuffer* buffer = face->mVertexBuffer;
|
LLVertexBuffer* buffer = face->getVertexBuffer();
|
||||||
|
|
||||||
if (buffer)
|
if (buffer)
|
||||||
{
|
{
|
||||||
@@ -2309,7 +2309,7 @@ void renderOctree(LLSpatialGroup* group)
|
|||||||
for (S32 j = 0; j < drawable->getNumFaces(); j++)
|
for (S32 j = 0; j < drawable->getNumFaces(); j++)
|
||||||
{
|
{
|
||||||
LLFace* face = drawable->getFace(j);
|
LLFace* face = drawable->getFace(j);
|
||||||
if (face->mVertexBuffer.notNull())
|
if (face->getVertexBuffer())
|
||||||
{
|
{
|
||||||
if (gFrameTimeSeconds - face->mLastUpdateTime < 0.5f)
|
if (gFrameTimeSeconds - face->mLastUpdateTime < 0.5f)
|
||||||
{
|
{
|
||||||
@@ -2324,10 +2324,10 @@ void renderOctree(LLSpatialGroup* group)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
face->mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
face->getVertexBuffer()->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||||
//drawBox((face->mExtents[0] + face->mExtents[1])*0.5f,
|
//drawBox((face->mExtents[0] + face->mExtents[1])*0.5f,
|
||||||
// (face->mExtents[1]-face->mExtents[0])*0.5f);
|
// (face->mExtents[1]-face->mExtents[0])*0.5f);
|
||||||
face->mVertexBuffer->draw(LLRender::TRIANGLES, face->getIndicesCount(), face->getIndicesStart());
|
face->getVertexBuffer()->draw(LLRender::TRIANGLES, face->getIndicesCount(), face->getIndicesStart());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ void LLViewerShaderMgr::initAttribsAndUniforms(void)
|
|||||||
mReservedAttribs.push_back("materialColor");
|
mReservedAttribs.push_back("materialColor");
|
||||||
mReservedAttribs.push_back("specularColor");
|
mReservedAttribs.push_back("specularColor");
|
||||||
mReservedAttribs.push_back("binormal");
|
mReservedAttribs.push_back("binormal");
|
||||||
|
mReservedAttribs.push_back("object_weight");
|
||||||
|
|
||||||
mAvatarAttribs.reserve(5);
|
mAvatarAttribs.reserve(5);
|
||||||
mAvatarAttribs.push_back("weight");
|
mAvatarAttribs.push_back("weight");
|
||||||
@@ -566,7 +567,7 @@ BOOL LLViewerShaderMgr::loadBasicShaders()
|
|||||||
// (in order of shader function call depth for reference purposes, deepest level first)
|
// (in order of shader function call depth for reference purposes, deepest level first)
|
||||||
|
|
||||||
shaders.clear();
|
shaders.clear();
|
||||||
shaders.reserve(12);
|
shaders.reserve(13);
|
||||||
shaders.push_back( make_pair( "windlight/atmosphericsVarsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );
|
shaders.push_back( make_pair( "windlight/atmosphericsVarsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );
|
||||||
shaders.push_back( make_pair( "windlight/gammaF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT]) );
|
shaders.push_back( make_pair( "windlight/gammaF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT]) );
|
||||||
shaders.push_back( make_pair( "windlight/atmosphericsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );
|
shaders.push_back( make_pair( "windlight/atmosphericsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ public:
|
|||||||
MATERIAL_COLOR = 0,
|
MATERIAL_COLOR = 0,
|
||||||
SPECULAR_COLOR,
|
SPECULAR_COLOR,
|
||||||
BINORMAL,
|
BINORMAL,
|
||||||
|
OBJECT_WEIGHT,
|
||||||
END_RESERVED_ATTRIBS
|
END_RESERVED_ATTRIBS
|
||||||
} eGLSLReservedAttribs;
|
} eGLSLReservedAttribs;
|
||||||
|
|
||||||
|
|||||||
@@ -1272,6 +1272,17 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable)
|
|||||||
regenFaces();
|
regenFaces();
|
||||||
}
|
}
|
||||||
genBBoxes(FALSE);
|
genBBoxes(FALSE);
|
||||||
|
|
||||||
|
if (mSculptChanged)
|
||||||
|
{ //changes in sculpt maps can thrash an object bounding box without
|
||||||
|
//triggering a spatial group bounding box update -- force spatial group
|
||||||
|
//to update bounding boxes
|
||||||
|
LLSpatialGroup* group = mDrawable->getSpatialGroup();
|
||||||
|
if (group)
|
||||||
|
{
|
||||||
|
group->unbound();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2347,7 +2358,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
|
|||||||
(type == LLRenderPass::PASS_INVISIBLE) ||
|
(type == LLRenderPass::PASS_INVISIBLE) ||
|
||||||
(type == LLRenderPass::PASS_ALPHA && facep->isState(LLFace::FULLBRIGHT));
|
(type == LLRenderPass::PASS_ALPHA && facep->isState(LLFace::FULLBRIGHT));
|
||||||
|
|
||||||
if (!fullbright && type != LLRenderPass::PASS_GLOW && !facep->mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL))
|
if (!fullbright && type != LLRenderPass::PASS_GLOW && !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_NORMAL))
|
||||||
{
|
{
|
||||||
llwarns << "Non fullbright face has no normals!" << llendl;
|
llwarns << "Non fullbright face has no normals!" << llendl;
|
||||||
return;
|
return;
|
||||||
@@ -2383,13 +2394,13 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
|
|||||||
glow = (U8) (facep->getTextureEntry()->getGlow() * 255);
|
glow = (U8) (facep->getTextureEntry()->getGlow() * 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (facep->mVertexBuffer.isNull())
|
if (!facep->getVertexBuffer())
|
||||||
{
|
{
|
||||||
llerrs << "WTF?" << llendl;
|
llerrs << "WTF?" << llendl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idx >= 0 &&
|
if (idx >= 0 &&
|
||||||
draw_vec[idx]->mVertexBuffer == facep->mVertexBuffer &&
|
draw_vec[idx]->mVertexBuffer == facep->getVertexBuffer() &&
|
||||||
draw_vec[idx]->mEnd == facep->getGeomIndex()-1 &&
|
draw_vec[idx]->mEnd == facep->getGeomIndex()-1 &&
|
||||||
(LLPipeline::sTextureBindTest || draw_vec[idx]->mTexture == tex) &&
|
(LLPipeline::sTextureBindTest || draw_vec[idx]->mTexture == tex) &&
|
||||||
#if LL_DARWIN
|
#if LL_DARWIN
|
||||||
@@ -2416,7 +2427,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
|
|||||||
U32 offset = facep->getIndicesStart();
|
U32 offset = facep->getIndicesStart();
|
||||||
U32 count = facep->getIndicesCount();
|
U32 count = facep->getIndicesCount();
|
||||||
LLPointer<LLDrawInfo> draw_info = new LLDrawInfo(start,end,count,offset,tex,
|
LLPointer<LLDrawInfo> draw_info = new LLDrawInfo(start,end,count,offset,tex,
|
||||||
facep->mVertexBuffer, fullbright, bump);
|
facep->getVertexBuffer(), fullbright, bump);
|
||||||
draw_info->mGroup = group;
|
draw_info->mGroup = group;
|
||||||
draw_info->mVSize = facep->getVirtualSize();
|
draw_info->mVSize = facep->getVirtualSize();
|
||||||
draw_vec.push_back(draw_info);
|
draw_vec.push_back(draw_info);
|
||||||
@@ -2513,20 +2524,23 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||||||
//for each face
|
//for each face
|
||||||
for (S32 i = 0; i < drawablep->getNumFaces(); i++)
|
for (S32 i = 0; i < drawablep->getNumFaces(); i++)
|
||||||
{
|
{
|
||||||
|
LLFace* facep = drawablep->getFace(i);
|
||||||
|
|
||||||
|
//ALWAYS null out vertex buffer on rebuild -- if the face lands in a render
|
||||||
|
// batch, it will recover its vertex buffer reference from the spatial group
|
||||||
|
facep->setVertexBuffer(NULL);
|
||||||
//sum up face verts and indices
|
//sum up face verts and indices
|
||||||
drawablep->updateFaceSize(i);
|
drawablep->updateFaceSize(i);
|
||||||
LLFace* facep = drawablep->getFace(i);
|
|
||||||
|
|
||||||
if (cur_total > max_total || facep->getIndicesCount() <= 0 || facep->getGeomCount() <= 0)
|
if (cur_total > max_total || facep->getIndicesCount() <= 0 || facep->getGeomCount() <= 0)
|
||||||
{
|
{
|
||||||
facep->mVertexBuffer = NULL;
|
facep->clearVertexBuffer();
|
||||||
facep->mLastVertexBuffer = NULL;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_total += facep->getGeomCount();
|
cur_total += facep->getGeomCount();
|
||||||
|
|
||||||
if (facep->hasGeometry() && facep->mPixelArea > FORCE_CULL_AREA)
|
if (facep->hasGeometry() && facep->getPixelArea() > FORCE_CULL_AREA)
|
||||||
{
|
{
|
||||||
const LLTextureEntry* te = facep->getTextureEntry();
|
const LLTextureEntry* te = facep->getTextureEntry();
|
||||||
LLViewerTexture* tex = facep->getTexture();
|
LLViewerTexture* tex = facep->getTexture();
|
||||||
@@ -2539,7 +2553,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL force_simple = (facep->mPixelArea < FORCE_SIMPLE_RENDER_AREA);
|
BOOL force_simple = (facep->getPixelArea() < FORCE_SIMPLE_RENDER_AREA);
|
||||||
U32 type = gPipeline.getPoolTypeFromTE(te, tex);
|
U32 type = gPipeline.getPoolTypeFromTE(te, tex);
|
||||||
if (type != LLDrawPool::POOL_ALPHA && force_simple)
|
if (type != LLDrawPool::POOL_ALPHA && force_simple)
|
||||||
{
|
{
|
||||||
@@ -2625,8 +2639,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ //face has no renderable geometry
|
{ //face has no renderable geometry
|
||||||
facep->mVertexBuffer = NULL;
|
facep->clearVertexBuffer();
|
||||||
facep->mLastVertexBuffer = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2697,7 +2710,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
|
|||||||
for (S32 i = 0; i < drawablep->getNumFaces(); ++i)
|
for (S32 i = 0; i < drawablep->getNumFaces(); ++i)
|
||||||
{
|
{
|
||||||
LLFace* face = drawablep->getFace(i);
|
LLFace* face = drawablep->getFace(i);
|
||||||
if (face && face->mVertexBuffer.notNull())
|
if (face && face->getVertexBuffer())
|
||||||
{
|
{
|
||||||
face->getGeometryVolume(*volume, face->getTEOffset(),
|
face->getGeometryVolume(*volume, face->getTEOffset(),
|
||||||
vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), face->getGeomIndex());
|
vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), face->getGeomIndex());
|
||||||
@@ -2748,9 +2761,10 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
|
|||||||
for (S32 i = 0; i < drawablep->getNumFaces(); ++i)
|
for (S32 i = 0; i < drawablep->getNumFaces(); ++i)
|
||||||
{
|
{
|
||||||
LLFace* face = drawablep->getFace(i);
|
LLFace* face = drawablep->getFace(i);
|
||||||
if (face && face->mVertexBuffer.notNull() && face->mVertexBuffer->isLocked())
|
LLVertexBuffer* buff = face ? face->getVertexBuffer() : NULL;
|
||||||
|
if (buff && buff->isLocked())
|
||||||
{
|
{
|
||||||
face->mVertexBuffer->setBuffer(0) ;
|
buff->setBuffer(0) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2852,14 +2866,13 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
|
|||||||
buffer->allocateBuffer(geom_count, index_count, TRUE);
|
buffer->allocateBuffer(geom_count, index_count, TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{ //resize pre-existing buffer
|
||||||
if (LLVertexBuffer::sEnableVBOs && buffer->getUsage() != group->mBufferUsage)
|
if (LLVertexBuffer::sEnableVBOs && buffer->getUsage() != group->mBufferUsage ||
|
||||||
|
buffer->getTypeMask() != mask)
|
||||||
{
|
{
|
||||||
//Using group->mSpatialPartition->mVertexDataMask may be dropping MAP_BINORMAL on RENDER_BUMP...
|
buffer = createVertexBuffer(mask,
|
||||||
buffer = createVertexBuffer(mask /*group->mSpatialPartition->mVertexDataMask*/,
|
|
||||||
group->mBufferUsage);
|
group->mBufferUsage);
|
||||||
buffer->allocateBuffer(geom_count, index_count, TRUE);
|
buffer->allocateBuffer(geom_count, index_count, TRUE);
|
||||||
llassert_always(buffer->getTypeMask() == mask);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2875,11 +2888,12 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
|
|||||||
U16 index_offset = 0;
|
U16 index_offset = 0;
|
||||||
|
|
||||||
while (face_iter < i)
|
while (face_iter < i)
|
||||||
{
|
{ //update face indices for new buffer
|
||||||
facep = *face_iter;
|
facep = *face_iter;
|
||||||
facep->mIndicesIndex = indices_index;
|
facep->setIndicesIndex(indices_index);
|
||||||
facep->mGeomIndex = index_offset;
|
facep->setGeomIndex(index_offset);
|
||||||
facep->mVertexBuffer = buffer;
|
facep->setVertexBuffer(buffer);
|
||||||
|
|
||||||
{
|
{
|
||||||
facep->updateRebuildFlags();
|
facep->updateRebuildFlags();
|
||||||
if (!LLPipeline::sDelayVBUpdate)
|
if (!LLPipeline::sDelayVBUpdate)
|
||||||
@@ -2900,9 +2914,12 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
|
|||||||
}
|
}
|
||||||
|
|
||||||
index_offset += facep->getGeomCount();
|
index_offset += facep->getGeomCount();
|
||||||
indices_index += facep->mIndicesCount;
|
indices_index += facep->getIndicesCount();
|
||||||
|
|
||||||
BOOL force_simple = facep->mPixelArea < FORCE_SIMPLE_RENDER_AREA;
|
|
||||||
|
//append face to appropriate render batch
|
||||||
|
|
||||||
|
BOOL force_simple = facep->getPixelArea() < FORCE_SIMPLE_RENDER_AREA;
|
||||||
BOOL fullbright = facep->isState(LLFace::FULLBRIGHT);
|
BOOL fullbright = facep->isState(LLFace::FULLBRIGHT);
|
||||||
if ((mask & LLVertexBuffer::MAP_NORMAL) == 0)
|
if ((mask & LLVertexBuffer::MAP_NORMAL) == 0)
|
||||||
{ //paranoia check to make sure GL doesn't try to read non-existant normals
|
{ //paranoia check to make sure GL doesn't try to read non-existant normals
|
||||||
@@ -3071,7 +3088,7 @@ void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_coun
|
|||||||
//sum up face verts and indices
|
//sum up face verts and indices
|
||||||
drawablep->updateFaceSize(i);
|
drawablep->updateFaceSize(i);
|
||||||
LLFace* facep = drawablep->getFace(i);
|
LLFace* facep = drawablep->getFace(i);
|
||||||
if (facep->hasGeometry() && facep->mPixelArea > FORCE_CULL_AREA)
|
if (facep->hasGeometry() && facep->getPixelArea() > FORCE_CULL_AREA)
|
||||||
{
|
{
|
||||||
vertex_count += facep->getGeomCount();
|
vertex_count += facep->getGeomCount();
|
||||||
index_count += facep->getIndicesCount();
|
index_count += facep->getIndicesCount();
|
||||||
@@ -3081,8 +3098,7 @@ void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_coun
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
facep->mVertexBuffer = NULL;
|
facep->clearVertexBuffer();
|
||||||
facep->mLastVertexBuffer = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -636,7 +636,7 @@ void LLPipeline::releaseGLBuffers()
|
|||||||
mWaterRef.release();
|
mWaterRef.release();
|
||||||
mWaterDis.release();
|
mWaterDis.release();
|
||||||
mScreen.release();
|
mScreen.release();
|
||||||
mSampleBuffer.releaseSampleBuffer();
|
mSampleBuffer.release();
|
||||||
mDeferredScreen.release();
|
mDeferredScreen.release();
|
||||||
mDeferredDepth.release();
|
mDeferredDepth.release();
|
||||||
for (U32 i = 0; i < 3; i++)
|
for (U32 i = 0; i < 3; i++)
|
||||||
@@ -5303,8 +5303,7 @@ void LLPipeline::resetVertexBuffers(LLDrawable* drawable)
|
|||||||
for (S32 i = 0; i < drawable->getNumFaces(); i++)
|
for (S32 i = 0; i < drawable->getNumFaces(); i++)
|
||||||
{
|
{
|
||||||
LLFace* facep = drawable->getFace(i);
|
LLFace* facep = drawable->getFace(i);
|
||||||
facep->mVertexBuffer = NULL;
|
facep->clearVertexBuffer();
|
||||||
facep->mLastVertexBuffer = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user