diff options
author | Dave Parks <davep@lindenlab.com> | 2011-02-14 19:37:06 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-02-14 19:37:06 -0600 |
commit | cf728ab09ec12c73e95b8e2304a3b69c9460182e (patch) | |
tree | 9e0a22d18bae585d9d37121b48b4ec057643245c /indra | |
parent | 9fcc8c3161986a7eb8052aaf353a2a4d2e6974f5 (diff) | |
parent | 6e8115cd223056e91816008f11e624939058ddf4 (diff) |
merge
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl | 2 | ||||
-rw-r--r-- | indra/newview/lldrawpoolalpha.cpp | 18 | ||||
-rw-r--r-- | indra/newview/lldrawpoolavatar.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/pipeline.cpp | 105 |
4 files changed, 74 insertions, 53 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl index 7125d845d9..e3c15a2ab2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl @@ -14,7 +14,7 @@ uniform sampler2D specularMap; void main() { vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); - gl_FragData[0] = vec4(col.rgb, col.a <= 0.5 ? 0.0 : 0.005); + gl_FragData[0] = vec4(col.rgb, col.a * 0.005); gl_FragData[1] = texture2D(specularMap, gl_TexCoord[0].xy); gl_FragData[2] = vec4(texture2D(normalMap, gl_TexCoord[0].xy).xyz, 0.0); } diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 2519d0297c..7f1740e29f 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -103,7 +103,14 @@ void LLDrawPoolAlpha::renderDeferred(S32 pass) S32 LLDrawPoolAlpha::getNumPostDeferredPasses() { - return 2; + if (LLPipeline::sImpostorRender) + { //skip depth buffer filling pass when rendering impostors + return 1; + } + else + { + return 2; + } } void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass) @@ -137,8 +144,13 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass) void LLDrawPoolAlpha::endPostDeferredPass(S32 pass) { - gPipeline.mDeferredDepth.flush(); - gPipeline.mScreen.bindTarget(); + + if (pass == 1) + { + gPipeline.mDeferredDepth.flush(); + gPipeline.mScreen.bindTarget(); + } + deferred_render = FALSE; endRenderPass(pass); } diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index df5b341fdf..ae3421a019 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -494,7 +494,7 @@ void LLDrawPoolAvatar::render(S32 pass) LLFastTimer t(FTM_RENDER_CHARACTERS); if (LLPipeline::sImpostorRender) { - renderAvatars(NULL, 2); + renderAvatars(NULL, pass+2); return; } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index b0aa50bc57..9d7af4aace 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -104,6 +104,26 @@ #include "llcurl.h" +void check_stack_depth(S32 stack_depth) +{ + if (gDebugGL || gDebugSession) + { + GLint depth; + glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &depth); + if (depth != stack_depth) + { + if (gDebugSession) + { + ll_fail("GL matrix stack corrupted."); + } + else + { + llerrs << "GL matrix stack corrupted!" << llendl; + } + } + } +} + #ifdef _DEBUG // Debug indices is disabled for now for debug performance - djs 4/24/02 //#define DEBUG_INDICES @@ -3354,6 +3374,13 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) } } + S32 stack_depth = 0; + + if (gDebugGL) + { + glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &stack_depth); + } + /////////////////////////////////////////// // // Sync and verify GL state @@ -3478,18 +3505,9 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) } poolp->endRenderPass(i); LLVertexBuffer::unbind(); - if (gDebugGL || gDebugPipeline) + if (gDebugGL) { - GLint depth; - glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &depth); - if (depth > 3) - { - if (gDebugSession) - { - ll_fail("GL matrix stack corrupted."); - } - llerrs << "GL matrix stack corrupted!" << llendl; - } + check_stack_depth(stack_depth); std::string msg = llformat("%s pass %d", gPoolNames[cur_type].c_str(), i); LLGLState::checkStates(msg); LLGLState::checkTextureChannels(msg); @@ -3512,11 +3530,11 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) iter1 = iter2; stop_glerror(); } - - LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderDrawPoolsEnd"); - - LLVertexBuffer::unbind(); + LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderDrawPoolsEnd"); + + LLVertexBuffer::unbind(); + gGLLastMatrix = NULL; glLoadMatrixd(gGLModelView); @@ -3563,9 +3581,9 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) { if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { - // Render debugging beacons. - gObjectList.renderObjectBeacons(); - gObjectList.resetObjectBeacons(); + // Render debugging beacons. + gObjectList.renderObjectBeacons(); + gObjectList.resetObjectBeacons(); } else { @@ -4269,9 +4287,10 @@ void LLPipeline::renderDebug() gGL.popMatrix(); } } + + gGL.popMatrix(); } - gGL.popMatrix(); gGL.flush(); gPipeline.renderPhysicsDisplay(); @@ -7779,7 +7798,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) LLPipeline::RENDER_TYPE_WL_SKY, LLPipeline::END_RENDER_TYPES); + //bad pop here renderGeom(camera, TRUE); + gPipeline.popRenderTypeMask(); } @@ -9372,8 +9393,6 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) glClearColor(0.0f,0.0f,0.0f,0.0f); gGL.setColorMask(true, true); - glStencilMask(0xFFFFFFFF); - glClearStencil(0); // get the number of pixels per angle F32 pa = gViewerWindow->getWindowHeightRaw() / (RAD_TO_DEG * viewer_camera->getView()); @@ -9385,7 +9404,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) if (!avatar->mImpostor.isComplete() || resX != avatar->mImpostor.getWidth() || resY != avatar->mImpostor.getHeight()) { - avatar->mImpostor.allocate(resX,resY,GL_RGBA,TRUE,TRUE); + avatar->mImpostor.allocate(resX,resY,GL_RGBA,TRUE,FALSE); if (LLPipeline::sRenderDeferred) { @@ -9397,40 +9416,30 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } - LLGLEnable stencil(GL_STENCIL_TEST); - glStencilMask(0xFFFFFFFF); - glStencilFunc(GL_ALWAYS, 1, 0xFFFFFFFF); - glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); + avatar->mImpostor.bindTarget(); - { - LLGLEnable scissor(GL_SCISSOR_TEST); - glScissor(0, 0, resX, resY); - avatar->mImpostor.bindTarget(); - avatar->mImpostor.clear(); - } - if (LLPipeline::sRenderDeferred) { - stop_glerror(); + avatar->mImpostor.clear(); renderGeomDeferred(camera); renderGeomPostDeferred(camera); } else { + LLGLEnable scissor(GL_SCISSOR_TEST); + glScissor(0, 0, resX, resY); + avatar->mImpostor.clear(); renderGeom(camera); } - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - glStencilFunc(GL_EQUAL, 1, 0xFFFFFF); - - { //create alpha mask based on stencil buffer (grey out if muted) + { //create alpha mask based on depth buffer (grey out if muted) if (LLPipeline::sRenderDeferred) { - GLuint buff = GL_COLOR_ATTACHMENT0_EXT; + GLuint buff = GL_COLOR_ATTACHMENT0; glDrawBuffersARB(1, &buff); } - LLGLEnable blend(muted ? 0 : GL_BLEND); + LLGLDisable blend(GL_BLEND); if (muted) { @@ -9441,34 +9450,34 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) gGL.setColorMask(false, true); } - gGL.setSceneBlendType(LLRender::BT_ADD); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLGLDepthTest depth(GL_FALSE, GL_FALSE); + LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER); gGL.flush(); glPushMatrix(); glLoadIdentity(); glMatrixMode(GL_PROJECTION); + glPushMatrix(); glLoadIdentity(); + static const F32 clip_plane = 0.99999f; + gGL.color4ub(64,64,64,255); gGL.begin(LLRender::QUADS); - gGL.vertex2f(-1, -1); - gGL.vertex2f(1, -1); - gGL.vertex2f(1, 1); - gGL.vertex2f(-1, 1); + gGL.vertex3f(-1, -1, clip_plane); + gGL.vertex3f(1, -1, clip_plane); + gGL.vertex3f(1, 1, clip_plane); + gGL.vertex3f(-1, 1, clip_plane); gGL.end(); gGL.flush(); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); - gGL.setSceneBlendType(LLRender::BT_ALPHA); } - avatar->mImpostor.flush(); avatar->setImpostorDim(tdim); |