summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpoolsimple.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lldrawpoolsimple.cpp')
-rwxr-xr-x[-rw-r--r--]indra/newview/lldrawpoolsimple.cpp232
1 files changed, 231 insertions, 1 deletions
diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp
index 6e0ea78af2..2cf9d833c6 100644..100755
--- a/indra/newview/lldrawpoolsimple.cpp
+++ b/indra/newview/lldrawpoolsimple.cpp
@@ -47,6 +47,7 @@ static LLFastTimer::DeclareTimer FTM_RENDER_GRASS_DEFERRED("Deferred Grass");
void LLDrawPoolGlow::beginPostDeferredPass(S32 pass)
{
gDeferredEmissiveProgram.bind();
+ gDeferredEmissiveProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
}
static LLFastTimer::DeclareTimer FTM_RENDER_GLOW_PUSH("Glow Push");
@@ -110,6 +111,7 @@ void LLDrawPoolGlow::render(S32 pass)
LLGLSLShader* shader = LLPipeline::sUnderWaterRender ? &gObjectEmissiveWaterProgram : &gObjectEmissiveProgram;
shader->bind();
+ shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.f);
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
gGL.setColorMask(false, true);
@@ -198,7 +200,11 @@ void LLDrawPoolSimple::render(S32 pass)
if (LLPipeline::sRenderDeferred)
{ //if deferred rendering is enabled, bump faces aren't registered as simple
//render bump faces here as simple so bump faces will appear under water
- pushBatches(LLRenderPass::PASS_BUMP, mask, TRUE, TRUE);
+ pushBatches(LLRenderPass::PASS_BUMP, mask, TRUE, TRUE);
+ pushBatches(LLRenderPass::PASS_MATERIAL, mask, TRUE, TRUE);
+ pushBatches(LLRenderPass::PASS_SPECMAP, mask, TRUE, TRUE);
+ pushBatches(LLRenderPass::PASS_NORMMAP, mask, TRUE, TRUE);
+ pushBatches(LLRenderPass::PASS_NORMSPEC, mask, TRUE, TRUE);
}
}
else
@@ -210,6 +216,169 @@ void LLDrawPoolSimple::render(S32 pass)
}
}
+
+
+
+
+
+
+
+
+
+static LLFastTimer::DeclareTimer FTM_RENDER_ALPHA_MASK("Alpha Mask");
+
+LLDrawPoolAlphaMask::LLDrawPoolAlphaMask() :
+ LLRenderPass(POOL_ALPHA_MASK)
+{
+}
+
+void LLDrawPoolAlphaMask::prerender()
+{
+ mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);
+}
+
+void LLDrawPoolAlphaMask::beginRenderPass(S32 pass)
+{
+ LLFastTimer t(FTM_RENDER_ALPHA_MASK);
+
+ if (LLPipeline::sUnderWaterRender)
+ {
+ simple_shader = &gObjectSimpleWaterAlphaMaskProgram;
+ }
+ else
+ {
+ simple_shader = &gObjectSimpleAlphaMaskProgram;
+ }
+
+ if (mVertexShaderLevel > 0)
+ {
+ simple_shader->bind();
+ }
+ else
+ {
+ // don't use shaders!
+ if (gGLManager.mHasShaderObjects)
+ {
+ LLGLSLShader::bindNoShader();
+ }
+ }
+}
+
+void LLDrawPoolAlphaMask::endRenderPass(S32 pass)
+{
+ LLFastTimer t(FTM_RENDER_ALPHA_MASK);
+ stop_glerror();
+ LLRenderPass::endRenderPass(pass);
+ stop_glerror();
+ if (mVertexShaderLevel > 0)
+ {
+ simple_shader->unbind();
+ }
+}
+
+void LLDrawPoolAlphaMask::render(S32 pass)
+{
+ LLGLDisable blend(GL_BLEND);
+ LLFastTimer t(FTM_RENDER_ALPHA_MASK);
+
+ if (mVertexShaderLevel > 0)
+ {
+ simple_shader->bind();
+ simple_shader->setMinimumAlpha(0.33f);
+
+ pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
+ pushMaskBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
+ pushMaskBatches(LLRenderPass::PASS_SPECMAP_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
+ pushMaskBatches(LLRenderPass::PASS_NORMMAP_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
+ pushMaskBatches(LLRenderPass::PASS_NORMSPEC_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
+ }
+ else
+ {
+ LLGLEnable test(GL_ALPHA_TEST);
+ pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask(), TRUE, FALSE);
+ gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); //OK
+ }
+}
+
+LLDrawPoolFullbrightAlphaMask::LLDrawPoolFullbrightAlphaMask() :
+ LLRenderPass(POOL_FULLBRIGHT_ALPHA_MASK)
+{
+}
+
+void LLDrawPoolFullbrightAlphaMask::prerender()
+{
+ mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT);
+}
+
+void LLDrawPoolFullbrightAlphaMask::beginRenderPass(S32 pass)
+{
+ LLFastTimer t(FTM_RENDER_ALPHA_MASK);
+
+ if (LLPipeline::sUnderWaterRender)
+ {
+ simple_shader = &gObjectFullbrightWaterAlphaMaskProgram;
+ }
+ else
+ {
+ simple_shader = &gObjectFullbrightAlphaMaskProgram;
+ }
+
+ if (mVertexShaderLevel > 0)
+ {
+ simple_shader->bind();
+ }
+ else
+ {
+ // don't use shaders!
+ if (gGLManager.mHasShaderObjects)
+ {
+ LLGLSLShader::bindNoShader();
+ }
+ }
+}
+
+void LLDrawPoolFullbrightAlphaMask::endRenderPass(S32 pass)
+{
+ LLFastTimer t(FTM_RENDER_ALPHA_MASK);
+ stop_glerror();
+ LLRenderPass::endRenderPass(pass);
+ stop_glerror();
+ if (mVertexShaderLevel > 0)
+ {
+ simple_shader->unbind();
+ }
+}
+
+void LLDrawPoolFullbrightAlphaMask::render(S32 pass)
+{
+ LLFastTimer t(FTM_RENDER_ALPHA_MASK);
+
+ if (mVertexShaderLevel > 0)
+ {
+ if (simple_shader)
+ {
+ simple_shader->bind();
+ simple_shader->setMinimumAlpha(0.33f);
+ if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred)
+ {
+ simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f);
+ } else {
+ simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
+ }
+ }
+ pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
+ //LLGLSLShader::bindNoShader();
+ }
+ else
+ {
+ LLGLEnable test(GL_ALPHA_TEST);
+ gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
+ pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask(), TRUE, FALSE);
+ gPipeline.enableLightsDynamic();
+ gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); //OK
+ }
+}
+
//===============================
//DEFERRED IMPLEMENTATION
//===============================
@@ -239,6 +408,28 @@ void LLDrawPoolSimple::renderDeferred(S32 pass)
}
}
+static LLFastTimer::DeclareTimer FTM_RENDER_ALPHA_MASK_DEFERRED("Deferred Alpha Mask");
+
+void LLDrawPoolAlphaMask::beginDeferredPass(S32 pass)
+{
+
+}
+
+void LLDrawPoolAlphaMask::endDeferredPass(S32 pass)
+{
+
+}
+
+void LLDrawPoolAlphaMask::renderDeferred(S32 pass)
+{
+ LLFastTimer t(FTM_RENDER_ALPHA_MASK_DEFERRED);
+ gDeferredDiffuseAlphaMaskProgram.bind();
+ gDeferredDiffuseAlphaMaskProgram.setMinimumAlpha(0.33f);
+ pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
+ gDeferredDiffuseAlphaMaskProgram.unbind();
+}
+
+
// grass drawpool
LLDrawPoolGrass::LLDrawPoolGrass() :
LLRenderPass(POOL_GRASS)
@@ -403,14 +594,24 @@ void LLDrawPoolFullbright::render(S32 pass)
{
fullbright_shader->bind();
fullbright_shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 1.f);
+ fullbright_shader->uniform1f(LLViewerShaderMgr::TEXTURE_GAMMA, 1.f);
+
U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX;
pushBatches(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask, TRUE, TRUE);
+ pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, fullbright_mask, TRUE, TRUE);
+ pushBatches(LLRenderPass::PASS_SPECMAP_EMISSIVE, fullbright_mask, TRUE, TRUE);
+ pushBatches(LLRenderPass::PASS_NORMMAP_EMISSIVE, fullbright_mask, TRUE, TRUE);
+ pushBatches(LLRenderPass::PASS_NORMSPEC_EMISSIVE, fullbright_mask, TRUE, TRUE);
}
else
{
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR;
renderTexture(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask);
+ pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, fullbright_mask);
+ pushBatches(LLRenderPass::PASS_SPECMAP_EMISSIVE, fullbright_mask);
+ pushBatches(LLRenderPass::PASS_NORMMAP_EMISSIVE, fullbright_mask);
+ pushBatches(LLRenderPass::PASS_NORMSPEC_EMISSIVE, fullbright_mask);
}
stop_glerror();
@@ -421,3 +622,32 @@ S32 LLDrawPoolFullbright::getNumPasses()
return 1;
}
+
+void LLDrawPoolFullbrightAlphaMask::beginPostDeferredPass(S32 pass)
+{
+ gObjectFullbrightAlphaMaskProgram.bind();
+ if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred)
+ {
+ gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f);
+ }
+ else
+ {
+ gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
+ }
+}
+
+void LLDrawPoolFullbrightAlphaMask::renderPostDeferred(S32 pass)
+{
+ LLFastTimer t(FTM_RENDER_FULLBRIGHT);
+ LLGLDisable blend(GL_BLEND);
+ U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX;
+ pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, fullbright_mask, TRUE, TRUE);
+}
+
+void LLDrawPoolFullbrightAlphaMask::endPostDeferredPass(S32 pass)
+{
+ gObjectFullbrightAlphaMaskProgram.unbind();
+ LLRenderPass::endRenderPass(pass);
+}
+
+