Merge branch 'master' of git://github.com/Shyotl/SingularityViewer

This commit is contained in:
Inusaito Sayori
2015-06-02 04:45:31 -04:00
21 changed files with 384 additions and 604 deletions

View File

@@ -1056,6 +1056,10 @@ LLSpatialPartition* LLDrawable::getSpatialPartition()
{
setSpatialBridge(new LLHUDBridge(this));
}
else if (mVObjp->isAttachment())
{
setSpatialBridge(new LLAttachmentBridge(this));
}
else
{
setSpatialBridge(new LLVolumeBridge(this));
@@ -1663,12 +1667,18 @@ void LLDrawable::updateFaceSize(S32 idx)
LLBridgePartition::LLBridgePartition()
: LLSpatialPartition(0, FALSE, 0)
{
mDrawableType = LLPipeline::RENDER_TYPE_AVATAR;
mDrawableType = LLPipeline::RENDER_TYPE_VOLUME;
mPartitionType = LLViewerRegion::PARTITION_BRIDGE;
mLODPeriod = 16;
mSlopRatio = 0.25f;
}
LLAttachmentPartition::LLAttachmentPartition()
: LLBridgePartition()
{
mDrawableType = LLPipeline::RENDER_TYPE_AVATAR;
}
LLHUDBridge::LLHUDBridge(LLDrawable* drawablep)
: LLVolumeBridge(drawablep)
{

View File

@@ -792,6 +792,7 @@ void LLSpatialGroup::shift(const LLVector4a &offset)
if (!mSpatialPartition->mRenderByGroup &&
mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_TREE &&
mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_TERRAIN &&
mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_ATTACHMENT &&
mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_BRIDGE)
{
setState(GEOM_DIRTY);
@@ -2174,6 +2175,10 @@ public:
for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
{
LLDrawable* drawable = *i;
if (drawable->getVObj().notNull())
{
drawable->getVObj()->resetVertexBuffers();
}
if (drawable->getVObj().notNull() && !group->mSpatialPartition->mRenderByGroup)
{
gPipeline.markRebuild(drawable, LLDrawable::REBUILD_ALL, TRUE);

View File

@@ -737,6 +737,12 @@ public:
virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { LLVolumeGeometryManager::addGeometryCount(group, vertex_count, index_count); }
};
class LLAttachmentBridge : public LLVolumeBridge
{
public:
LLAttachmentBridge(LLDrawable* drawable);
};
class LLHUDBridge : public LLVolumeBridge
{
public:
@@ -754,11 +760,18 @@ public:
virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { }
};
//spatial partition that holds nothing but spatial bridges
class LLAttachmentPartition : public LLBridgePartition
{
public:
LLAttachmentPartition();
};
class LLHUDPartition : public LLBridgePartition
{
public:
LLHUDPartition();
virtual void shift(const LLVector4a &offset);
virtual void shift(const LLVector4a &offset) { } //HUD objects don't shift with region crossing. That would be silly.
};
extern const F32 SG_BOX_SIDE;

View File

@@ -1162,7 +1162,7 @@ void LLViewerJoystick::moveFlycam(bool reset)
// -----------------------------------------------------------------------------
bool LLViewerJoystick::toggleFlycam()
{
if (gRlvHandler.hasBehaviour(RLV_BHVR_CAMDISTMAX) || (gRlvHandler.hasBehaviour(RLV_BHVR_CAMUNLOCK) // [RLVa:LF] - @camdistmax and @camunlock mean no going away!
if (gRlvHandler.hasBehaviour(RLV_BHVR_CAMDISTMAX) || gRlvHandler.hasBehaviour(RLV_BHVR_CAMUNLOCK) // [RLVa:LF] - @camdistmax and @camunlock mean no going away!
|| !gSavedSettings.getBOOL("JoystickEnabled") || !gSavedSettings.getBOOL("JoystickFlycamEnabled"))
{
mOverrideCamera = false;

View File

@@ -133,6 +133,7 @@ public:
LLViewerObject(const LLUUID &id, const LLPCode type, LLViewerRegion *regionp, BOOL is_global = FALSE);
virtual void resetVertexBuffers() {}
virtual void markDead(); // Mark this object as dead, and clean up its references
BOOL isDead() const {return mDead;}
BOOL isOrphaned() const { return mOrphaned; }

View File

@@ -380,6 +380,7 @@ void LLViewerRegion::initPartitions()
mImpl->mObjectPartition.push_back(new LLGrassPartition()); //PARTITION_GRASS
mImpl->mObjectPartition.push_back(new LLVolumePartition()); //PARTITION_VOLUME
mImpl->mObjectPartition.push_back(new LLBridgePartition()); //PARTITION_BRIDGE
mImpl->mObjectPartition.push_back(new LLAttachmentPartition()); //PARTITION_ATTACHMENT
mImpl->mObjectPartition.push_back(new LLHUDParticlePartition());//PARTITION_HUD_PARTICLE
mImpl->mObjectPartition.push_back(NULL); //PARTITION_NONE
}

View File

@@ -99,6 +99,7 @@ public:
PARTITION_GRASS,
PARTITION_VOLUME,
PARTITION_BRIDGE,
PARTITION_ATTACHMENT,
PARTITION_HUD_PARTICLE,
PARTITION_NONE,
NUM_PARTITIONS

View File

@@ -1737,7 +1737,6 @@ LLViewerWindow::LLViewerWindow(
}
LLVertexBuffer::initClass(gSavedSettings.getBOOL("RenderVBOEnable"), gSavedSettings.getBOOL("RenderVBOMappingDisable"));
LL_INFOS("RenderInit") << "LLVertexBuffer initialization done." << LL_ENDL ;
gGL.init() ;
LLImageGL::initClass(LLViewerTexture::MAX_GL_IMAGE_CATEGORY) ;
if (LLFeatureManager::getInstance()->isSafe()
@@ -5307,6 +5306,8 @@ void LLViewerWindow::stopGL(BOOL save_state)
gGLManager.mIsDisabled = TRUE;
stop_glerror();
gGL.resetVertexBuffers();
llinfos << "Remaining allocated texture memory: " << LLImageGL::sGlobalTextureMemoryInBytes << " bytes" << llendl;
}
@@ -5323,6 +5324,7 @@ void LLViewerWindow::restoreGL(const std::string& progress_message)
llinfos << "Restoring GL..." << llendl;
gGLManager.mIsDisabled = FALSE;
gGL.init();
initGLDefaults();
gGL.refreshState(); //Singu Note: Call immediately. Cached states may have prevented initGLDefaults from actually applying changes.
LLGLState::restoreGL();

View File

@@ -9029,7 +9029,7 @@ void LLVOAvatar::updateSoftwareSkinnedVertices(const LLMeshSkinInfo* skin, const
U32 LLVOAvatar::getPartitionType() const
{
// Avatars merely exist as drawables in the bridge partition
return LLViewerRegion::PARTITION_BRIDGE;
return LLViewerRegion::PARTITION_ATTACHMENT;
}
//static

View File

@@ -1516,10 +1516,10 @@ BOOL LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 f, cons
*indicesp++ = index_offset + 2;
*indicesp++ = index_offset + 3;
*(colorsp++) = LLColor4::white;
*(colorsp++) = LLColor4::white;
*(colorsp++) = LLColor4::white;
*(colorsp++) = LLColor4::white;
*(colorsp++) = LLColor4U::white;
*(colorsp++) = LLColor4U::white;
*(colorsp++) = LLColor4U::white;
*(colorsp++) = LLColor4U::white;
facep->getVertexBuffer()->flush();

View File

@@ -550,6 +550,11 @@ const S32 LEAF_VERTICES = 16;
static LLFastTimer::DeclareTimer FTM_UPDATE_TREE("Update Tree");
void LLVOTree::resetVertexBuffers()
{
mReferenceBuffer = NULL;
}
BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
{
LLFastTimer ftm(FTM_UPDATE_TREE);

View File

@@ -77,6 +77,7 @@ public:
/*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
/*virtual*/ void updateSpatialExtents(LLVector4a &min, LLVector4a &max);
void resetVertexBuffers();
virtual U32 getPartitionType() const;
void updateRadius();

View File

@@ -4000,6 +4000,10 @@ U32 LLVOVolume::getPartitionType() const
{
return LLViewerRegion::PARTITION_HUD;
}
else if (isAttachment())
{
return LLViewerRegion::PARTITION_ATTACHMENT;
}
return LLViewerRegion::PARTITION_VOLUME;
}
@@ -4028,6 +4032,12 @@ LLVolumeBridge::LLVolumeBridge(LLDrawable* drawablep)
mSlopRatio = 0.25f;
}
LLAttachmentBridge::LLAttachmentBridge(LLDrawable* drawablep)
: LLVolumeBridge(drawablep)
{
mPartitionType = LLViewerRegion::PARTITION_ATTACHMENT;
}
bool can_batch_texture(const LLFace* facep)
{
static const LLCachedControl<bool> alt_batching("SHAltBatching",true);
@@ -5209,29 +5219,22 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
//PROCESS NON-ALPHA FACES
U32 simple_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR;
U32 alpha_mask = simple_mask | 0x80000000; //hack to give alpha verts their own VBO
U32 bump_mask = simple_mask | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TANGENT;
U32 bump_mask = simple_mask | LLVertexBuffer::MAP_TEXCOORD1;
U32 fullbright_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR;
U32 norm_mask = simple_mask | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TANGENT;
U32 normspec_mask = norm_mask | LLVertexBuffer::MAP_TEXCOORD2;
U32 spec_mask = simple_mask | LLVertexBuffer::MAP_TEXCOORD2;
if (emissive)
{ //emissive faces are present, include emissive byte to preserve batching
simple_mask = simple_mask | LLVertexBuffer::MAP_EMISSIVE;
alpha_mask = alpha_mask | LLVertexBuffer::MAP_EMISSIVE;
bump_mask = bump_mask | LLVertexBuffer::MAP_EMISSIVE;
fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_EMISSIVE;
norm_mask = norm_mask | LLVertexBuffer::MAP_EMISSIVE;
normspec_mask = normspec_mask | LLVertexBuffer::MAP_EMISSIVE;
spec_mask = spec_mask | LLVertexBuffer::MAP_EMISSIVE;
}
BOOL batch_textures = LLGLSLShader::sNoFixedFunction;
U32 additional_flags = 0x0;
if(batch_textures)
additional_flags |= LLVertexBuffer::MAP_TEXTURE_INDEX;
if (LLPipeline::sRenderDeferred)
bump_mask = norm_mask;
//emissive faces are present, include emissive byte to preserve batching
if(emissive)
additional_flags |= LLVertexBuffer::MAP_EMISSIVE;
@@ -6390,9 +6393,4 @@ LLHUDPartition::LLHUDPartition()
mLODPeriod = 1;
}
void LLHUDPartition::shift(const LLVector4a &offset)
{
//HUD objects don't shift with region crossing. That would be silly.
}

View File

@@ -491,6 +491,8 @@ void LLPipeline::init()
gSavedSettings.getControl("RenderFSAASamples")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
//gSavedSettings.getControl("RenderAvatarVP")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); //Already registered to handleSetShaderChanged
//gSavedSettings.getControl("WindLightUseAtmosShaders")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); //Already registered to handleSetShaderChanged
gGL.init();
}
LLPipeline::~LLPipeline()
@@ -1206,10 +1208,7 @@ void LLPipeline::restoreGL()
{
assertInitialized();
if (LLGLSLShader::sNoFixedFunction)
{
LLViewerShaderMgr::instance()->setShaders();
}
LLViewerShaderMgr::instance()->setShaders();
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
@@ -1291,11 +1290,13 @@ S32 LLPipeline::setLightingDetail(S32 level)
}
level = llclamp(level, 0, getMaxLightingDetail());
//Bugfix: If setshaders was called with RenderLocalLights off then enabling RenderLocalLights later will not work. Reloading shaders fixes this.
if (level != mLightingDetail && LLGLSLShader::sNoFixedFunction)
if (level != mLightingDetail)
{
LLViewerShaderMgr::instance()->setShaders();
mLightingDetail = level;
if (LLGLSLShader::sNoFixedFunction)
LLViewerShaderMgr::instance()->setShaders();
}
mLightingDetail = level;
return mLightingDetail;
}
@@ -6495,6 +6496,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector4a& start,
for (U32 j = 0; j < LLViewerRegion::NUM_PARTITIONS; j++)
{
if ((j == LLViewerRegion::PARTITION_VOLUME) ||
(j == LLViewerRegion::PARTITION_ATTACHMENT) ||
(j == LLViewerRegion::PARTITION_BRIDGE) ||
(j == LLViewerRegion::PARTITION_TERRAIN) ||
(j == LLViewerRegion::PARTITION_TREE) ||
@@ -6557,7 +6559,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector4a& start,
{
LLViewerRegion* region = *iter;
LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_BRIDGE);
LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_ATTACHMENT);
if (part && hasRenderType(part->mDrawableType))
{
LLDrawable* hit = part->lineSegmentIntersect(start, local_end, pick_transparent, face_hit, &position, tex_coord, normal, tangent);
@@ -6743,6 +6745,8 @@ void LLPipeline::doResetVertexBuffers()
//delete all name pool caches
LLGLNamePool::cleanupPools();
gGL.resetVertexBuffers();
if (LLVertexBuffer::sGLCount > 0)
{
llwarns << "VBO wipe failed -- " << LLVertexBuffer::sGLCount << " buffers remaining." << llendl;
@@ -6762,6 +6766,8 @@ void LLPipeline::doResetVertexBuffers()
LLVertexBuffer::initClass(LLVertexBuffer::sEnableVBOs, LLVertexBuffer::sDisableVBOMapping);
LLVOPartGroup::restoreGL();
gGL.restoreVertexBuffers();
}
void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture, BOOL batch_texture)