A little bit of cleanup.

This commit is contained in:
Shyotl
2014-03-27 22:04:30 -05:00
parent 34a7bf4dbb
commit 07a261a259
4 changed files with 25 additions and 54 deletions

View File

@@ -373,6 +373,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
BOOL light_enabled = TRUE;
BOOL use_shaders = gPipeline.canUseVertexShaders();
BOOL depth_only = (pass == 1 && !LLPipeline::sImpostorRender);
for (LLCullResult::sg_iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i)
{
@@ -387,7 +389,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
|| group->mSpatialPartition->mPartitionType == LLViewerRegion::PARTITION_CLOUD
|| group->mSpatialPartition->mPartitionType == LLViewerRegion::PARTITION_HUD_PARTICLE;
bool draw_glow_for_this_partition = mVertexShaderLevel > 0; // no shaders = no glow.
bool draw_glow_for_this_partition = !depth_only && mVertexShaderLevel > 0; // no shaders = no glow.
static LLFastTimer::DeclareTimer FTM_RENDER_ALPHA_GROUP_LOOP("Alpha Group");
LLFastTimer t(FTM_RENDER_ALPHA_GROUP_LOOP);
@@ -410,7 +412,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
// Fix for bug - NORSPEC-271
// If the face is more than 90% transparent, then don't update the Depth buffer for Dof
// We don't want the nearly invisible objects to cause of DoF effects
if(pass == 1 && !LLPipeline::sImpostorRender)
if(depth_only)
{
LLFace* face = params.mFace;
if(face)
@@ -443,9 +445,10 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
llassert_always(!LLGLSLShader::sNoFixedFunction);
llassert_always(!LLGLSLShader::sCurBoundShaderPtr);
if(params.mFullbright == light_enabled || !initialized_lighting)
bool fullbright = depth_only || params.mFullbright;
if(fullbright == light_enabled || !initialized_lighting)
{
light_enabled = !params.mFullbright;
light_enabled = !fullbright;
initialized_lighting = true;
if (light_enabled) // Turn off lighting if it hasn't already been so.

View File

@@ -270,7 +270,7 @@ void LLDrawPoolBump::render(S32 pass)
{
LLFastTimer t(FTM_RENDER_BUMP);
if (!gPipeline.hasRenderType(LLDrawPool::POOL_SIMPLE))
if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SIMPLE))
{
return;
}

View File

@@ -552,6 +552,7 @@ void LLViewerShaderMgr::setShaders()
else
{
LLGLSLShader::sNoFixedFunction = false;
LLGLSLShader::sIndexedTextureChannels = 1;
gPipeline.mVertexShadersEnabled = FALSE;
gPipeline.mVertexShadersLoaded = 0;
for (S32 i = 0; i < SHADER_COUNT; i++)
@@ -569,6 +570,7 @@ void LLViewerShaderMgr::setShaders()
else
{
LLGLSLShader::sNoFixedFunction = false;
LLGLSLShader::sIndexedTextureChannels = 1;
gPipeline.mVertexShadersEnabled = FALSE;
gPipeline.mVertexShadersLoaded = 0;
for (S32 i = 0; i < SHADER_COUNT; i++)
@@ -673,14 +675,7 @@ BOOL LLViewerShaderMgr::loadBasicShaders()
// (in order of shader function call depth for reference purposes, deepest level first)
shaders.clear();
S32 ch = 1;
if (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 30)
{ //use indexed texture rendering for GLSL >= 1.30
static const LLCachedControl<bool> no_texture_indexing("ShyotlUseLegacyTextureBatching",false);
if(!no_texture_indexing)
ch = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
}
S32 ch = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1);
std::vector<S32> index_channels;
index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsVarsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );

View File

@@ -2549,15 +2549,13 @@ void LLPipeline::downsampleDepthBuffer(LLRenderTarget& source, LLRenderTarget& d
{
mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0);
mDeferredVB->allocateBuffer(8, 0, true);
}
LLStrider<LLVector3> vert;
mDeferredVB->getVertexStrider(vert);
LLStrider<LLVector2> tc0;
LLStrider<LLVector3> vert;
mDeferredVB->getVertexStrider(vert);
vert[0].set(-1,1,0);
vert[1].set(-1,-3,0);
vert[2].set(3,1,0);
vert[0].set(-1,1,0);
vert[1].set(-1,-3,0);
vert[2].set(3,1,0);
}
if (source.getUsage() == LLTexUnit::TT_RECT_TEXTURE)
{
@@ -7962,15 +7960,14 @@ void LLPipeline::renderDeferredLighting()
{
mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0);
mDeferredVB->allocateBuffer(8, 0, true);
LLStrider<LLVector3> vert;
mDeferredVB->getVertexStrider(vert);
vert[0].set(-1,1,0);
vert[1].set(-1,-3,0);
vert[2].set(3,1,0);
}
LLStrider<LLVector3> vert;
mDeferredVB->getVertexStrider(vert);
vert[0].set(-1,1,0);
vert[1].set(-1,-3,0);
vert[2].set(3,1,0);
{
setupHWLights(NULL); //to set mSunDir;
LLVector4 dir(mSunDir, 0.f);
@@ -8392,12 +8389,6 @@ void LLPipeline::renderDeferredLighting()
unbindDeferredShader(gDeferredSpotLightProgram);
}
//reset mDeferredVB to fullscreen triangle
mDeferredVB->getVertexStrider(vert);
vert[0].set(-1,1,0);
vert[1].set(-1,-3,0);
vert[2].set(3,1,0);
{
LLGLDepthTest depth(GL_FALSE);
@@ -8510,14 +8501,10 @@ void LLPipeline::renderDeferredLighting()
{
LLGLDepthTest depth(GL_FALSE, GL_FALSE);
LLVector2 tc1(0,0);
LLVector2 tc2((F32) mScreen.getWidth()*2,
(F32) mScreen.getHeight()*2);
mScreen.bindTarget();
// Apply gamma correction to the frame here.
gDeferredPostGammaCorrectProgram.bind();
//mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
S32 channel = 0;
channel = gDeferredPostGammaCorrectProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage());
if (channel > -1)
@@ -8528,21 +8515,7 @@ void LLPipeline::renderDeferredLighting()
gDeferredPostGammaCorrectProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mScreen.getWidth(), mScreen.getHeight());
//F32 gamma = gSavedSettings.getF32("RenderDeferredDisplayGamma");
//gDeferredPostGammaCorrectProgram.uniform1f(LLShaderMgr::DISPLAY_GAMMA, (gamma > 0.1f) ? 1.0f / gamma : (1.0f/2.2f));
gGL.begin(LLRender::TRIANGLE_STRIP);
gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
gGL.vertex2f(-1,-1);
gGL.texCoord2f(tc1.mV[0], tc2.mV[1]);
gGL.vertex2f(-1,3);
gGL.texCoord2f(tc2.mV[0], tc1.mV[1]);
gGL.vertex2f(3,-1);
gGL.end();
mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
gGL.getTexUnit(channel)->unbind(mScreen.getUsage());
gDeferredPostGammaCorrectProgram.unbind();