commit
ced2ca2acd
|
|
@ -660,6 +660,9 @@ void LLVertexBuffer::drawElements(U32 mode, const LLVector4a* pos, const LLVecto
|
|||
|
||||
void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_offset) const
|
||||
{
|
||||
llassert(start < (U32)mNumVerts);
|
||||
llassert(end < (U32)mNumVerts);
|
||||
|
||||
if (start >= (U32) mNumVerts ||
|
||||
end >= (U32) mNumVerts)
|
||||
{
|
||||
|
|
@ -679,6 +682,9 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of
|
|||
U16* idx = ((U16*) getIndicesPointer())+indices_offset;
|
||||
for (U32 i = 0; i < count; ++i)
|
||||
{
|
||||
llassert(idx[i] >= start);
|
||||
llassert(idx[i] <= end);
|
||||
|
||||
if (idx[i] < start || idx[i] > end)
|
||||
{
|
||||
LL_ERRS() << "Index out of range: " << idx[i] << " not in [" << start << ", " << end << "]" << LL_ENDL;
|
||||
|
|
@ -697,6 +703,7 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of
|
|||
for (U32 i = start; i < end; i++)
|
||||
{
|
||||
S32 idx = (S32) (v[i][3]+0.25f);
|
||||
llassert(idx >= 0);
|
||||
if (idx < 0 || idx >= shader->mFeatures.mIndexedTextureChannels)
|
||||
{
|
||||
LL_ERRS() << "Bad texture index found in vertex data stream." << LL_ENDL;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ void LLViewerDynamicTexture::preRender(BOOL clear_depth)
|
|||
llassert(mFullHeight <= 512);
|
||||
llassert(mFullWidth <= 512);
|
||||
|
||||
if (gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI)
|
||||
if (gGLManager.mHasFramebufferObject && gPipeline.mBake.isComplete() && !gGLManager.mIsATI)
|
||||
{ //using offscreen render target, just use the bottom left corner
|
||||
mOrigin.set(0, 0);
|
||||
}
|
||||
|
|
@ -216,11 +216,12 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI;
|
||||
bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mBake.isComplete() && !gGLManager.mIsATI;
|
||||
|
||||
if (use_fbo)
|
||||
{
|
||||
gPipeline.mWaterDis.bindTarget();
|
||||
gPipeline.mBake.bindTarget();
|
||||
gPipeline.mBake.clear();
|
||||
}
|
||||
|
||||
LLGLSLShader::bindNoShader();
|
||||
|
|
@ -240,7 +241,7 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
|
|||
gDepthDirty = TRUE;
|
||||
|
||||
gGL.color4f(1,1,1,1);
|
||||
dynamicTexture->setBoundTarget(use_fbo ? &gPipeline.mWaterDis : nullptr);
|
||||
dynamicTexture->setBoundTarget(use_fbo ? &gPipeline.mBake : nullptr);
|
||||
dynamicTexture->preRender(); // Must be called outside of startRender()
|
||||
result = FALSE;
|
||||
if (dynamicTexture->render())
|
||||
|
|
@ -257,9 +258,11 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
|
|||
}
|
||||
}
|
||||
|
||||
glFinish();
|
||||
|
||||
if (use_fbo)
|
||||
{
|
||||
gPipeline.mWaterDis.flush();
|
||||
gPipeline.mBake.flush();
|
||||
}
|
||||
|
||||
gGL.flush();
|
||||
|
|
|
|||
|
|
@ -424,6 +424,7 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
|
|||
|
||||
mInitialized = FALSE;
|
||||
mbCanSelect = FALSE;
|
||||
mUpdateTimer.reset();
|
||||
|
||||
mForceUpdateThrottle.setTimerExpirySec(UPDATE_EXPRY);
|
||||
mForceUpdateThrottle.reset();
|
||||
|
|
@ -706,6 +707,7 @@ bool LLVOSky::updateSky()
|
|||
// It's dead. Don't update it.
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (gGLManager.mIsDisabled)
|
||||
{
|
||||
return TRUE;
|
||||
|
|
@ -746,11 +748,12 @@ bool LLVOSky::updateSky()
|
|||
mForceUpdate = mForceUpdate || moon_direction_changed;
|
||||
mForceUpdate = mForceUpdate || color_changed;
|
||||
mForceUpdate = mForceUpdate || !mInitialized;
|
||||
mForceUpdate = mForceUpdate || mForceUpdateThrottle.hasExpired();
|
||||
|
||||
bool is_alm_wl_sky = gPipeline.canUseWindLightShaders();
|
||||
|
||||
calc();
|
||||
|
||||
if (mForceUpdate)
|
||||
if (mForceUpdate && mForceUpdateThrottle.hasExpired())
|
||||
{
|
||||
LL_RECORD_BLOCK_TIME(FTM_VOSKY_UPDATEFORCED);
|
||||
|
||||
|
|
@ -759,62 +762,73 @@ bool LLVOSky::updateSky()
|
|||
LLSkyTex::stepCurrent();
|
||||
|
||||
if (!direction.isExactlyZero())
|
||||
{
|
||||
mInitialized = TRUE;
|
||||
|
||||
updateFog(LLViewerCamera::getInstance()->getFar());
|
||||
{
|
||||
mLastTotalAmbient = total_ambient;
|
||||
mInitialized = TRUE;
|
||||
|
||||
if (mCubeMap)
|
||||
{
|
||||
for (int side = 0; side < 6; side++)
|
||||
{
|
||||
for (int tile = 0; tile < NUM_TILES; tile++)
|
||||
{
|
||||
createSkyTexture(m_atmosphericsVars, side, tile, mShinyTex, true);
|
||||
}
|
||||
}
|
||||
updateFog(LLViewerCamera::getInstance()->getFar());
|
||||
|
||||
int tex = mShinyTex[0].getWhich(TRUE);
|
||||
|
||||
for (int side = 0; side < 6; side++)
|
||||
{
|
||||
LLImageRaw* raw1 = nullptr;
|
||||
LLImageRaw* raw2 = nullptr;
|
||||
raw1 = mShinyTex[side].getImageRaw(TRUE);
|
||||
raw2 = mShinyTex[side].getImageRaw(FALSE);
|
||||
raw2->copy(raw1);
|
||||
mShinyTex[side].createGLImage(tex);
|
||||
mShinyTex[side].create(1.0f);
|
||||
}
|
||||
initCubeMap();
|
||||
}
|
||||
|
||||
// if we're using a generated sky cubemap instead of rendered sky...
|
||||
if (!gPipeline.canUseWindLightShaders())
|
||||
{
|
||||
for (int side = 0; side < 6; side++)
|
||||
{
|
||||
for (int tile = 0; tile < NUM_TILES; tile++)
|
||||
{
|
||||
createSkyTexture(m_atmosphericsVars, side, tile, mSkyTex);
|
||||
createSkyTexture(m_atmosphericsVars, side, tile, mShinyTex, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int tex = mSkyTex[0].getWhich(TRUE);
|
||||
int tex = mSkyTex[0].getWhich(TRUE);
|
||||
|
||||
for (int side = 0; side < 6; side++)
|
||||
{
|
||||
LLImageRaw* raw1 = nullptr;
|
||||
LLImageRaw* raw2 = nullptr;
|
||||
for (int side = 0; side < 6; side++)
|
||||
{
|
||||
LLImageRaw* raw1 = nullptr;
|
||||
LLImageRaw* raw2 = nullptr;
|
||||
|
||||
if (!is_alm_wl_sky)
|
||||
{
|
||||
raw1 = mSkyTex[side].getImageRaw(TRUE);
|
||||
raw2 = mSkyTex[side].getImageRaw(FALSE);
|
||||
raw2->copy(raw1);
|
||||
mSkyTex[side].createGLImage(tex);
|
||||
mSkyTex[side].create(1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
raw1 = mShinyTex[side].getImageRaw(TRUE);
|
||||
raw2 = mShinyTex[side].getImageRaw(FALSE);
|
||||
raw2->copy(raw1);
|
||||
mShinyTex[side].createGLImage(tex);
|
||||
}
|
||||
}
|
||||
next_frame = 0;
|
||||
|
||||
// update the sky texture
|
||||
if (!is_alm_wl_sky)
|
||||
{
|
||||
for (S32 i = 0; i < 6; ++i)
|
||||
{
|
||||
mSkyTex[i].create(1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
for (S32 i = 0; i < 6; ++i)
|
||||
{
|
||||
mShinyTex[i].create(1.0f);
|
||||
}
|
||||
|
||||
// update the environment map
|
||||
if (mCubeMap)
|
||||
{
|
||||
std::vector<LLPointer<LLImageRaw> > images;
|
||||
images.reserve(6);
|
||||
for (S32 side = 0; side < 6; side++)
|
||||
{
|
||||
images.push_back(mShinyTex[side].getImageRaw(TRUE));
|
||||
}
|
||||
mCubeMap->init(images);
|
||||
gGL.getTexUnit(0)->disable();
|
||||
}
|
||||
}
|
||||
|
||||
gPipeline.markRebuild(gSky.mVOGroundp->mDrawable, LLDrawable::REBUILD_ALL, TRUE);
|
||||
mForceUpdate = FALSE;
|
||||
|
|
|
|||
|
|
@ -352,6 +352,7 @@ protected:
|
|||
LLPointer<LLCubeMap> mCubeMap; // Cube map for the environment
|
||||
S32 mDrawRefl;
|
||||
|
||||
LLFrameTimer mUpdateTimer;
|
||||
LLTimer mForceUpdateThrottle;
|
||||
bool mHeavenlyBodyUpdated ;
|
||||
|
||||
|
|
|
|||
|
|
@ -1162,6 +1162,7 @@ void LLPipeline::releaseGLBuffers()
|
|||
|
||||
mWaterRef.release();
|
||||
mWaterDis.release();
|
||||
mBake.release();
|
||||
mHighlight.release();
|
||||
|
||||
for (U32 i = 0; i < 3; i++)
|
||||
|
|
@ -1221,12 +1222,13 @@ void LLPipeline::createGLBuffers()
|
|||
if (LLPipeline::sWaterReflections)
|
||||
{ //water reflection texture
|
||||
U32 res = (U32) llmax(gSavedSettings.getS32("RenderWaterRefResolution"), 512);
|
||||
|
||||
mWaterRef.allocate(res,res,GL_RGBA,TRUE,FALSE);
|
||||
//always use FBO for mWaterDis so it can be used for avatar texture bakes
|
||||
mWaterDis.allocate(res,res,GL_RGBA,TRUE,FALSE,LLTexUnit::TT_TEXTURE, true);
|
||||
mWaterDis.allocate(res,res,GL_RGBA,TRUE,FALSE,LLTexUnit::TT_TEXTURE);
|
||||
}
|
||||
|
||||
// Use FBO for bake tex
|
||||
mBake.allocate(512, 512, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_TEXTURE, true);
|
||||
|
||||
mHighlight.allocate(256,256,GL_RGBA, FALSE, FALSE);
|
||||
|
||||
stop_glerror();
|
||||
|
|
|
|||
|
|
@ -650,6 +650,8 @@ public:
|
|||
//water distortion texture (refraction)
|
||||
LLRenderTarget mWaterDis;
|
||||
|
||||
LLRenderTarget mBake;
|
||||
|
||||
//texture for making the glow
|
||||
LLRenderTarget mGlow[3];
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue