Automated merge from mesh-development
commit
df1c6d2a2e
|
|
@ -860,6 +860,9 @@ U64 LLFastTimer::getCPUClockCount64()
|
|||
}
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
std::string LLFastTimer::sClockType = "rdtsc";
|
||||
|
||||
#else
|
||||
//LL_COMMON_API U64 get_clock_count(); // in lltimer.cpp
|
||||
// These use QueryPerformanceCounter, which is arguably fine and also works on amd architectures.
|
||||
|
|
@ -872,6 +875,8 @@ U64 LLFastTimer::getCPUClockCount64()
|
|||
{
|
||||
return get_clock_count();
|
||||
}
|
||||
|
||||
std::string LLFastTimer::sClockType = "QueryPerformanceCounter";
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -904,6 +909,9 @@ U32 LLFastTimer::getCPUClockCount32()
|
|||
{
|
||||
return (U32)(LLFastTimer::getCPUClockCount64() >> 8);
|
||||
}
|
||||
|
||||
std::string LLFastTimer::sClockType = "clock_gettime";
|
||||
|
||||
#endif // (LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__))
|
||||
|
||||
|
||||
|
|
@ -923,23 +931,7 @@ U64 LLFastTimer::getCPUClockCount64()
|
|||
__asm__ volatile (".byte 0x0f, 0x31": "=A"(x));
|
||||
return x;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if ( LL_DARWIN && !(defined(__i386__) || defined(__amd64__)))
|
||||
//
|
||||
// Mac PPC (deprecated) implementation of CPU clock
|
||||
//
|
||||
// Just use gettimeofday implementation for now
|
||||
|
||||
U32 LLFastTimer::getCPUClockCount32()
|
||||
{
|
||||
return (U32)(get_clock_count()>>8);
|
||||
}
|
||||
|
||||
U64 LLFastTimer::getCPUClockCount64()
|
||||
{
|
||||
return get_clock_count();
|
||||
}
|
||||
|
||||
std::string LLFastTimer::sClockType = "rdtsc";
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -180,7 +180,9 @@ public:
|
|||
sTimerCycles += timer_end - timer_start;
|
||||
#endif
|
||||
#if DEBUG_FAST_TIMER_THREADS
|
||||
#if !LL_RELEASE
|
||||
assert_main_thread();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -251,6 +253,7 @@ public:
|
|||
U32 mChildTime;
|
||||
};
|
||||
static CurTimerData sCurTimerData;
|
||||
static std::string sClockType;
|
||||
|
||||
private:
|
||||
static U32 getCPUClockCount32();
|
||||
|
|
|
|||
|
|
@ -29,9 +29,25 @@
|
|||
|
||||
#include "llerror.h"
|
||||
|
||||
#if LL_REF_COUNT_DEBUG
|
||||
#include "llthread.h"
|
||||
#include "llapr.h"
|
||||
#endif
|
||||
|
||||
LLRefCount::LLRefCount(const LLRefCount& other)
|
||||
: mRef(0)
|
||||
{
|
||||
#if LL_REF_COUNT_DEBUG
|
||||
if(gAPRPoolp)
|
||||
{
|
||||
mMutexp = new LLMutex(gAPRPoolp) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
mMutexp = NULL ;
|
||||
}
|
||||
mCrashAtUnlock = FALSE ;
|
||||
#endif
|
||||
}
|
||||
|
||||
LLRefCount& LLRefCount::operator=(const LLRefCount&)
|
||||
|
|
@ -43,6 +59,17 @@ LLRefCount& LLRefCount::operator=(const LLRefCount&)
|
|||
LLRefCount::LLRefCount() :
|
||||
mRef(0)
|
||||
{
|
||||
#if LL_REF_COUNT_DEBUG
|
||||
if(gAPRPoolp)
|
||||
{
|
||||
mMutexp = new LLMutex(gAPRPoolp) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
mMutexp = NULL ;
|
||||
}
|
||||
mCrashAtUnlock = FALSE ;
|
||||
#endif
|
||||
}
|
||||
|
||||
LLRefCount::~LLRefCount()
|
||||
|
|
@ -51,4 +78,87 @@ LLRefCount::~LLRefCount()
|
|||
{
|
||||
llerrs << "deleting non-zero reference" << llendl;
|
||||
}
|
||||
|
||||
#if LL_REF_COUNT_DEBUG
|
||||
if(gAPRPoolp)
|
||||
{
|
||||
delete mMutexp ;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LL_REF_COUNT_DEBUG
|
||||
void LLRefCount::ref() const
|
||||
{
|
||||
if(mMutexp)
|
||||
{
|
||||
if(mMutexp->isLocked())
|
||||
{
|
||||
mCrashAtUnlock = TRUE ;
|
||||
llerrs << "the mutex is locked by the thread: " << mLockedThreadID
|
||||
<< " Current thread: " << LLThread::currentID() << llendl ;
|
||||
}
|
||||
|
||||
mMutexp->lock() ;
|
||||
mLockedThreadID = LLThread::currentID() ;
|
||||
|
||||
mRef++;
|
||||
|
||||
if(mCrashAtUnlock)
|
||||
{
|
||||
while(1); //crash here.
|
||||
}
|
||||
mMutexp->unlock() ;
|
||||
}
|
||||
else
|
||||
{
|
||||
mRef++;
|
||||
}
|
||||
}
|
||||
|
||||
S32 LLRefCount::unref() const
|
||||
{
|
||||
if(mMutexp)
|
||||
{
|
||||
if(mMutexp->isLocked())
|
||||
{
|
||||
mCrashAtUnlock = TRUE ;
|
||||
llerrs << "the mutex is locked by the thread: " << mLockedThreadID
|
||||
<< " Current thread: " << LLThread::currentID() << llendl ;
|
||||
}
|
||||
|
||||
mMutexp->lock() ;
|
||||
mLockedThreadID = LLThread::currentID() ;
|
||||
|
||||
llassert(mRef >= 1);
|
||||
if (0 == --mRef)
|
||||
{
|
||||
if(mCrashAtUnlock)
|
||||
{
|
||||
while(1); //crash here.
|
||||
}
|
||||
mMutexp->unlock() ;
|
||||
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(mCrashAtUnlock)
|
||||
{
|
||||
while(1); //crash here.
|
||||
}
|
||||
mMutexp->unlock() ;
|
||||
return mRef;
|
||||
}
|
||||
else
|
||||
{
|
||||
llassert(mRef >= 1);
|
||||
if (0 == --mRef)
|
||||
{
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
return mRef;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -28,6 +28,11 @@
|
|||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#define LL_REF_COUNT_DEBUG 0
|
||||
#if LL_REF_COUNT_DEBUG
|
||||
class LLMutex ;
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// RefCount objects should generally only be accessed by way of LLPointer<>'s
|
||||
// see llthread.h for LLThreadSafeRefCount
|
||||
|
|
@ -43,12 +48,16 @@ protected:
|
|||
public:
|
||||
LLRefCount();
|
||||
|
||||
void ref() const
|
||||
#if LL_REF_COUNT_DEBUG
|
||||
void ref() const ;
|
||||
S32 unref() const ;
|
||||
#else
|
||||
void LLRefCount::ref() const
|
||||
{
|
||||
mRef++;
|
||||
}
|
||||
|
||||
S32 unref() const
|
||||
S32 LLRefCount::unref() const
|
||||
{
|
||||
llassert(mRef >= 1);
|
||||
if (0 == --mRef)
|
||||
|
|
@ -58,6 +67,7 @@ public:
|
|||
}
|
||||
return mRef;
|
||||
}
|
||||
#endif
|
||||
|
||||
//NOTE: when passing around a const LLRefCount object, this can return different results
|
||||
// at different types, since mRef is mutable
|
||||
|
|
@ -68,6 +78,12 @@ public:
|
|||
|
||||
private:
|
||||
mutable S32 mRef;
|
||||
|
||||
#if LL_REF_COUNT_DEBUG
|
||||
LLMutex* mMutexp ;
|
||||
mutable U32 mLockedThreadID ;
|
||||
mutable BOOL mCrashAtUnlock ;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -325,6 +325,7 @@ LLGLManager::LLGLManager() :
|
|||
mHasVertexShader(FALSE),
|
||||
mHasFragmentShader(FALSE),
|
||||
mHasOcclusionQuery(FALSE),
|
||||
mHasOcclusionQuery2(FALSE),
|
||||
mHasPointParameters(FALSE),
|
||||
mHasDrawBuffers(FALSE),
|
||||
mHasTextureRectangle(FALSE),
|
||||
|
|
@ -666,6 +667,7 @@ void LLGLManager::initExtensions()
|
|||
mHasARBEnvCombine = ExtensionExists("GL_ARB_texture_env_combine", gGLHExts.mSysExts);
|
||||
mHasCompressedTextures = glh_init_extensions("GL_ARB_texture_compression");
|
||||
mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts);
|
||||
mHasOcclusionQuery2 = ExtensionExists("GL_ARB_occlusion_query2", gGLHExts.mSysExts);
|
||||
mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts);
|
||||
mHasDepthClamp = ExtensionExists("GL_ARB_depth_clamp", gGLHExts.mSysExts) || ExtensionExists("GL_NV_depth_clamp", gGLHExts.mSysExts);
|
||||
// mask out FBO support when packed_depth_stencil isn't there 'cause we need it for LLRenderTarget -Brad
|
||||
|
|
@ -782,6 +784,10 @@ void LLGLManager::initExtensions()
|
|||
{
|
||||
LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_occlusion_query" << LL_ENDL;
|
||||
}
|
||||
if (!mHasOcclusionQuery2)
|
||||
{
|
||||
LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_occlusion_query2" << LL_ENDL;
|
||||
}
|
||||
if (!mHasPointParameters)
|
||||
{
|
||||
LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_point_parameters" << LL_ENDL;
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ public:
|
|||
BOOL mHasVertexShader;
|
||||
BOOL mHasFragmentShader;
|
||||
BOOL mHasOcclusionQuery;
|
||||
BOOL mHasOcclusionQuery2;
|
||||
BOOL mHasPointParameters;
|
||||
BOOL mHasDrawBuffers;
|
||||
BOOL mHasDepthClamp;
|
||||
|
|
|
|||
|
|
@ -2874,6 +2874,8 @@ void LLAppViewer::writeSystemInfo()
|
|||
LL_INFOS("SystemInfo") << "OS: " << getOSInfo().getOSStringSimple() << LL_ENDL;
|
||||
LL_INFOS("SystemInfo") << "OS info: " << getOSInfo() << LL_ENDL;
|
||||
|
||||
LL_INFOS("SystemInfo") << "Timers: " << LLFastTimer::sClockType << LL_ENDL;
|
||||
|
||||
writeDebugInfo(); // Save out debug_info.log early, in case of crash.
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -97,6 +97,7 @@ public:
|
|||
|
||||
virtual void run();
|
||||
|
||||
void loadTextures() ; //called in the main thread.
|
||||
void processElement(daeElement* element);
|
||||
std::vector<LLImportMaterial> getMaterials(LLModel* model, domInstance_geometry* instance_geo);
|
||||
LLImportMaterial profileToMaterial(domProfile_COMMON* material);
|
||||
|
|
@ -186,6 +187,7 @@ protected:
|
|||
|
||||
static void onPhysicsParamCommit(LLUICtrl* ctrl, void* userdata);
|
||||
static void onPhysicsStageExecute(LLUICtrl* ctrl, void* userdata);
|
||||
static void onCancel(LLUICtrl* ctrl, void* userdata);
|
||||
static void onPhysicsStageCancel(LLUICtrl* ctrl, void* userdata);
|
||||
|
||||
static void onPhysicsBrowse(LLUICtrl* ctrl, void* userdata);
|
||||
|
|
@ -325,7 +327,7 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex
|
|||
std::map<LLPointer<LLModel>, std::vector<LLPointer<LLVertexBuffer> > > mPhysicsMesh;
|
||||
|
||||
LLMeshUploadThread::instance_list mUploadData;
|
||||
std::set<LLPointer<LLViewerFetchedTexture> > mTextureSet;
|
||||
std::set<LLViewerFetchedTexture* > mTextureSet;
|
||||
|
||||
//map of vertex buffers to models (one vertex buffer in vector per face in model
|
||||
std::map<LLModel*, std::vector<LLPointer<LLVertexBuffer> > > mVertexBuffer[LLModel::NUM_LODS+1];
|
||||
|
|
|
|||
|
|
@ -1450,17 +1450,21 @@ void LLMeshUploadThread::DecompRequest::completed()
|
|||
mThread->mHullMap[mBaseModel] = mHull[0];
|
||||
}
|
||||
|
||||
void LLMeshUploadThread::run()
|
||||
//called in the main thread.
|
||||
void LLMeshUploadThread::preStart()
|
||||
{
|
||||
mCurlRequest = new LLCurlRequest();
|
||||
|
||||
//build map of LLModel refs to instances for callbacks
|
||||
for (instance_list::iterator iter = mInstanceList.begin(); iter != mInstanceList.end(); ++iter)
|
||||
{
|
||||
mInstance[iter->mModel].push_back(*iter);
|
||||
}
|
||||
}
|
||||
|
||||
std::set<LLPointer<LLViewerTexture> > textures;
|
||||
void LLMeshUploadThread::run()
|
||||
{
|
||||
mCurlRequest = new LLCurlRequest();
|
||||
|
||||
std::set<LLViewerTexture* > textures;
|
||||
|
||||
//populate upload queue with relevant models
|
||||
for (instance_map::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter)
|
||||
|
|
@ -1483,9 +1487,9 @@ void LLMeshUploadThread::run()
|
|||
material_iter != instance.mMaterial.end(); ++material_iter)
|
||||
{
|
||||
|
||||
if (textures.find(material_iter->mDiffuseMap) == textures.end())
|
||||
if (textures.find(material_iter->mDiffuseMap.get()) == textures.end())
|
||||
{
|
||||
textures.insert(material_iter->mDiffuseMap);
|
||||
textures.insert(material_iter->mDiffuseMap.get());
|
||||
|
||||
LLTextureUploadData data(material_iter->mDiffuseMap.get(), material_iter->mDiffuseMapLabel);
|
||||
uploadTexture(data);
|
||||
|
|
@ -2148,6 +2152,7 @@ S32 LLMeshRepository::update()
|
|||
for (S32 i = 0; i < size; ++i)
|
||||
{
|
||||
mUploads.push_back(mUploadWaitList[i]);
|
||||
mUploadWaitList[i]->preStart() ;
|
||||
mUploadWaitList[i]->start() ;
|
||||
}
|
||||
mUploadWaitList.clear() ;
|
||||
|
|
|
|||
|
|
@ -431,6 +431,7 @@ public:
|
|||
|
||||
bool finished() { return mFinished; }
|
||||
virtual void run();
|
||||
void preStart();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -222,7 +222,17 @@ static U8 sOcclusionIndices[] =
|
|||
b000, b110, b100, b101, b001, b011, b010, b110,
|
||||
};
|
||||
|
||||
U8* get_box_fan_indices(LLCamera* camera, const LLVector4a& center)
|
||||
U32 get_box_fan_indices(LLCamera* camera, const LLVector4a& center)
|
||||
{
|
||||
LLVector4a origin;
|
||||
origin.load3(camera->getOrigin().mV);
|
||||
|
||||
S32 cypher = center.greaterThan(origin).getGatheredBits() & 0x7;
|
||||
|
||||
return cypher*8;
|
||||
}
|
||||
|
||||
U8* get_box_fan_indices_ptr(LLCamera* camera, const LLVector4a& center)
|
||||
{
|
||||
LLVector4a origin;
|
||||
origin.load3(camera->getOrigin().mV);
|
||||
|
|
@ -231,12 +241,21 @@ U8* get_box_fan_indices(LLCamera* camera, const LLVector4a& center)
|
|||
|
||||
return sOcclusionIndices+cypher*8;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void LLSpatialGroup::buildOcclusion()
|
||||
{
|
||||
if (!mOcclusionVerts)
|
||||
if (mOcclusionVerts.isNull())
|
||||
{
|
||||
mOcclusionVerts = new LLVector4a[8];
|
||||
mOcclusionVerts = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX, GL_DYNAMIC_DRAW_ARB);
|
||||
mOcclusionVerts->allocateBuffer(8, 64, true);
|
||||
|
||||
LLStrider<U16> idx;
|
||||
mOcclusionVerts->getIndexStrider(idx);
|
||||
for (U32 i = 0; i < 64; i++)
|
||||
{
|
||||
*idx++ = sOcclusionIndices[i];
|
||||
}
|
||||
}
|
||||
|
||||
LLVector4a fudge;
|
||||
|
|
@ -251,7 +270,12 @@ void LLSpatialGroup::buildOcclusion()
|
|||
|
||||
r.setMin(r, r2);
|
||||
|
||||
LLVector4a* v = mOcclusionVerts;
|
||||
LLStrider<LLVector3> pos;
|
||||
|
||||
mOcclusionVerts->getVertexStrider(pos);
|
||||
|
||||
LLVector4a* v = (LLVector4a*) pos.get();
|
||||
|
||||
const LLVector4a& c = mBounds[0];
|
||||
const LLVector4a& s = r;
|
||||
|
||||
|
|
@ -275,10 +299,13 @@ void LLSpatialGroup::buildOcclusion()
|
|||
|
||||
for (S32 i = 0; i < 8; ++i)
|
||||
{
|
||||
v[i] = s;
|
||||
v[i].mul(octant[i]);
|
||||
v[i].add(c);
|
||||
LLVector4a p;
|
||||
p.setMul(s, octant[i]);
|
||||
p.add(c);
|
||||
v[i] = p;
|
||||
}
|
||||
|
||||
mOcclusionVerts->setBuffer(0);
|
||||
|
||||
clearState(LLSpatialGroup::OCCLUSION_DIRTY);
|
||||
}
|
||||
|
|
@ -339,7 +366,6 @@ LLSpatialGroup::~LLSpatialGroup()
|
|||
sQueryPool.release(mOcclusionQuery[LLViewerCamera::sCurCameraID]);
|
||||
}
|
||||
|
||||
delete [] mOcclusionVerts;
|
||||
mOcclusionVerts = NULL;
|
||||
|
||||
LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION);
|
||||
|
|
@ -881,12 +907,9 @@ void LLSpatialGroup::shift(const LLVector4a &offset)
|
|||
gPipeline.markRebuild(this, TRUE);
|
||||
}
|
||||
|
||||
if (mOcclusionVerts)
|
||||
if (mOcclusionVerts.notNull())
|
||||
{
|
||||
for (U32 i = 0; i < 8; i++)
|
||||
{
|
||||
mOcclusionVerts[i].add(offset);
|
||||
}
|
||||
setState(OCCLUSION_DIRTY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1423,7 +1446,6 @@ void LLSpatialGroup::destroyGL()
|
|||
}
|
||||
}
|
||||
|
||||
delete [] mOcclusionVerts;
|
||||
mOcclusionVerts = NULL;
|
||||
|
||||
for (LLSpatialGroup::element_iter i = getData().begin(); i != getData().end(); ++i)
|
||||
|
|
@ -1516,31 +1538,37 @@ void LLSpatialGroup::checkOcclusion()
|
|||
}
|
||||
else if (isOcclusionState(QUERY_PENDING))
|
||||
{ //otherwise, if a query is pending, read it back
|
||||
GLuint res = 1;
|
||||
if (!isOcclusionState(DISCARD_QUERY) && mOcclusionQuery[LLViewerCamera::sCurCameraID])
|
||||
{
|
||||
glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_ARB, &res);
|
||||
}
|
||||
|
||||
if (isOcclusionState(DISCARD_QUERY))
|
||||
{
|
||||
res = 2;
|
||||
}
|
||||
GLuint available = 0;
|
||||
glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_AVAILABLE_ARB, &available);
|
||||
if (available)
|
||||
{ //result is available, read it back, otherwise wait until next frame
|
||||
GLuint res = 1;
|
||||
if (!isOcclusionState(DISCARD_QUERY) && mOcclusionQuery[LLViewerCamera::sCurCameraID])
|
||||
{
|
||||
glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_ARB, &res);
|
||||
}
|
||||
|
||||
if (res > 0)
|
||||
{
|
||||
assert_states_valid(this);
|
||||
clearOcclusionState(LLSpatialGroup::OCCLUDED, LLSpatialGroup::STATE_MODE_DIFF);
|
||||
assert_states_valid(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert_states_valid(this);
|
||||
setOcclusionState(LLSpatialGroup::OCCLUDED, LLSpatialGroup::STATE_MODE_DIFF);
|
||||
assert_states_valid(this);
|
||||
}
|
||||
if (isOcclusionState(DISCARD_QUERY))
|
||||
{
|
||||
res = 2;
|
||||
}
|
||||
|
||||
clearOcclusionState(QUERY_PENDING | DISCARD_QUERY);
|
||||
if (res > 0)
|
||||
{
|
||||
assert_states_valid(this);
|
||||
clearOcclusionState(LLSpatialGroup::OCCLUDED, LLSpatialGroup::STATE_MODE_DIFF);
|
||||
assert_states_valid(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert_states_valid(this);
|
||||
setOcclusionState(LLSpatialGroup::OCCLUDED, LLSpatialGroup::STATE_MODE_DIFF);
|
||||
assert_states_valid(this);
|
||||
}
|
||||
|
||||
clearOcclusionState(QUERY_PENDING | DISCARD_QUERY);
|
||||
}
|
||||
}
|
||||
else if (mSpatialPartition->isOcclusionEnabled() && isOcclusionState(LLSpatialGroup::OCCLUDED))
|
||||
{ //check occlusion has been issued for occluded node that has not had a query issued
|
||||
|
|
@ -1566,54 +1594,59 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!isOcclusionState(QUERY_PENDING) || isOcclusionState(DISCARD_QUERY))
|
||||
{
|
||||
LLFastTimer t(FTM_RENDER_OCCLUSION);
|
||||
{ //no query pending, or previous query to be discarded
|
||||
LLFastTimer t(FTM_RENDER_OCCLUSION);
|
||||
|
||||
if (!mOcclusionQuery[LLViewerCamera::sCurCameraID])
|
||||
{
|
||||
mOcclusionQuery[LLViewerCamera::sCurCameraID] = sQueryPool.allocate();
|
||||
if (!mOcclusionQuery[LLViewerCamera::sCurCameraID])
|
||||
{
|
||||
mOcclusionQuery[LLViewerCamera::sCurCameraID] = sQueryPool.allocate();
|
||||
}
|
||||
|
||||
if (mOcclusionVerts.isNull() || isState(LLSpatialGroup::OCCLUSION_DIRTY))
|
||||
{
|
||||
buildOcclusion();
|
||||
}
|
||||
|
||||
// Depth clamp all water to avoid it being culled as a result of being
|
||||
// behind the far clip plane, and in the case of edge water to avoid
|
||||
// it being culled while still visible.
|
||||
bool const use_depth_clamp = gGLManager.mHasDepthClamp &&
|
||||
(mSpatialPartition->mDrawableType == LLDrawPool::POOL_WATER ||
|
||||
mSpatialPartition->mDrawableType == LLDrawPool::POOL_VOIDWATER);
|
||||
if (use_depth_clamp)
|
||||
{
|
||||
glEnable(GL_DEPTH_CLAMP);
|
||||
}
|
||||
#if !LL_DARWIN
|
||||
U32 mode = gGLManager.mHasOcclusionQuery2 ? GL_ANY_SAMPLES_PASSED : GL_SAMPLES_PASSED_ARB;
|
||||
|
||||
glBeginQueryARB(mode, mOcclusionQuery[LLViewerCamera::sCurCameraID]);
|
||||
|
||||
mOcclusionVerts->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||
|
||||
if (camera->getOrigin().isExactlyZero())
|
||||
{ //origin is invalid, draw entire box
|
||||
mOcclusionVerts->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, 0);
|
||||
mOcclusionVerts->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, b111*8);
|
||||
}
|
||||
else
|
||||
{
|
||||
mOcclusionVerts->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, mBounds[0]));
|
||||
}
|
||||
|
||||
glEndQueryARB(mode);
|
||||
#endif
|
||||
if (use_depth_clamp)
|
||||
{
|
||||
glDisable(GL_DEPTH_CLAMP);
|
||||
}
|
||||
}
|
||||
|
||||
if (!mOcclusionVerts || isState(LLSpatialGroup::OCCLUSION_DIRTY))
|
||||
{
|
||||
buildOcclusion();
|
||||
}
|
||||
|
||||
// Depth clamp all water to avoid it being culled as a result of being
|
||||
// behind the far clip plane, and in the case of edge water to avoid
|
||||
// it being culled while still visible.
|
||||
bool const use_depth_clamp = gGLManager.mHasDepthClamp &&
|
||||
(mSpatialPartition->mDrawableType == LLDrawPool::POOL_WATER ||
|
||||
mSpatialPartition->mDrawableType == LLDrawPool::POOL_VOIDWATER);
|
||||
if (use_depth_clamp)
|
||||
{
|
||||
glEnable(GL_DEPTH_CLAMP);
|
||||
}
|
||||
|
||||
glBeginQueryARB(GL_SAMPLES_PASSED_ARB, mOcclusionQuery[LLViewerCamera::sCurCameraID]);
|
||||
glVertexPointer(3, GL_FLOAT, 16, mOcclusionVerts);
|
||||
if (camera->getOrigin().isExactlyZero())
|
||||
{ //origin is invalid, draw entire box
|
||||
glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8,
|
||||
GL_UNSIGNED_BYTE, sOcclusionIndices);
|
||||
glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8,
|
||||
GL_UNSIGNED_BYTE, sOcclusionIndices+b111*8);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8,
|
||||
GL_UNSIGNED_BYTE, get_box_fan_indices(camera, mBounds[0]));
|
||||
}
|
||||
glEndQueryARB(GL_SAMPLES_PASSED_ARB);
|
||||
|
||||
if (use_depth_clamp)
|
||||
{
|
||||
glDisable(GL_DEPTH_CLAMP);
|
||||
}
|
||||
setOcclusionState(LLSpatialGroup::QUERY_PENDING);
|
||||
clearOcclusionState(LLSpatialGroup::DISCARD_QUERY);
|
||||
}
|
||||
|
||||
setOcclusionState(LLSpatialGroup::QUERY_PENDING);
|
||||
clearOcclusionState(LLSpatialGroup::DISCARD_QUERY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2607,17 +2640,17 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
|
|||
gGL.color4f(0.f, 0.75f, 0.f, 0.5f);
|
||||
pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX);
|
||||
}
|
||||
else if (camera && group->mOcclusionVerts)
|
||||
else if (camera && group->mOcclusionVerts.notNull())
|
||||
{
|
||||
LLVertexBuffer::unbind();
|
||||
glVertexPointer(3, GL_FLOAT, 16, group->mOcclusionVerts);
|
||||
|
||||
group->mOcclusionVerts->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||
|
||||
glColor4f(1.0f, 0.f, 0.f, 0.5f);
|
||||
glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, GL_UNSIGNED_BYTE, get_box_fan_indices(camera, group->mBounds[0]));
|
||||
group->mOcclusionVerts->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, group->mBounds[0]));
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
|
||||
glColor4f(1.0f, 1.f, 1.f, 1.0f);
|
||||
glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, GL_UNSIGNED_BYTE, get_box_fan_indices(camera, group->mBounds[0]));
|
||||
group->mOcclusionVerts->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, group->mBounds[0]));
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVe
|
|||
void pushVerts(LLFace* face, U32 mask);
|
||||
|
||||
// get index buffer for binary encoded axis vertex buffer given a box at center being viewed by given camera
|
||||
U8* get_box_fan_indices(LLCamera* camera, const LLVector4a& center);
|
||||
U32 get_box_fan_indices(LLCamera* camera, const LLVector4a& center);
|
||||
U8* get_box_fan_indices_ptr(LLCamera* camera, const LLVector4a& center);
|
||||
|
||||
class LLDrawInfo : public LLRefCount
|
||||
{
|
||||
|
|
@ -393,7 +394,7 @@ public:
|
|||
LLSpatialPartition* mSpatialPartition;
|
||||
|
||||
LLPointer<LLVertexBuffer> mVertexBuffer;
|
||||
LLVector4a* mOcclusionVerts;
|
||||
LLPointer<LLVertexBuffer> mOcclusionVerts;
|
||||
GLuint mOcclusionQuery[LLViewerCamera::NUM_CAMERAS];
|
||||
|
||||
U32 mBufferUsage;
|
||||
|
|
|
|||
|
|
@ -834,7 +834,7 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
|
|||
for (entries_list_t::iterator iter3 = entries.begin();
|
||||
iter3 != entries.end(); )
|
||||
{
|
||||
LLPointer<LLViewerFetchedTexture> imagep = *iter3++;
|
||||
LLViewerFetchedTexture* imagep = *iter3++;
|
||||
|
||||
bool fetching = imagep->updateFetch();
|
||||
if (fetching)
|
||||
|
|
|
|||
|
|
@ -4136,11 +4136,12 @@ void LLPipeline::renderDebug()
|
|||
gGL.vertex3fv(frust[2].mV); gGL.vertex3fv(frust[6].mV);
|
||||
gGL.vertex3fv(frust[3].mV); gGL.vertex3fv(frust[7].mV);
|
||||
gGL.end();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
|
||||
/*gGL.flush();
|
||||
glLineWidth(16-i*2);
|
||||
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
|
||||
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
|
||||
{
|
||||
LLViewerRegion* region = *iter;
|
||||
|
|
@ -4155,7 +4156,9 @@ void LLPipeline::renderDebug()
|
|||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
gGL.flush();
|
||||
glLineWidth(1.f);*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7084,6 +7087,8 @@ void LLPipeline::renderDeferredLighting()
|
|||
|
||||
std::list<LLVector4> light_colors;
|
||||
|
||||
LLVertexBuffer::unbind();
|
||||
|
||||
F32 v[24];
|
||||
glVertexPointer(3, GL_FLOAT, 0, v);
|
||||
|
||||
|
|
@ -7173,7 +7178,7 @@ void LLPipeline::renderDeferredLighting()
|
|||
glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s);
|
||||
glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f);
|
||||
glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8,
|
||||
GL_UNSIGNED_BYTE, get_box_fan_indices(camera, center));
|
||||
GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center));
|
||||
stop_glerror();
|
||||
}
|
||||
}
|
||||
|
|
@ -7239,7 +7244,7 @@ void LLPipeline::renderDeferredLighting()
|
|||
glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s);
|
||||
glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f);
|
||||
glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8,
|
||||
GL_UNSIGNED_BYTE, get_box_fan_indices(camera, center));
|
||||
GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center));
|
||||
}
|
||||
gDeferredSpotLightProgram.disableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION);
|
||||
unbindDeferredShader(gDeferredSpotLightProgram);
|
||||
|
|
@ -7650,11 +7655,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
|||
LLCamera camera = camera_in;
|
||||
camera.setFar(camera.getFar()*0.87654321f);
|
||||
LLPipeline::sReflectionRender = TRUE;
|
||||
S32 occlusion = LLPipeline::sUseOcclusion;
|
||||
|
||||
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
|
||||
|
||||
LLPipeline::sUseOcclusion = llmin(occlusion, 1);
|
||||
|
||||
gPipeline.pushRenderTypeMask();
|
||||
|
||||
|
|
@ -7693,19 +7693,20 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
|||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
glClearColor(0,0,0,0);
|
||||
mWaterRef.bindTarget();
|
||||
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER0;
|
||||
gGL.setColorMask(true, true);
|
||||
mWaterRef.clear();
|
||||
gGL.setColorMask(true, false);
|
||||
|
||||
mWaterRef.getViewport(gGLViewport);
|
||||
|
||||
|
||||
stop_glerror();
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
mat.set_scale(glh::vec3f(1,1,-1));
|
||||
mat.set_translate(glh::vec3f(0,0,height*2.f));
|
||||
|
||||
|
||||
glh::matrix4f current = glh_get_current_modelview();
|
||||
|
||||
mat = current * mat;
|
||||
|
|
@ -7725,22 +7726,24 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
|||
glCullFace(GL_FRONT);
|
||||
|
||||
static LLCullResult ref_result;
|
||||
|
||||
|
||||
if (LLDrawPoolWater::sNeedsDistortionUpdate)
|
||||
{
|
||||
//initial sky pass (no user clip plane)
|
||||
{ //mask out everything but the sky
|
||||
gPipeline.pushRenderTypeMask();
|
||||
gPipeline.andRenderTypeMask(LLPipeline::RENDER_TYPE_SKY,
|
||||
LLPipeline::RENDER_TYPE_WL_SKY,
|
||||
LLPipeline::END_RENDER_TYPES);
|
||||
LLPipeline::RENDER_TYPE_WL_SKY,
|
||||
LLPipeline::END_RENDER_TYPES);
|
||||
|
||||
static LLCullResult result;
|
||||
updateCull(camera, result);
|
||||
stateSort(camera, result);
|
||||
|
||||
andRenderTypeMask(LLPipeline::RENDER_TYPE_SKY,
|
||||
LLPipeline::RENDER_TYPE_CLOUDS,
|
||||
LLPipeline::RENDER_TYPE_WL_SKY,
|
||||
LLPipeline::END_RENDER_TYPES);
|
||||
LLPipeline::RENDER_TYPE_CLOUDS,
|
||||
LLPipeline::RENDER_TYPE_WL_SKY,
|
||||
LLPipeline::END_RENDER_TYPES);
|
||||
|
||||
renderGeom(camera, TRUE);
|
||||
gPipeline.popRenderTypeMask();
|
||||
|
|
@ -7749,23 +7752,23 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
|||
gPipeline.pushRenderTypeMask();
|
||||
|
||||
clearRenderTypeMask(LLPipeline::RENDER_TYPE_WATER,
|
||||
LLPipeline::RENDER_TYPE_VOIDWATER,
|
||||
LLPipeline::RENDER_TYPE_GROUND,
|
||||
LLPipeline::RENDER_TYPE_SKY,
|
||||
LLPipeline::RENDER_TYPE_CLOUDS,
|
||||
LLPipeline::END_RENDER_TYPES);
|
||||
LLPipeline::RENDER_TYPE_VOIDWATER,
|
||||
LLPipeline::RENDER_TYPE_GROUND,
|
||||
LLPipeline::RENDER_TYPE_SKY,
|
||||
LLPipeline::RENDER_TYPE_CLOUDS,
|
||||
LLPipeline::END_RENDER_TYPES);
|
||||
|
||||
S32 detail = gSavedSettings.getS32("RenderReflectionDetail");
|
||||
S32 detail = gSavedSettings.getS32("RenderReflectionDetail");
|
||||
if (detail > 0)
|
||||
{ //mask out selected geometry based on reflection detail
|
||||
if (detail < 4)
|
||||
{
|
||||
clearRenderTypeMask(LLPipeline::RENDER_TYPE_PARTICLES, END_RENDER_TYPES);
|
||||
if (detail < 3)
|
||||
{
|
||||
clearRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR, END_RENDER_TYPES);
|
||||
if (detail < 2)
|
||||
if (detail < 3)
|
||||
{
|
||||
clearRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR, END_RENDER_TYPES);
|
||||
if (detail < 2)
|
||||
{
|
||||
clearRenderTypeMask(LLPipeline::RENDER_TYPE_VOLUME, END_RENDER_TYPES);
|
||||
}
|
||||
}
|
||||
|
|
@ -7776,16 +7779,16 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
|||
updateCull(camera, ref_result, 1);
|
||||
stateSort(camera, ref_result);
|
||||
}
|
||||
|
||||
if (LLDrawPoolWater::sNeedsDistortionUpdate)
|
||||
{
|
||||
if (gSavedSettings.getS32("RenderReflectionDetail") > 0)
|
||||
|
||||
if (LLDrawPoolWater::sNeedsDistortionUpdate)
|
||||
{
|
||||
gPipeline.grabReferences(ref_result);
|
||||
LLGLUserClipPlane clip_plane(plane, mat, projection);
|
||||
renderGeom(camera);
|
||||
}
|
||||
}
|
||||
if (gSavedSettings.getS32("RenderReflectionDetail") > 0)
|
||||
{
|
||||
gPipeline.grabReferences(ref_result);
|
||||
LLGLUserClipPlane clip_plane(plane, mat, projection);
|
||||
renderGeom(camera);
|
||||
}
|
||||
}
|
||||
|
||||
gPipeline.popRenderTypeMask();
|
||||
}
|
||||
|
|
@ -7823,6 +7826,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
|||
LLColor4& col = LLDrawPoolWater::sWaterFogColor;
|
||||
glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f);
|
||||
mWaterDis.bindTarget();
|
||||
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER1;
|
||||
mWaterDis.getViewport(gGLViewport);
|
||||
|
||||
if (!LLPipeline::sUnderWaterRender || LLDrawPoolWater::sNeedsReflectionUpdate)
|
||||
|
|
@ -7861,7 +7865,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
|||
LLDrawPoolWater::sNeedsDistortionUpdate = FALSE;
|
||||
LLPlane npnorm(-pnorm, -pd);
|
||||
LLViewerCamera::getInstance()->setUserClipPlane(npnorm);
|
||||
LLPipeline::sUseOcclusion = occlusion;
|
||||
|
||||
LLGLState::checkStates();
|
||||
LLGLState::checkTextureChannels();
|
||||
|
|
@ -7871,6 +7874,8 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
|
|||
{
|
||||
gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
|
||||
}
|
||||
|
||||
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7993,6 +7998,8 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
|
|||
|
||||
//glCullFace(GL_FRONT);
|
||||
|
||||
LLVertexBuffer::unbind();
|
||||
|
||||
{
|
||||
LLFastTimer ftm(FTM_SHADOW_SIMPLE);
|
||||
LLGLDisable test(GL_ALPHA_TEST);
|
||||
|
|
|
|||
|
|
@ -169,12 +169,12 @@
|
|||
Queue Mode:
|
||||
</text>
|
||||
<combo_box follows="top|left" name="build_operator" top_pad="5" left="45" width="100" height="20">
|
||||
<combo_item name="half_edge_collapse">
|
||||
Half Edge Collapse
|
||||
</combo_item>
|
||||
<combo_item name="edge_collapse">
|
||||
Edge Collapse
|
||||
</combo_item>
|
||||
<combo_item name="half_edge_collapse">
|
||||
Half Edge Collapse
|
||||
</combo_item>
|
||||
</combo_box>
|
||||
|
||||
<combo_box follows="top|left" name="queue_mode" left_pad="5" width="100" height="20">
|
||||
|
|
@ -205,7 +205,7 @@
|
|||
Lock
|
||||
</combo_item>
|
||||
</combo_box>
|
||||
<spinner follows="left|top" name="share_tolerance" left_pad="5" width="100" height="20"/>
|
||||
<spinner follows="left|top" name="share_tolerance" left_pad="5" width="100" decimal_digits="5" initial_value="0.00001" height="20"/>
|
||||
|
||||
<text left="10" top_pad="35" follows="top|left" width="240" height="15">
|
||||
Generate Normals
|
||||
|
|
@ -295,6 +295,7 @@
|
|||
<check_box name="Close Holes (Slow)" follows="top|left" top_pad="10" height="15" label="Close Holes (slow)"/>
|
||||
|
||||
<button left="200" bottom_delta="0" width="90" follows="top|left" label="Analyze" name="Decompose" height="20"/>
|
||||
<button left="200" bottom_delta="0" width="90" follows="top|left" label="Cancel" name="decompose_cancel" visble="false" height="20"/>
|
||||
</panel>
|
||||
|
||||
|
||||
|
|
@ -324,6 +325,7 @@
|
|||
<slider name="Detail Scale" label="Detail Scale:" label_width="120" width="270" follows="top|left" top_pad="10" height="20"/>
|
||||
<slider name="Retain%" label="Retain:" label_width="120" width="270" follows="top|left" bottom_delta="0" left_delta="0" visible="false" height="20"/>
|
||||
<button left="190" width="90" follows="top|left" label="Simplify" name="Simplify" height="20"/>
|
||||
<button left="190" bottom_delta="0" width="90" follows="top|left" label="Cancel" name="simplify_cancel" height="20"/>
|
||||
|
||||
</panel>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue