diff options
author | Todd Stinson <stinson@lindenlab.com> | 2012-04-03 11:06:33 -0700 |
---|---|---|
committer | Todd Stinson <stinson@lindenlab.com> | 2012-04-03 11:06:33 -0700 |
commit | 36a0a58487063152d8aacdeb22060025fe0021c7 (patch) | |
tree | 58a59dee2b88e1e51391987b157a37b3c8cd710b /indra/newview/pipeline.cpp | |
parent | 8b5b0ace9bfb83540fbc73376b639180d6d63a3b (diff) | |
parent | fa6add3fcd300b21142e3381f35851b3404ee02a (diff) |
Pull and merge from ssh://hg@bitbucket.org/lindenlab/viewer-development.
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r-- | indra/newview/pipeline.cpp | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index d196361b88..163421004a 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -812,6 +812,10 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) if (LLPipeline::sRenderDeferred)
{
+ // Set this flag in case we crash while resizing window or allocating space for deferred rendering targets
+ gSavedSettings.setBOOL("RenderInitError", TRUE);
+ gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
+
S32 shadow_detail = RenderShadowDetail;
BOOL ssao = RenderDeferredSSAO;
@@ -873,6 +877,10 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) mShadow[i].release();
}
}
+
+ // don't disable shaders on next session
+ gSavedSettings.setBOOL("RenderInitError", FALSE);
+ gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
}
else
{
@@ -1077,10 +1085,11 @@ void LLPipeline::createGLBuffers() if (LLPipeline::sWaterReflections)
{ //water reflection texture
- U32 res = (U32) gSavedSettings.getS32("RenderWaterRefResolution");
+ U32 res = (U32) llmax(gSavedSettings.getS32("RenderWaterRefResolution"), 512);
mWaterRef.allocate(res,res,GL_RGBA,TRUE,FALSE);
- mWaterDis.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);
}
mHighlight.allocate(256,256,GL_RGBA, FALSE, FALSE);
@@ -4314,7 +4323,7 @@ void LLPipeline::renderDebug() LLMemType mt(LLMemType::MTYPE_PIPELINE);
assertInitialized();
-
+
bool hud_only = hasRenderType(LLPipeline::RENDER_TYPE_HUD);
if (!hud_only )
@@ -4393,7 +4402,7 @@ void LLPipeline::renderDebug() gGL.loadMatrix(gGLModelView);
gGL.setColorMask(true, false);
-
+
if (!hud_only && !mDebugBlips.empty())
{ //render debug blips
if (LLGLSLShader::sNoFixedFunction)
@@ -6718,9 +6727,12 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) mDeferredLight.flush();
}
+ U32 dof_width = (U32) (mScreen.getWidth()*CameraDoFResScale);
+ U32 dof_height = (U32) (mScreen.getHeight()*CameraDoFResScale);
+
{ //perform DoF sampling at half-res (preserve alpha channel)
mScreen.bindTarget();
- glViewport(0,0,(GLsizei) (mScreen.getWidth()*CameraDoFResScale), (GLsizei) (mScreen.getHeight()*CameraDoFResScale));
+ glViewport(0,0, dof_width, dof_height);
gGL.setColorMask(true, false);
shader = &gDeferredPostProgram;
@@ -6778,6 +6790,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) shader->uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
shader->uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
+ shader->uniform1f(LLShaderMgr::DOF_WIDTH, dof_width-1);
+ shader->uniform1f(LLShaderMgr::DOF_HEIGHT, dof_height-1);
gGL.begin(LLRender::TRIANGLE_STRIP);
gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
@@ -6877,7 +6891,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) mFXAABuffer.bindTexture(0, channel);
gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
}
-
+
gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
@@ -7529,7 +7543,7 @@ void LLPipeline::renderDeferredLighting() F32 s = volume->getLightRadius()*1.5f;
LLColor3 col = volume->getLightColor();
-
+
if (col.magVecSquared() < 0.001f)
{
continue;
@@ -7642,7 +7656,7 @@ void LLPipeline::renderDeferredLighting() setupSpotLight(gDeferredSpotLightProgram, drawablep);
LLColor3 col = volume->getLightColor();
-
+
//vertex positions are encoded so the 3 bits of their vertex index
//correspond to their axis facing, with bit position 3,2,1 matching
//axis facing x,y,z, bit set meaning positive facing, bit clear
@@ -7751,7 +7765,7 @@ void LLPipeline::renderDeferredLighting() setupSpotLight(gDeferredMultiSpotLightProgram, drawablep);
LLColor3 col = volume->getLightColor();
-
+
gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v);
gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s*s);
gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
@@ -8888,16 +8902,16 @@ void LLPipeline::generateSunShadow(LLCamera& camera) da = powf(da, split_exp.mV[2]);
-
F32 sxp = split_exp.mV[1] + (split_exp.mV[0]-split_exp.mV[1])*da;
-
for (U32 i = 0; i < 4; ++i)
{
F32 x = (F32)(i+1)/4.f;
x = powf(x, sxp);
mSunClipPlanes.mV[i] = near_clip+range*x;
}
+
+ mSunClipPlanes.mV[0] *= 1.25f; //bump back first split for transition padding
}
// convenience array of 4 near clip plane distances
@@ -8954,8 +8968,8 @@ void LLPipeline::generateSunShadow(LLCamera& camera) delta += (frust[i+4]-frust[(i+2)%4+4])*0.05f;
delta.normVec();
F32 dp = delta*pn;
- frust[i] = eye + (delta*dist[j]*0.95f)/dp;
- frust[i+4] = eye + (delta*dist[j+1]*1.05f)/dp;
+ frust[i] = eye + (delta*dist[j]*0.75f)/dp;
+ frust[i+4] = eye + (delta*dist[j+1]*1.25f)/dp;
}
shadow_cam.calcAgentFrustumPlanes(frust);
|