summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTofu Buzzard <no-email>2011-02-14 19:29:59 -0800
committerTofu Buzzard <no-email>2011-02-14 19:29:59 -0800
commitb6eaa84f379e236eaa76adc9962d91b91df72b7f (patch)
treea6491b27a0f3d5ddbe1064c1d8b1c33e14b396eb
parentef49d3f30b0ed18ae31147ff10d19e63034ceab9 (diff)
parent681d64de0261235cbafe6b9b082344241b6fbf54 (diff)
merge
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl2
-rw-r--r--indra/newview/lldrawpoolalpha.cpp18
-rw-r--r--indra/newview/lldrawpoolavatar.cpp2
-rw-r--r--indra/newview/llfloaterpreference.cpp27
-rwxr-xr-xindra/newview/llviewermenu.cpp3
-rw-r--r--indra/newview/llviewershadermgr.cpp19
-rwxr-xr-xindra/newview/pipeline.cpp105
7 files changed, 102 insertions, 74 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
index 7829e9b72f..f4f6ee95d0 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 != vec4(0,0,0,0));
+ gl_FragData[0] = vec4(col.rgb, col.a * 0.005);
gl_FragData[1] = texture2D(specularMap, gl_TexCoord[0].xy);
gl_FragData[2] = texture2D(normalMap, gl_TexCoord[0].xy);
}
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/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 9562f2d9d2..a90bacf41d 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -1037,26 +1037,25 @@ void LLFloaterPreference::refreshEnabledState()
//Deferred/SSAO/Shadows
LLCheckBoxCtrl* ctrl_deferred = getChild<LLCheckBoxCtrl>("UseLightShaders");
- if (LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") &&
- shaders &&
- gGLManager.mHasFramebufferObject)
- {
- BOOL enabled = (ctrl_wind_light->get()) ? TRUE : FALSE;
+ BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") &&
+ shaders &&
+ gGLManager.mHasFramebufferObject &&
+ gSavedSettings.getBOOL("RenderAvatarVP") &&
+ (ctrl_wind_light->get()) ? TRUE : FALSE;
- ctrl_deferred->setEnabled(enabled);
+ ctrl_deferred->setEnabled(enabled);
- LLCheckBoxCtrl* ctrl_ssao = getChild<LLCheckBoxCtrl>("UseSSAO");
- LLComboBox* ctrl_shadow = getChild<LLComboBox>("ShadowDetail");
+ LLCheckBoxCtrl* ctrl_ssao = getChild<LLCheckBoxCtrl>("UseSSAO");
+ LLComboBox* ctrl_shadow = getChild<LLComboBox>("ShadowDetail");
- enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO") && (ctrl_deferred->get() ? TRUE : FALSE);
+ enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO") && (ctrl_deferred->get() ? TRUE : FALSE);
- ctrl_ssao->setEnabled(enabled);
+ ctrl_ssao->setEnabled(enabled);
- enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail");
-
- ctrl_shadow->setEnabled(enabled);
- }
+ enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail");
+ ctrl_shadow->setEnabled(enabled);
+
// now turn off any features that are unavailable
disableUnavailableSettings();
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index eb022851e7..cfcce3e7bb 100755
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -2082,7 +2082,8 @@ class LLAdvancedEnableRenderDeferredOptions: public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
- bool new_value = gSavedSettings.getBOOL("RenderDeferred");
+ bool new_value = gGLManager.mHasFramebufferObject && LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_WINDLIGHT > 0) &&
+ LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) > 0 && gSavedSettings.getBOOL("RenderDeferred");
return new_value;
}
};
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index a9462c9d50..25cf63a367 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -397,7 +397,9 @@ void LLViewerShaderMgr::setShaders()
S32 deferred_class = 0;
if (LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") &&
- gSavedSettings.getBOOL("RenderDeferred"))
+ gSavedSettings.getBOOL("RenderDeferred") &&
+ gSavedSettings.getBOOL("RenderAvatarVP") &&
+ gSavedSettings.getBOOL("WindLightUseAtmosShaders"))
{
if (gSavedSettings.getS32("RenderShadowDetail") > 0)
{
@@ -416,10 +418,10 @@ void LLViewerShaderMgr::setShaders()
}
//make sure hardware skinning is enabled
- gSavedSettings.setBOOL("RenderAvatarVP", TRUE);
+ //gSavedSettings.setBOOL("RenderAvatarVP", TRUE);
//make sure atmospheric shaders are enabled
- gSavedSettings.setBOOL("WindLightUseAtmosShaders", TRUE);
+ //gSavedSettings.setBOOL("WindLightUseAtmosShaders", TRUE);
}
@@ -505,9 +507,14 @@ void LLViewerShaderMgr::setShaders()
{ //hardware skinning not possible, neither is deferred rendering
mVertexShaderLevel[SHADER_AVATAR] = 0;
mVertexShaderLevel[SHADER_DEFERRED] = 0;
- gSavedSettings.setBOOL("RenderDeferred", FALSE);
- gSavedSettings.setBOOL("RenderAvatarCloth", FALSE);
- gSavedSettings.setBOOL("RenderAvatarVP", FALSE);
+
+ if (gSavedSettings.getBOOL("RenderAvatarVP"))
+ {
+ gSavedSettings.setBOOL("RenderDeferred", FALSE);
+ gSavedSettings.setBOOL("RenderAvatarCloth", FALSE);
+ gSavedSettings.setBOOL("RenderAvatarVP", FALSE);
+ }
+
loadShadersAvatar(); // unloads
loadShadersObject();
}
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);