summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpoolalpha.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lldrawpoolalpha.cpp')
-rw-r--r--indra/newview/lldrawpoolalpha.cpp47
1 files changed, 41 insertions, 6 deletions
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 31b84bb258..3ce2d4fb1c 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -441,6 +441,13 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
LLRenderPass::applyModelMatrix(params);
+ LLMaterial* mat = NULL;
+
+ if (deferred_render && !LLPipeline::sUnderWaterRender)
+ {
+ mat = params.mMaterial;
+ }
+
if (params.mFullbright)
{
// Turn off lighting if it hasn't already been so.
@@ -473,10 +480,30 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
light_enabled = TRUE;
}
- // If we need shaders, and we're not ALREADY using the proper shader, then bind it
- // (this way we won't rebind shaders unnecessarily).
- if(use_shaders && (current_shader != target_shader))
+ if (!params.mFullbright && deferred_render && mat)
+ {
+ U32 mask = mat->getShaderMask();
+
+ llassert(mask < LLMaterial::SHADER_COUNT);
+ target_shader = &(gDeferredMaterialProgram[mask]);
+
+ if (current_shader != target_shader)
+ {
+ gPipeline.bindDeferredShader(*target_shader);
+ }
+ }
+ else if (!params.mFullbright)
+ {
+ target_shader = simple_shader;
+ }
+ else
{
+ target_shader = fullbright_shader;
+ }
+
+ if(use_shaders && (current_shader != target_shader))
+ {// If we need shaders, and we're not ALREADY using the proper shader, then bind it
+ // (this way we won't rebind shaders unnecessarily).
llassert(target_shader != NULL);
current_shader = target_shader;
current_shader->bind();
@@ -487,7 +514,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
current_shader = NULL;
}
- if (params.mMaterial.notNull() && current_shader == simple_shader)
+ if (mat && !params.mFullbright)
{
// I apologize in advance for not giving this its own shader.
// We have a material. Supply the appropriate data here.
@@ -549,12 +576,20 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
}
}
}
- else
+ else
{ //not batching textures or batch has only 1 texture -- might need a texture matrix
if (params.mTexture.notNull())
{
params.mTexture->addTextureStats(params.mVSize);
- gGL.getTexUnit(0)->bind(params.mTexture, TRUE) ;
+ if (use_shaders && mat)
+ {
+ current_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, params.mTexture);
+ }
+ else
+ {
+ gGL.getTexUnit(0)->bind(params.mTexture, TRUE);
+ }
+
if (params.mTextureMatrix)
{
tex_setup = true;