From eda11a25a465dd87b187f63da661f2ce02925deb Mon Sep 17 00:00:00 2001 From: Geenz Date: Fri, 11 Jan 2013 06:37:21 -0500 Subject: Initial (largely complete) gamma correct rendering implementation. --- indra/newview/lldrawpoolalpha.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 313b310e1e..33615eb075 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -240,6 +240,12 @@ void LLDrawPoolAlpha::render(S32 pass) { fullbright_shader->bind(); fullbright_shader->setMinimumAlpha(0.33f); + if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred) + { + fullbright_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); + } else { + fullbright_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); + } } pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); //LLGLSLShader::bindNoShader(); @@ -423,6 +429,17 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) if (use_shaders) { target_shader = fullbright_shader; + if (LLPipeline::sRenderDeferred) + { + if (params.mFace->getViewerObject()->isHUDAttachment()) + { + target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0); + } else { + target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2); + } + } else { + target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0); + } } else { -- cgit v1.2.3 From 5121dd1a533b1d589cf259e96fa6d0ba22b383ea Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 28 Mar 2013 12:15:32 -0500 Subject: NORSPEC-62 Fix for fullbright checkbox not working with materials --- indra/newview/lldrawpoolalpha.cpp | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 33615eb075..24a7939d12 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -91,12 +91,31 @@ void LLDrawPoolAlpha::renderDeferred(S32 pass) LLFastTimer t(FTM_RENDER_GRASS); gDeferredDiffuseAlphaMaskProgram.bind(); gDeferredDiffuseAlphaMaskProgram.setMinimumAlpha(0.33f); - - //render alpha masked objects - LLRenderPass::pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); gDeferredDiffuseAlphaMaskProgram.unbind(); } +void LLDrawPoolAlpha::pushMaskBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures) +{ + for (LLCullResult::drawinfo_iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i) + { + LLDrawInfo* pparams = *i; + if (pparams) + { + if (LLGLSLShader::sCurBoundShaderPtr) + { + LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(pparams->mAlphaMaskCutoff); + } + else + { + gGL.setAlphaRejectSettings(LLRender::CF_GREATER, pparams->mAlphaMaskCutoff); + } + + pushBatch(*pparams, mask, texture, batch_textures); + } + } +} + S32 LLDrawPoolAlpha::getNumPostDeferredPasses() { @@ -150,7 +169,6 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass) void LLDrawPoolAlpha::endPostDeferredPass(S32 pass) { - if (pass == 1) { gPipeline.mDeferredDepth.flush(); @@ -234,7 +252,7 @@ void LLDrawPoolAlpha::render(S32 pass) simple_shader->bind(); simple_shader->setMinimumAlpha(0.33f); - pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); } if (fullbright_shader) { @@ -247,16 +265,16 @@ void LLDrawPoolAlpha::render(S32 pass) fullbright_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); } } - pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); //LLGLSLShader::bindNoShader(); } else { gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.33f); //OK gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); - pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask()); + pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask(), TRUE, FALSE); gPipeline.enableLightsDynamic(); - pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask()); + pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask(), TRUE, FALSE); gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); //OK } } -- cgit v1.2.3 From 14f02e48b877569539c96ef5f261ac8b3943579f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 29 Mar 2013 20:12:27 -0500 Subject: NORSPEC-66 Hook up material parameters to rigged attachments. --- indra/newview/lldrawpoolalpha.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 24a7939d12..a8abe9a267 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -447,16 +447,19 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) if (use_shaders) { target_shader = fullbright_shader; - if (LLPipeline::sRenderDeferred) + if (target_shader) { - if (params.mFace->getViewerObject()->isHUDAttachment()) + if (LLPipeline::sRenderDeferred) { - target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0); + if (params.mFace->getViewerObject()->isHUDAttachment()) + { + target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0); + } else { + target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2); + } } else { - target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2); + target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0); } - } else { - target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0); } } else -- cgit v1.2.3 From 78d23e66425265e43584c6c4fd4fce9c675f4771 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 10 Apr 2013 00:27:32 -0500 Subject: NORSPEC-75 Add appropriate draw calls to underwater render passes so objects with material data don't disappear in water. --- indra/newview/lldrawpoolalpha.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index a8abe9a267..1f5829c7ec 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -253,6 +253,10 @@ void LLDrawPoolAlpha::render(S32 pass) 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); } if (fullbright_shader) { -- cgit v1.2.3 From cfc375777871ec3d04b9969793379d0cd78a012e Mon Sep 17 00:00:00 2001 From: Geenz Date: Thu, 11 Apr 2013 14:57:11 -0400 Subject: First pass on alpha blended materials --- indra/newview/lldrawpoolalpha.cpp | 60 +++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 15 deletions(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index a8abe9a267..291bdfebe6 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -436,7 +436,6 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) } LLRenderPass::applyModelMatrix(params); - if (params.mFullbright) { @@ -447,20 +446,6 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) if (use_shaders) { target_shader = fullbright_shader; - if (target_shader) - { - if (LLPipeline::sRenderDeferred) - { - if (params.mFace->getViewerObject()->isHUDAttachment()) - { - target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0); - } else { - target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2); - } - } else { - target_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0); - } - } } else { @@ -497,6 +482,51 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) LLGLSLShader::bindNoShader(); current_shader = NULL; } + + if (params.mMaterialID != LLMaterialID::null && current_shader == simple_shader) + { + // I apologize in advance for not giving this its own shader. + // We have a material. Supply the appropriate data here. + if (LLPipeline::sRenderDeferred) + { + current_shader->uniform4f(LLShaderMgr::SPECULAR_COLOR, params.mSpecColor.mV[0], params.mSpecColor.mV[1], params.mSpecColor.mV[2], params.mSpecColor.mV[3]); + + current_shader->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, params.mEnvIntensity); + + if (params.mNormalMap) + { + params.mNormalMap->addTextureStats(params.mVSize); + current_shader->bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap); + } else { + LLViewerFetchedTexture::sFlatNormalImagep->addTextureStats(params.mVSize); + current_shader->bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap); + } + + if (params.mSpecularMap) + { + params.mSpecularMap->addTextureStats(params.mVSize); + current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, params.mSpecularMap); + } else { + LLViewerFetchedTexture::sWhiteImagep->addTextureStats(params.mVSize); + current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep); + } + } + } else if (current_shader == simple_shader) + { + // No material. Propegate with default parameters. + if (LLPipeline::sRenderDeferred) + { + current_shader->uniform4f(LLShaderMgr::SPECULAR_COLOR, 0.0f, 0.0f, 0.0f, 0.0f); + + current_shader->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, 0.0f); + + LLViewerFetchedTexture::sFlatNormalImagep->addTextureStats(params.mVSize); + current_shader->bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap); + + LLViewerFetchedTexture::sWhiteImagep->addTextureStats(params.mVSize); + current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep); + } + } if (params.mGroup) { -- cgit v1.2.3 From 66b4900e70db9bf6244faee0bcde63060302f9fe Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 11 Apr 2013 15:17:55 -0500 Subject: Pass binormal masks in on particles and in lldrawpoolalpha --- indra/newview/lldrawpoolalpha.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 291bdfebe6..d506e57609 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -326,7 +326,7 @@ void LLDrawPoolAlpha::render(S32 pass) if (mVertexShaderLevel > 0) { - renderAlpha(getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX); + renderAlpha(getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_BINORMAL); } else { -- cgit v1.2.3 From 6257a8394c23b518febdf5ec9c9ecbdce224e046 Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 15 Apr 2013 01:35:21 -0400 Subject: Normal mapped alpha support. Specular and environment map support needs a bit of extra work (in progress). --- indra/newview/lldrawpoolalpha.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index d506e57609..3159fa48b8 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -499,7 +499,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) current_shader->bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap); } else { LLViewerFetchedTexture::sFlatNormalImagep->addTextureStats(params.mVSize); - current_shader->bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap); + current_shader->bindTexture(LLShaderMgr::BUMP_MAP, LLViewerFetchedTexture::sFlatNormalImagep); } if (params.mSpecularMap) @@ -521,7 +521,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) current_shader->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, 0.0f); LLViewerFetchedTexture::sFlatNormalImagep->addTextureStats(params.mVSize); - current_shader->bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap); + current_shader->bindTexture(LLShaderMgr::BUMP_MAP, LLViewerFetchedTexture::sFlatNormalImagep); LLViewerFetchedTexture::sWhiteImagep->addTextureStats(params.mVSize); current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep); -- cgit v1.2.3 From 39544a3b06e3221602444eb81c7df8c1030c6bb5 Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 15 Apr 2013 02:29:03 -0400 Subject: Hooked up normal and specular texture coordinates. --- indra/newview/lldrawpoolalpha.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 3159fa48b8..d8d85b11c7 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -326,7 +326,7 @@ void LLDrawPoolAlpha::render(S32 pass) if (mVertexShaderLevel > 0) { - renderAlpha(getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_BINORMAL); + renderAlpha(getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_BINORMAL | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2); } else { -- cgit v1.2.3 From 67af268b785e8a47d7db10aa3a566c269b0f16e3 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 17 Apr 2013 01:51:39 -0500 Subject: NORSPEC-90 Alpha pool hookups for materials. --- indra/newview/lldrawpoolalpha.cpp | 47 ++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 6 deletions(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') 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; -- cgit v1.2.3 From e40bcc4e16c8baeb3945e89c5d035d89416896e3 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 17 Apr 2013 09:05:40 -0700 Subject: NORSPEC-59 and NORSPEC-133 work-around crash with RenderDebugGL on and fix breakage in shaders from Mac changes --- indra/newview/lldrawpoolalpha.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 31b84bb258..f65bbc9799 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -515,21 +515,14 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep); } } - } else if (current_shader == simple_shader) + } else if (LLPipeline::sRenderDeferred && current_shader && (current_shader == simple_shader)) { - // No material. Propegate with default parameters. - if (LLPipeline::sRenderDeferred) - { - current_shader->uniform4f(LLShaderMgr::SPECULAR_COLOR, 0.0f, 0.0f, 0.0f, 0.0f); - - current_shader->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, 0.0f); - - LLViewerFetchedTexture::sFlatNormalImagep->addTextureStats(params.mVSize); - current_shader->bindTexture(LLShaderMgr::BUMP_MAP, LLViewerFetchedTexture::sFlatNormalImagep); - - LLViewerFetchedTexture::sWhiteImagep->addTextureStats(params.mVSize); - current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep); - } + current_shader->uniform4f(LLShaderMgr::SPECULAR_COLOR, 1.0f, 1.0f, 1.0f, 1.0f); + current_shader->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, 0.0f); + LLViewerFetchedTexture::sFlatNormalImagep->addTextureStats(params.mVSize); + current_shader->bindTexture(LLShaderMgr::BUMP_MAP, LLViewerFetchedTexture::sFlatNormalImagep); + LLViewerFetchedTexture::sWhiteImagep->addTextureStats(params.mVSize); + current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep); } if (params.mGroup) -- cgit v1.2.3 From c7b9b9e02cb771a082c33e073810791ed3158aeb Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 17 Apr 2013 09:19:08 -0700 Subject: NORSPEC-133 More NULL shader pointer crash suppression --- indra/newview/lldrawpoolalpha.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index f65bbc9799..70168c53c0 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -487,14 +487,13 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) current_shader = NULL; } - if (params.mMaterial.notNull() && current_shader == simple_shader) + if (params.mMaterial.notNull() && current_shader && (current_shader == simple_shader)) { // I apologize in advance for not giving this its own shader. // We have a material. Supply the appropriate data here. if (LLPipeline::sRenderDeferred) { - current_shader->uniform4f(LLShaderMgr::SPECULAR_COLOR, params.mSpecColor.mV[0], params.mSpecColor.mV[1], params.mSpecColor.mV[2], params.mSpecColor.mV[3]); - + current_shader->uniform4f(LLShaderMgr::SPECULAR_COLOR, params.mSpecColor.mV[0], params.mSpecColor.mV[1], params.mSpecColor.mV[2], params.mSpecColor.mV[3]); current_shader->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, params.mEnvIntensity); if (params.mNormalMap) @@ -515,6 +514,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep); } } + } else if (LLPipeline::sRenderDeferred && current_shader && (current_shader == simple_shader)) { current_shader->uniform4f(LLShaderMgr::SPECULAR_COLOR, 1.0f, 1.0f, 1.0f, 1.0f); -- cgit v1.2.3 From 1a5bba865c096473164b47a56dbb0ba1e055613d Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 18 Apr 2013 18:00:56 -0500 Subject: NORSPEC-90 Cleanup of alpha pool hook ups for materials. --- indra/newview/lldrawpoolalpha.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 3f041a3a85..1912ae0c16 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -152,8 +152,7 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass) gPipeline.mDeferredDepth.copyContents(gPipeline.mDeferredScreen, 0, 0, gPipeline.mDeferredScreen.getWidth(), gPipeline.mDeferredScreen.getHeight(), 0, 0, gPipeline.mDeferredDepth.getWidth(), gPipeline.mDeferredDepth.getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST); gPipeline.mDeferredDepth.bindTarget(); - simple_shader = NULL; - fullbright_shader = NULL; + simple_shader = fullbright_shader = &gObjectFullbrightAlphaMaskProgram; gObjectFullbrightAlphaMaskProgram.bind(); gObjectFullbrightAlphaMaskProgram.setMinimumAlpha(0.33f); } @@ -504,7 +503,6 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) 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(); } @@ -514,7 +512,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) current_shader = NULL; } - if (mat && !params.mFullbright) + if (use_shaders && mat && !params.mFullbright) { // I apologize in advance for not giving this its own shader. // We have a material. Supply the appropriate data here. -- cgit v1.2.3 From 18e3985120d53acdf07d43dce79312b78629e57a Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 6 May 2013 15:44:44 -0500 Subject: NORSPEC-162 Fix for objects with materials set ignoring "tranparency %" value. --- indra/newview/lldrawpoolalpha.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 1912ae0c16..d5de5d30b0 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -481,7 +481,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) if (!params.mFullbright && deferred_render && mat) { - U32 mask = mat->getShaderMask(); + U32 mask = params.mShaderMask; llassert(mask < LLMaterial::SHADER_COUNT); target_shader = &(gDeferredMaterialProgram[mask]); -- cgit v1.2.3 From 3702cb138fdb96d76a626483da924d9010e0a962 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 13 May 2013 12:15:05 -0500 Subject: NORSPEC-171 Fix for full bright checkbox breaking transparent objects with materials set. --- indra/newview/lldrawpoolalpha.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index d5de5d30b0..bfb66fce22 100755 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -442,7 +442,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) LLMaterial* mat = NULL; - if (deferred_render && !LLPipeline::sUnderWaterRender) + if (!params.mFullbright && deferred_render && !LLPipeline::sUnderWaterRender) { mat = params.mMaterial; } -- cgit v1.2.3 From 743d1a777e5c2827d50051c3f5e0942a870a6ff9 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 29 May 2013 18:48:09 -0500 Subject: NORSPEC-198, NORSPEC-176, NORSPEC-106, NORSPEC-202 et al -- Material matrix testing based overhaul WIP Reviewed by Graham --- indra/newview/lldrawpoolalpha.cpp | 114 +++----------------------------------- 1 file changed, 8 insertions(+), 106 deletions(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index bfb66fce22..90474ea6f6 100755 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -71,52 +71,6 @@ void LLDrawPoolAlpha::prerender() mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); } -S32 LLDrawPoolAlpha::getNumDeferredPasses() -{ - return 1; -} - -void LLDrawPoolAlpha::beginDeferredPass(S32 pass) -{ - -} - -void LLDrawPoolAlpha::endDeferredPass(S32 pass) -{ - -} - -void LLDrawPoolAlpha::renderDeferred(S32 pass) -{ - LLFastTimer t(FTM_RENDER_GRASS); - gDeferredDiffuseAlphaMaskProgram.bind(); - gDeferredDiffuseAlphaMaskProgram.setMinimumAlpha(0.33f); - pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); - gDeferredDiffuseAlphaMaskProgram.unbind(); -} - -void LLDrawPoolAlpha::pushMaskBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures) -{ - for (LLCullResult::drawinfo_iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i) - { - LLDrawInfo* pparams = *i; - if (pparams) - { - if (LLGLSLShader::sCurBoundShaderPtr) - { - LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(pparams->mAlphaMaskCutoff); - } - else - { - gGL.setAlphaRejectSettings(LLRender::CF_GREATER, pparams->mAlphaMaskCutoff); - } - - pushBatch(*pparams, mask, texture, batch_textures); - } - } -} - - S32 LLDrawPoolAlpha::getNumPostDeferredPasses() { if (LLPipeline::sImpostorRender) @@ -235,53 +189,7 @@ void LLDrawPoolAlpha::render(S32 pass) { gGL.setColorMask(true, true); } - - if (LLPipeline::sAutoMaskAlphaNonDeferred) - { - mColorSFactor = LLRender::BF_ONE; // } - mColorDFactor = LLRender::BF_ZERO; // } these are like disabling blend on the color channels, but we're still blending on the alpha channel so that we can suppress glow - mAlphaSFactor = LLRender::BF_ZERO; - mAlphaDFactor = LLRender::BF_ZERO; // block (zero-out) glow where the alpha test succeeds - gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor); - - if (mVertexShaderLevel > 0) - { - if (!LLPipeline::sRenderDeferred || !deferred_render) - { - 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); - } - if (fullbright_shader) - { - fullbright_shader->bind(); - fullbright_shader->setMinimumAlpha(0.33f); - if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred) - { - fullbright_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); - } else { - fullbright_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); - } - } - pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); - //LLGLSLShader::bindNoShader(); - } - else - { - gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.33f); //OK - gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); - pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask(), TRUE, FALSE); - gPipeline.enableLightsDynamic(); - pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask(), TRUE, FALSE); - gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); //OK - } - } - + LLGLDepthTest depth(GL_TRUE, LLDrawPoolWater::sSkipScreenCopy || (deferred_render && pass == 1) ? GL_TRUE : GL_FALSE); @@ -442,7 +350,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) LLMaterial* mat = NULL; - if (!params.mFullbright && deferred_render && !LLPipeline::sUnderWaterRender) + if (deferred_render && !LLPipeline::sUnderWaterRender) { mat = params.mMaterial; } @@ -479,7 +387,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) light_enabled = TRUE; } - if (!params.mFullbright && deferred_render && mat) + if (deferred_render && mat) { U32 mask = params.mShaderMask; @@ -512,32 +420,26 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) current_shader = NULL; } - if (use_shaders && mat && !params.mFullbright) + if (use_shaders && mat) { - // I apologize in advance for not giving this its own shader. // We have a material. Supply the appropriate data here. if (LLPipeline::sRenderDeferred) { current_shader->uniform4f(LLShaderMgr::SPECULAR_COLOR, params.mSpecColor.mV[0], params.mSpecColor.mV[1], params.mSpecColor.mV[2], params.mSpecColor.mV[3]); current_shader->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, params.mEnvIntensity); - + current_shader->uniform1f(LLShaderMgr::EMISSIVE_BRIGHTNESS, params.mFullbright ? 1.f : 0.f); + if (params.mNormalMap) { params.mNormalMap->addTextureStats(params.mVSize); current_shader->bindTexture(LLShaderMgr::BUMP_MAP, params.mNormalMap); - } else { - LLViewerFetchedTexture::sFlatNormalImagep->addTextureStats(params.mVSize); - current_shader->bindTexture(LLShaderMgr::BUMP_MAP, LLViewerFetchedTexture::sFlatNormalImagep); - } + } if (params.mSpecularMap) { params.mSpecularMap->addTextureStats(params.mVSize); current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, params.mSpecularMap); - } else { - LLViewerFetchedTexture::sWhiteImagep->addTextureStats(params.mVSize); - current_shader->bindTexture(LLShaderMgr::SPECULAR_MAP, LLViewerFetchedTexture::sWhiteImagep); - } + } } } else if (LLPipeline::sRenderDeferred && current_shader && (current_shader == simple_shader)) -- cgit v1.2.3 From 38f62f5ceed5ec7a9c5bcfd8afe443475b343b08 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 30 May 2013 17:44:05 -0500 Subject: Fix for some objects not rendering underwater with advanced lighting enabled --- indra/newview/lldrawpoolalpha.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 90474ea6f6..d305126a75 100755 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -144,8 +144,8 @@ void LLDrawPoolAlpha::beginRenderPass(S32 pass) if (LLPipeline::sUnderWaterRender) { - simple_shader = &gObjectSimpleWaterAlphaMaskProgram; - fullbright_shader = &gObjectFullbrightWaterAlphaMaskProgram; + simple_shader = &gObjectSimpleWaterProgram; + fullbright_shader = &gObjectFullbrightWaterProgram; emissive_shader = &gObjectEmissiveWaterProgram; } else -- cgit v1.2.3 From 2cfd002a3be43698f1524a099c9298a63e635092 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 30 May 2013 19:07:44 -0500 Subject: NORSPEC-216 Fix for some HUD objects not rendering with advanced lighting/materials enabled. --- indra/newview/lldrawpoolalpha.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index d305126a75..145cd02668 100755 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -94,7 +94,7 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass) if (pass == 0) { simple_shader = &gDeferredAlphaProgram; - fullbright_shader = &gObjectFullbrightAlphaMaskProgram; + fullbright_shader = &gObjectFullbrightProgram; //prime simple shader (loads shadow relevant uniforms) gPipeline.bindDeferredShader(*simple_shader); @@ -150,8 +150,8 @@ void LLDrawPoolAlpha::beginRenderPass(S32 pass) } else { - simple_shader = &gObjectSimpleAlphaMaskProgram; - fullbright_shader = &gObjectFullbrightAlphaMaskProgram; + simple_shader = &gObjectSimpleProgram; + fullbright_shader = &gObjectFullbrightProgram; emissive_shader = &gObjectEmissiveProgram; } -- cgit v1.2.3 From a16d32e82edb19b6a3df6516c9726ac5913c1689 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 31 May 2013 13:01:57 -0500 Subject: Fix for uninitialized texture gamma on fullbright alpha objects. --- indra/newview/lldrawpoolalpha.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 145cd02668..5ed8bbca50 100755 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -95,7 +95,9 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass) { simple_shader = &gDeferredAlphaProgram; fullbright_shader = &gObjectFullbrightProgram; - + fullbright_shader->bind(); + fullbright_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); + fullbright_shader->unbind(); //prime simple shader (loads shadow relevant uniforms) gPipeline.bindDeferredShader(*simple_shader); } -- cgit v1.2.3 From c3f14b915c38a4978745f12f1f816572cce4b5a0 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 3 Jun 2013 12:50:48 -0500 Subject: NORSPEC-229 Fix for bad binormals on mirrored surfaces (use tangent calculator instead of binormal calculator, convert binormal centric code to tangent centric) --- indra/newview/lldrawpoolalpha.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 5ed8bbca50..c832e1401d 100755 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -239,7 +239,7 @@ void LLDrawPoolAlpha::render(S32 pass) if (mVertexShaderLevel > 0) { - renderAlpha(getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_BINORMAL | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2); + renderAlpha(getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2); } else { -- cgit v1.2.3