From eb35a7e167c6facaca8fd2596ae9fff8c8611d33 Mon Sep 17 00:00:00 2001 From: Palmer Date: Fri, 26 Mar 2010 13:55:35 -0700 Subject: Davep's LLDrawPoolBump changes from svn/linden/branches/viewer-mesh @ 114046 for deferred rendering --- indra/newview/lldrawpoolbump.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index d09d4a412f..a4a8dc80b5 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -701,6 +701,18 @@ void LLDrawPoolBump::endBump() gGL.setSceneBlendType(LLRender::BT_ALPHA); } +S32 LLDrawPoolBump::getNumDeferredPasses() +{ + if (gSavedSettings.getBOOL("RenderObjectBump")) + { + return 1; + } + else + { + return 0; + } +} + void LLDrawPoolBump::beginDeferredPass(S32 pass) { if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP)) -- cgit v1.2.3 From eb5b0f2542c16aaac2283d4050a4cc2a3c6691f8 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 4 Mar 2010 15:30:15 -0600 Subject: Optimiziation pass. Added RenderUseStreamVBO to enable/disable usage of VBO's for streaming buffers. Faster traversal of LLCullResult members. Removal of llpushcallstacks from inner loops. Sprinkling in fast timers. --- indra/newview/lldrawpoolbump.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index a4a8dc80b5..8f3e775976 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -837,7 +837,6 @@ void LLBumpImageList::addTextureStats(U8 bump, const LLUUID& base_image_id, F32 void LLBumpImageList::updateImages() { - llpushcallstacks ; for (bump_image_map_t::iterator iter = mBrightnessEntries.begin(); iter != mBrightnessEntries.end(); ) { bump_image_map_t::iterator curiter = iter++; @@ -864,7 +863,7 @@ void LLBumpImageList::updateImages() } } } - llpushcallstacks ; + for (bump_image_map_t::iterator iter = mDarknessEntries.begin(); iter != mDarknessEntries.end(); ) { bump_image_map_t::iterator curiter = iter++; @@ -891,7 +890,6 @@ void LLBumpImageList::updateImages() } } } - llpushcallstacks ; } -- cgit v1.2.3 From 4a3222d9c12812db70f2c9ec0050012d01155565 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 12 May 2010 03:59:01 -0500 Subject: Fix for fullbright bump not working in deferred render. Fix for shadow artifacts around split frusta. Tweak for shadow aliasing with projectors. Fix for crash on exit in mesh thread. (transplanted from 6dcf09cd3e524016c8130a0c8af3d9fc95f2d411) --- indra/newview/lldrawpoolbump.cpp | 44 +++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 10 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 8f3e775976..08c9f7fe15 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -618,9 +618,9 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel) } //static -void LLDrawPoolBump::beginBump() +void LLDrawPoolBump::beginBump(U32 pass) { - if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP)) + if (!gPipeline.hasRenderBatches(pass)) { return; } @@ -663,9 +663,9 @@ void LLDrawPoolBump::beginBump() } //static -void LLDrawPoolBump::renderBump() +void LLDrawPoolBump::renderBump(U32 pass) { - if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP)) + if (!gPipeline.hasRenderBatches(pass)) { return; } @@ -678,13 +678,13 @@ void LLDrawPoolBump::renderBump() /// Get rid of z-fighting with non-bump pass. LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1.0f, -1.0f); - renderBump(LLRenderPass::PASS_BUMP, sVertexMask); + renderBump(pass, sVertexMask); } //static -void LLDrawPoolBump::endBump() +void LLDrawPoolBump::endBump(U32 pass) { - if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP)) + if (!gPipeline.hasRenderBatches(pass)) { return; } @@ -767,17 +767,41 @@ void LLDrawPoolBump::renderDeferred(S32 pass) void LLDrawPoolBump::beginPostDeferredPass(S32 pass) { - beginFullbrightShiny(); + switch (pass) + { + case 0: + beginFullbrightShiny(); + break; + case 1: + beginBump(LLRenderPass::PASS_POST_BUMP); + break; + } } void LLDrawPoolBump::endPostDeferredPass(S32 pass) { - endFullbrightShiny(); + switch (pass) + { + case 0: + endFullbrightShiny(); + break; + case 1: + endBump(LLRenderPass::PASS_POST_BUMP); + break; + } } void LLDrawPoolBump::renderPostDeferred(S32 pass) { - renderFullbrightShiny(); + switch (pass) + { + case 0: + renderFullbrightShiny(); + break; + case 1: + renderBump(LLRenderPass::PASS_POST_BUMP); + break; + } } //////////////////////////////////////////////////////////////// -- cgit v1.2.3 From 261f2d60548c7ca784840ac5cafe7826dc311f74 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 12 May 2010 19:35:02 +0100 Subject: EXT-7154 : FIXED : darkness bumpmap looks like lightness bumpmap when deferred rendering is enabled --- indra/newview/lldrawpoolbump.cpp | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 08c9f7fe15..a3b236fcb9 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -818,17 +818,22 @@ void LLBumpImageList::init() LLStandardBumpmap::init(); } -void LLBumpImageList::shutdown() +void LLBumpImageList::clear() { + // these will be re-populated on-demand mBrightnessEntries.clear(); mDarknessEntries.clear(); +} + +void LLBumpImageList::shutdown() +{ + clear(); LLStandardBumpmap::shutdown(); } void LLBumpImageList::destroyGL() { - mBrightnessEntries.clear(); - mDarknessEntries.clear(); + clear(); LLStandardBumpmap::destroyGL(); } @@ -1065,7 +1070,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI { bump_image_map_t& entries_list(bump_code == BE_BRIGHTNESS ? gBumpImageList.mBrightnessEntries : gBumpImageList.mDarknessEntries ); bump_image_map_t::iterator iter = entries_list.find(source_asset_id); - if (iter != entries_list.end()) + if (iter != entries_list.end()) // bump not cached yet { LLPointer dst_image = new LLImageRaw(src->getWidth(), src->getHeight(), 1); U8* dst_data = dst_image->getData(); @@ -1150,8 +1155,11 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI F32 twice_one_over_range = 2.f / (maximum - minimum); S32 i; - const F32 ARTIFICIAL_SCALE = 2.f; // Advantage: exagerates the effect in midrange. Disadvantage: clamps at the extremes. - if( BE_DARKNESS == bump_code ) + bool bump_polarity_negative = LLPipeline::sRenderDeferred ? + (BE_BRIGHTNESS == bump_code) : (BE_DARKNESS == bump_code); // deferred mode likes its normal map values inverted + + const F32 ARTIFICIAL_SCALE = 2.f; // Advantage: exaggerates the effect in midrange. Disadvantage: clamps at the extremes. + if (bump_polarity_negative) { for( i = minimum; i <= maximum; i++ ) { @@ -1161,7 +1169,6 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI } else { - // BE_LIGHTNESS for( i = minimum; i <= maximum; i++ ) { F32 minus_one_to_one = F32(i - minimum) * twice_one_over_range - 1.f; @@ -1176,9 +1183,9 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI } //--------------------------------------------------- - //immediately assign bump to a global smart pointer in case some local smart pointer - //accidently releases it. - LLPointer bump = LLViewerTextureManager::getLocalTexture( TRUE); + // immediately assign bump to a global smart pointer in case some local smart pointer + // accidentally releases it. + LLPointer bump = LLViewerTextureManager::getLocalTexture( TRUE ); if (!LLPipeline::sRenderDeferred) { @@ -1187,8 +1194,8 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI } else { - LLPointer nrm_image = new LLImageRaw(src->getWidth(), src->getHeight(), 4); - generateNormalMapFromAlpha(src, nrm_image); + LLPointer nrm_image = new LLImageRaw(dst_image->getWidth(), dst_image->getHeight(), 4); + generateNormalMapFromAlpha(dst_image, nrm_image); bump->setExplicitFormat(GL_RGBA, GL_RGBA); bump->createGLTexture(0, nrm_image); } -- cgit v1.2.3 From 8b7563660c1d2ee7463edd24116a327b3b6553c3 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Fri, 14 May 2010 16:36:39 +0100 Subject: EXT-7154 FIXED revisted: darkness bumpmap looks like lightness bumpmap when deferred rendering is enabled In addition to the previous bugs, the normal-map for *all* bumpmaps was also getting generated with its Y-gradient flipped, causing some odd and inconsistent results. --- indra/newview/lldrawpoolbump.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index a3b236fcb9..3c26809259 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -93,6 +93,12 @@ void LLStandardBumpmap::shutdown() // static void LLStandardBumpmap::restoreGL() +{ + addstandard(); +} + +// static +void LLStandardBumpmap::addstandard() { llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 ); gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("None"); // BE_NO_BUMP @@ -156,7 +162,7 @@ void LLStandardBumpmap::restoreGL() } // static -void LLStandardBumpmap::destroyGL() +void LLStandardBumpmap::clear() { for( U32 i = 0; i < LLStandardBumpmap::sStandardBumpmapCount; i++ ) { @@ -166,6 +172,12 @@ void LLStandardBumpmap::destroyGL() sStandardBumpmapCount = 0; } +// static +void LLStandardBumpmap::destroyGL() +{ + clear(); +} + //////////////////////////////////////////////////////////////// @@ -1044,8 +1056,8 @@ void LLBumpImageList::generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nr LLVector3 right = LLVector3(norm_scale, 0, (F32) src_data[(j*resX+rX)*src_cmp+src_cmp-1]-cH); LLVector3 left = LLVector3(-norm_scale, 0, (F32) src_data[(j*resX+lX)*src_cmp+src_cmp-1]-cH); - LLVector3 up = LLVector3(0, -norm_scale, (F32) src_data[(rY*resX+i)*src_cmp+src_cmp-1]-cH); - LLVector3 down = LLVector3(0, norm_scale, (F32) src_data[(lY*resX+i)*src_cmp+src_cmp-1]-cH); + LLVector3 up = LLVector3(0, -norm_scale, (F32) src_data[(lY*resX+i)*src_cmp+src_cmp-1]-cH); + LLVector3 down = LLVector3(0, norm_scale, (F32) src_data[(rY*resX+i)*src_cmp+src_cmp-1]-cH); LLVector3 norm = right%down + down%left + left%up + up%right; @@ -1155,11 +1167,8 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI F32 twice_one_over_range = 2.f / (maximum - minimum); S32 i; - bool bump_polarity_negative = LLPipeline::sRenderDeferred ? - (BE_BRIGHTNESS == bump_code) : (BE_DARKNESS == bump_code); // deferred mode likes its normal map values inverted - const F32 ARTIFICIAL_SCALE = 2.f; // Advantage: exaggerates the effect in midrange. Disadvantage: clamps at the extremes. - if (bump_polarity_negative) + if (BE_DARKNESS == bump_code) { for( i = minimum; i <= maximum; i++ ) { -- cgit v1.2.3 From bcccf045845bbf7fa730226017bf9041e2cba9b3 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Fri, 21 May 2010 16:09:22 +0100 Subject: Avoid potentially loading the standard bumpmap list twice during startup. (transplanted from 6dfc8d6ec39f6f3af4495c27546054f311b884af) --- indra/newview/lldrawpoolbump.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 3c26809259..eefb93dc0c 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -82,7 +82,7 @@ static S32 bump_channel = -1; // static void LLStandardBumpmap::init() { - LLStandardBumpmap::restoreGL(); + // do nothing } // static @@ -835,6 +835,8 @@ void LLBumpImageList::clear() // these will be re-populated on-demand mBrightnessEntries.clear(); mDarknessEntries.clear(); + + LLStandardBumpmap::clear(); } void LLBumpImageList::shutdown() @@ -851,8 +853,8 @@ void LLBumpImageList::destroyGL() void LLBumpImageList::restoreGL() { - // Images will be recreated as they are needed. LLStandardBumpmap::restoreGL(); + // Images will be recreated as they are needed. } -- cgit v1.2.3 From 94bddd2b4450674b9f121a10b97f0846b6a97d87 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 26 May 2010 16:46:55 +0100 Subject: EXT-7479 FIXED only bumpmaps of type Brightness or Darkness load on 2.0.2 (205107) --- indra/newview/lldrawpoolbump.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index eefb93dc0c..4963b95046 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -82,7 +82,7 @@ static S32 bump_channel = -1; // static void LLStandardBumpmap::init() { - // do nothing + LLStandardBumpmap::restoreGL(); } // static -- cgit v1.2.3 From 6387426c990ad32623d57ad7fa190d78b2d5dbb6 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 29 May 2010 06:18:02 +0100 Subject: EXT-7543 FIXED(maybe) - crash in LLRenderPass::pushBatch --- indra/newview/lldrawpoolbump.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 4963b95046..84fbb861ba 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -100,7 +100,10 @@ void LLStandardBumpmap::restoreGL() // static void LLStandardBumpmap::addstandard() { - llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 ); + // can't assert; we destroyGL and restoreGL a lot during *first* startup, which populates this list already, THEN we explicitly init the list as part of *normal* startup. Sigh. So clear the list every time before we (re-)add the standard bumpmaps. + //llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 ); + clear(); + llinfos << "Adding standard bumpmaps." << llendl; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("None"); // BE_NO_BUMP gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Brightness"); // BE_BRIGHTNESS gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Darkness"); // BE_DARKNESS @@ -164,6 +167,7 @@ void LLStandardBumpmap::addstandard() // static void LLStandardBumpmap::clear() { + llinfos << "Clearing standard bumpmaps." << llendl; for( U32 i = 0; i < LLStandardBumpmap::sStandardBumpmapCount; i++ ) { gStandardBumpmapList[i].mLabel.assign(""); @@ -817,7 +821,7 @@ void LLDrawPoolBump::renderPostDeferred(S32 pass) } //////////////////////////////////////////////////////////////// -// List of one-component bump-maps created from other texures. +// List of bump-maps created from other textures. //const LLUUID TEST_BUMP_ID("3d33eaf2-459c-6f97-fd76-5fce3fc29447"); @@ -832,6 +836,7 @@ void LLBumpImageList::init() void LLBumpImageList::clear() { + llinfos << "Clearing dynamic bumpmaps." << llendl; // these will be re-populated on-demand mBrightnessEntries.clear(); mDarknessEntries.clear(); -- cgit v1.2.3 From 06b0d72efa96b6a0ed665f7cd46f358c48929e7b Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 13 Aug 2010 07:24:57 -0400 Subject: Change license from GPL to LGPL (version 2.1) --- indra/newview/lldrawpoolbump.cpp | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index c206daf89b..7c09826c9d 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -2,31 +2,25 @@ * @file lldrawpoolbump.cpp * @brief LLDrawPoolBump class implementation * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ -- cgit v1.2.3 From 98cc2365034a93c69704daa69efb389799cc9627 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Tue, 24 Aug 2010 18:44:39 +0100 Subject: Backed out changeset a62bf7c0af21 Backing out this merge that I pushed (prematurely) to the wrong place. --- indra/newview/lldrawpoolbump.cpp | 116 ++++++++++----------------------------- 1 file changed, 28 insertions(+), 88 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 223e4a438c..7c09826c9d 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -88,16 +88,7 @@ void LLStandardBumpmap::shutdown() // static void LLStandardBumpmap::restoreGL() { - addstandard(); -} - -// static -void LLStandardBumpmap::addstandard() -{ - // can't assert; we destroyGL and restoreGL a lot during *first* startup, which populates this list already, THEN we explicitly init the list as part of *normal* startup. Sigh. So clear the list every time before we (re-)add the standard bumpmaps. - //llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 ); - clear(); - llinfos << "Adding standard bumpmaps." << llendl; + llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 ); gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("None"); // BE_NO_BUMP gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Brightness"); // BE_BRIGHTNESS gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Darkness"); // BE_DARKNESS @@ -160,9 +151,8 @@ void LLStandardBumpmap::addstandard() } // static -void LLStandardBumpmap::clear() +void LLStandardBumpmap::destroyGL() { - llinfos << "Clearing standard bumpmaps." << llendl; for( U32 i = 0; i < LLStandardBumpmap::sStandardBumpmapCount; i++ ) { gStandardBumpmapList[i].mLabel.assign(""); @@ -171,12 +161,6 @@ void LLStandardBumpmap::clear() sStandardBumpmapCount = 0; } -// static -void LLStandardBumpmap::destroyGL() -{ - clear(); -} - //////////////////////////////////////////////////////////////// @@ -629,9 +613,9 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel) } //static -void LLDrawPoolBump::beginBump(U32 pass) +void LLDrawPoolBump::beginBump() { - if (!gPipeline.hasRenderBatches(pass)) + if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP)) { return; } @@ -674,9 +658,9 @@ void LLDrawPoolBump::beginBump(U32 pass) } //static -void LLDrawPoolBump::renderBump(U32 pass) +void LLDrawPoolBump::renderBump() { - if (!gPipeline.hasRenderBatches(pass)) + if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP)) { return; } @@ -689,13 +673,13 @@ void LLDrawPoolBump::renderBump(U32 pass) /// Get rid of z-fighting with non-bump pass. LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1.0f, -1.0f); - renderBump(pass, sVertexMask); + renderBump(LLRenderPass::PASS_BUMP, sVertexMask); } //static -void LLDrawPoolBump::endBump(U32 pass) +void LLDrawPoolBump::endBump() { - if (!gPipeline.hasRenderBatches(pass)) + if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP)) { return; } @@ -712,18 +696,6 @@ void LLDrawPoolBump::endBump(U32 pass) gGL.setSceneBlendType(LLRender::BT_ALPHA); } -S32 LLDrawPoolBump::getNumDeferredPasses() -{ - if (gSavedSettings.getBOOL("RenderObjectBump")) - { - return 1; - } - else - { - return 0; - } -} - void LLDrawPoolBump::beginDeferredPass(S32 pass) { if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP)) @@ -778,45 +750,21 @@ void LLDrawPoolBump::renderDeferred(S32 pass) void LLDrawPoolBump::beginPostDeferredPass(S32 pass) { - switch (pass) - { - case 0: - beginFullbrightShiny(); - break; - case 1: - beginBump(LLRenderPass::PASS_POST_BUMP); - break; - } + beginFullbrightShiny(); } void LLDrawPoolBump::endPostDeferredPass(S32 pass) { - switch (pass) - { - case 0: - endFullbrightShiny(); - break; - case 1: - endBump(LLRenderPass::PASS_POST_BUMP); - break; - } + endFullbrightShiny(); } void LLDrawPoolBump::renderPostDeferred(S32 pass) { - switch (pass) - { - case 0: - renderFullbrightShiny(); - break; - case 1: - renderBump(LLRenderPass::PASS_POST_BUMP); - break; - } + renderFullbrightShiny(); } //////////////////////////////////////////////////////////////// -// List of bump-maps created from other textures. +// List of one-component bump-maps created from other texures. //const LLUUID TEST_BUMP_ID("3d33eaf2-459c-6f97-fd76-5fce3fc29447"); @@ -829,32 +777,24 @@ void LLBumpImageList::init() LLStandardBumpmap::init(); } -void LLBumpImageList::clear() +void LLBumpImageList::shutdown() { - llinfos << "Clearing dynamic bumpmaps." << llendl; - // these will be re-populated on-demand mBrightnessEntries.clear(); mDarknessEntries.clear(); - - LLStandardBumpmap::clear(); -} - -void LLBumpImageList::shutdown() -{ - clear(); LLStandardBumpmap::shutdown(); } void LLBumpImageList::destroyGL() { - clear(); + mBrightnessEntries.clear(); + mDarknessEntries.clear(); LLStandardBumpmap::destroyGL(); } void LLBumpImageList::restoreGL() { - LLStandardBumpmap::restoreGL(); // Images will be recreated as they are needed. + LLStandardBumpmap::restoreGL(); } @@ -906,7 +846,6 @@ void LLBumpImageList::updateImages() } } } - for (bump_image_map_t::iterator iter = mDarknessEntries.begin(); iter != mDarknessEntries.end(); ) { bump_image_map_t::iterator curiter = iter++; @@ -1059,8 +998,8 @@ void LLBumpImageList::generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nr LLVector3 right = LLVector3(norm_scale, 0, (F32) src_data[(j*resX+rX)*src_cmp+src_cmp-1]-cH); LLVector3 left = LLVector3(-norm_scale, 0, (F32) src_data[(j*resX+lX)*src_cmp+src_cmp-1]-cH); - LLVector3 up = LLVector3(0, -norm_scale, (F32) src_data[(lY*resX+i)*src_cmp+src_cmp-1]-cH); - LLVector3 down = LLVector3(0, norm_scale, (F32) src_data[(rY*resX+i)*src_cmp+src_cmp-1]-cH); + LLVector3 up = LLVector3(0, -norm_scale, (F32) src_data[(rY*resX+i)*src_cmp+src_cmp-1]-cH); + LLVector3 down = LLVector3(0, norm_scale, (F32) src_data[(lY*resX+i)*src_cmp+src_cmp-1]-cH); LLVector3 norm = right%down + down%left + left%up + up%right; @@ -1085,7 +1024,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI { bump_image_map_t& entries_list(bump_code == BE_BRIGHTNESS ? gBumpImageList.mBrightnessEntries : gBumpImageList.mDarknessEntries ); bump_image_map_t::iterator iter = entries_list.find(source_asset_id); - if (iter != entries_list.end()) // bump not cached yet + if (iter != entries_list.end()) { LLPointer dst_image = new LLImageRaw(src->getWidth(), src->getHeight(), 1); U8* dst_data = dst_image->getData(); @@ -1170,8 +1109,8 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI F32 twice_one_over_range = 2.f / (maximum - minimum); S32 i; - const F32 ARTIFICIAL_SCALE = 2.f; // Advantage: exaggerates the effect in midrange. Disadvantage: clamps at the extremes. - if (BE_DARKNESS == bump_code) + const F32 ARTIFICIAL_SCALE = 2.f; // Advantage: exagerates the effect in midrange. Disadvantage: clamps at the extremes. + if( BE_DARKNESS == bump_code ) { for( i = minimum; i <= maximum; i++ ) { @@ -1181,6 +1120,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI } else { + // BE_LIGHTNESS for( i = minimum; i <= maximum; i++ ) { F32 minus_one_to_one = F32(i - minimum) * twice_one_over_range - 1.f; @@ -1195,9 +1135,9 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI } //--------------------------------------------------- - // immediately assign bump to a global smart pointer in case some local smart pointer - // accidentally releases it. - LLPointer bump = LLViewerTextureManager::getLocalTexture( TRUE ); + //immediately assign bump to a global smart pointer in case some local smart pointer + //accidently releases it. + LLPointer bump = LLViewerTextureManager::getLocalTexture( TRUE); if (!LLPipeline::sRenderDeferred) { @@ -1206,8 +1146,8 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI } else { - LLPointer nrm_image = new LLImageRaw(dst_image->getWidth(), dst_image->getHeight(), 4); - generateNormalMapFromAlpha(dst_image, nrm_image); + LLPointer nrm_image = new LLImageRaw(src->getWidth(), src->getHeight(), 4); + generateNormalMapFromAlpha(src, nrm_image); bump->setExplicitFormat(GL_RGBA, GL_RGBA); bump->createGLTexture(0, nrm_image); } -- cgit v1.2.3 From 57c84c639781a9a6e1646db7cc38530400f0d22c Mon Sep 17 00:00:00 2001 From: Palmer Date: Fri, 26 Mar 2010 13:55:35 -0700 Subject: Davep's LLDrawPoolBump changes from svn/linden/branches/viewer-mesh @ 114046 for deferred rendering --- indra/newview/lldrawpoolbump.cpp | 61 ++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 21 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 7c09826c9d..a4a8dc80b5 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -2,25 +2,31 @@ * @file lldrawpoolbump.cpp * @brief LLDrawPoolBump class implementation * - * $LicenseInfo:firstyear=2003&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * $LicenseInfo:firstyear=2003&license=viewergpl$ + * + * Copyright (c) 2003-2009, Linden Research, Inc. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -141,9 +147,8 @@ void LLStandardBumpmap::restoreGL() LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, - 0); - gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLViewerTexture::BOOST_BUMP) ; - gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL ); + 0); + gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL ); LLStandardBumpmap::sStandardBumpmapCount++; } @@ -696,6 +701,18 @@ void LLDrawPoolBump::endBump() gGL.setSceneBlendType(LLRender::BT_ALPHA); } +S32 LLDrawPoolBump::getNumDeferredPasses() +{ + if (gSavedSettings.getBOOL("RenderObjectBump")) + { + return 1; + } + else + { + return 0; + } +} + void LLDrawPoolBump::beginDeferredPass(S32 pass) { if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP)) @@ -812,7 +829,7 @@ void LLBumpImageList::addTextureStats(U8 bump, const LLUUID& base_image_id, F32 bump &= TEM_BUMP_MASK; LLViewerFetchedTexture* bump_image = gStandardBumpmapList[bump].mImage; if( bump_image ) - { + { bump_image->addTextureStats(virtual_size); } } @@ -820,6 +837,7 @@ void LLBumpImageList::addTextureStats(U8 bump, const LLUUID& base_image_id, F32 void LLBumpImageList::updateImages() { + llpushcallstacks ; for (bump_image_map_t::iterator iter = mBrightnessEntries.begin(); iter != mBrightnessEntries.end(); ) { bump_image_map_t::iterator curiter = iter++; @@ -846,6 +864,7 @@ void LLBumpImageList::updateImages() } } } + llpushcallstacks ; for (bump_image_map_t::iterator iter = mDarknessEntries.begin(); iter != mDarknessEntries.end(); ) { bump_image_map_t::iterator curiter = iter++; @@ -872,6 +891,7 @@ void LLBumpImageList::updateImages() } } } + llpushcallstacks ; } @@ -916,8 +936,7 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText (*entries_list)[src_image->getID()]->setExplicitFormat(GL_ALPHA8, GL_ALPHA); // Note: this may create an LLImageGL immediately - src_image->setBoostLevel(LLViewerTexture::BOOST_BUMP) ; - src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL ); + src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()) ); bump = (*entries_list)[src_image->getID()]; // In case callback was called immediately and replaced the image // bump_total++; -- cgit v1.2.3 From 4ffac619945cafc9c7da357bf56c9bc92e318b1b Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 4 Mar 2010 15:30:15 -0600 Subject: Optimiziation pass. Added RenderUseStreamVBO to enable/disable usage of VBO's for streaming buffers. Faster traversal of LLCullResult members. Removal of llpushcallstacks from inner loops. Sprinkling in fast timers. --- indra/newview/lldrawpoolbump.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index a4a8dc80b5..8f3e775976 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -837,7 +837,6 @@ void LLBumpImageList::addTextureStats(U8 bump, const LLUUID& base_image_id, F32 void LLBumpImageList::updateImages() { - llpushcallstacks ; for (bump_image_map_t::iterator iter = mBrightnessEntries.begin(); iter != mBrightnessEntries.end(); ) { bump_image_map_t::iterator curiter = iter++; @@ -864,7 +863,7 @@ void LLBumpImageList::updateImages() } } } - llpushcallstacks ; + for (bump_image_map_t::iterator iter = mDarknessEntries.begin(); iter != mDarknessEntries.end(); ) { bump_image_map_t::iterator curiter = iter++; @@ -891,7 +890,6 @@ void LLBumpImageList::updateImages() } } } - llpushcallstacks ; } -- cgit v1.2.3 From 6c086be01659a0d23a91bf6e3ea07bafd86c4dd7 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 12 May 2010 03:59:01 -0500 Subject: Fix for fullbright bump not working in deferred render. Fix for shadow artifacts around split frusta. Tweak for shadow aliasing with projectors. Fix for crash on exit in mesh thread. (transplanted from 6dcf09cd3e524016c8130a0c8af3d9fc95f2d411) --- indra/newview/lldrawpoolbump.cpp | 44 +++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 10 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 8f3e775976..08c9f7fe15 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -618,9 +618,9 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel) } //static -void LLDrawPoolBump::beginBump() +void LLDrawPoolBump::beginBump(U32 pass) { - if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP)) + if (!gPipeline.hasRenderBatches(pass)) { return; } @@ -663,9 +663,9 @@ void LLDrawPoolBump::beginBump() } //static -void LLDrawPoolBump::renderBump() +void LLDrawPoolBump::renderBump(U32 pass) { - if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP)) + if (!gPipeline.hasRenderBatches(pass)) { return; } @@ -678,13 +678,13 @@ void LLDrawPoolBump::renderBump() /// Get rid of z-fighting with non-bump pass. LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1.0f, -1.0f); - renderBump(LLRenderPass::PASS_BUMP, sVertexMask); + renderBump(pass, sVertexMask); } //static -void LLDrawPoolBump::endBump() +void LLDrawPoolBump::endBump(U32 pass) { - if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP)) + if (!gPipeline.hasRenderBatches(pass)) { return; } @@ -767,17 +767,41 @@ void LLDrawPoolBump::renderDeferred(S32 pass) void LLDrawPoolBump::beginPostDeferredPass(S32 pass) { - beginFullbrightShiny(); + switch (pass) + { + case 0: + beginFullbrightShiny(); + break; + case 1: + beginBump(LLRenderPass::PASS_POST_BUMP); + break; + } } void LLDrawPoolBump::endPostDeferredPass(S32 pass) { - endFullbrightShiny(); + switch (pass) + { + case 0: + endFullbrightShiny(); + break; + case 1: + endBump(LLRenderPass::PASS_POST_BUMP); + break; + } } void LLDrawPoolBump::renderPostDeferred(S32 pass) { - renderFullbrightShiny(); + switch (pass) + { + case 0: + renderFullbrightShiny(); + break; + case 1: + renderBump(LLRenderPass::PASS_POST_BUMP); + break; + } } //////////////////////////////////////////////////////////////// -- cgit v1.2.3 From 379ca3c30830f6060637173147269dc0b2b58d27 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 12 May 2010 19:35:02 +0100 Subject: EXT-7154 : FIXED : darkness bumpmap looks like lightness bumpmap when deferred rendering is enabled --- indra/newview/lldrawpoolbump.cpp | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 08c9f7fe15..a3b236fcb9 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -818,17 +818,22 @@ void LLBumpImageList::init() LLStandardBumpmap::init(); } -void LLBumpImageList::shutdown() +void LLBumpImageList::clear() { + // these will be re-populated on-demand mBrightnessEntries.clear(); mDarknessEntries.clear(); +} + +void LLBumpImageList::shutdown() +{ + clear(); LLStandardBumpmap::shutdown(); } void LLBumpImageList::destroyGL() { - mBrightnessEntries.clear(); - mDarknessEntries.clear(); + clear(); LLStandardBumpmap::destroyGL(); } @@ -1065,7 +1070,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI { bump_image_map_t& entries_list(bump_code == BE_BRIGHTNESS ? gBumpImageList.mBrightnessEntries : gBumpImageList.mDarknessEntries ); bump_image_map_t::iterator iter = entries_list.find(source_asset_id); - if (iter != entries_list.end()) + if (iter != entries_list.end()) // bump not cached yet { LLPointer dst_image = new LLImageRaw(src->getWidth(), src->getHeight(), 1); U8* dst_data = dst_image->getData(); @@ -1150,8 +1155,11 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI F32 twice_one_over_range = 2.f / (maximum - minimum); S32 i; - const F32 ARTIFICIAL_SCALE = 2.f; // Advantage: exagerates the effect in midrange. Disadvantage: clamps at the extremes. - if( BE_DARKNESS == bump_code ) + bool bump_polarity_negative = LLPipeline::sRenderDeferred ? + (BE_BRIGHTNESS == bump_code) : (BE_DARKNESS == bump_code); // deferred mode likes its normal map values inverted + + const F32 ARTIFICIAL_SCALE = 2.f; // Advantage: exaggerates the effect in midrange. Disadvantage: clamps at the extremes. + if (bump_polarity_negative) { for( i = minimum; i <= maximum; i++ ) { @@ -1161,7 +1169,6 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI } else { - // BE_LIGHTNESS for( i = minimum; i <= maximum; i++ ) { F32 minus_one_to_one = F32(i - minimum) * twice_one_over_range - 1.f; @@ -1176,9 +1183,9 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI } //--------------------------------------------------- - //immediately assign bump to a global smart pointer in case some local smart pointer - //accidently releases it. - LLPointer bump = LLViewerTextureManager::getLocalTexture( TRUE); + // immediately assign bump to a global smart pointer in case some local smart pointer + // accidentally releases it. + LLPointer bump = LLViewerTextureManager::getLocalTexture( TRUE ); if (!LLPipeline::sRenderDeferred) { @@ -1187,8 +1194,8 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI } else { - LLPointer nrm_image = new LLImageRaw(src->getWidth(), src->getHeight(), 4); - generateNormalMapFromAlpha(src, nrm_image); + LLPointer nrm_image = new LLImageRaw(dst_image->getWidth(), dst_image->getHeight(), 4); + generateNormalMapFromAlpha(dst_image, nrm_image); bump->setExplicitFormat(GL_RGBA, GL_RGBA); bump->createGLTexture(0, nrm_image); } -- cgit v1.2.3 From ff7e83c3aa26bbaa380305a97dffbf22c0f7a747 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Fri, 14 May 2010 16:36:39 +0100 Subject: EXT-7154 FIXED revisted: darkness bumpmap looks like lightness bumpmap when deferred rendering is enabled In addition to the previous bugs, the normal-map for *all* bumpmaps was also getting generated with its Y-gradient flipped, causing some odd and inconsistent results. --- indra/newview/lldrawpoolbump.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index a3b236fcb9..3c26809259 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -93,6 +93,12 @@ void LLStandardBumpmap::shutdown() // static void LLStandardBumpmap::restoreGL() +{ + addstandard(); +} + +// static +void LLStandardBumpmap::addstandard() { llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 ); gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("None"); // BE_NO_BUMP @@ -156,7 +162,7 @@ void LLStandardBumpmap::restoreGL() } // static -void LLStandardBumpmap::destroyGL() +void LLStandardBumpmap::clear() { for( U32 i = 0; i < LLStandardBumpmap::sStandardBumpmapCount; i++ ) { @@ -166,6 +172,12 @@ void LLStandardBumpmap::destroyGL() sStandardBumpmapCount = 0; } +// static +void LLStandardBumpmap::destroyGL() +{ + clear(); +} + //////////////////////////////////////////////////////////////// @@ -1044,8 +1056,8 @@ void LLBumpImageList::generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nr LLVector3 right = LLVector3(norm_scale, 0, (F32) src_data[(j*resX+rX)*src_cmp+src_cmp-1]-cH); LLVector3 left = LLVector3(-norm_scale, 0, (F32) src_data[(j*resX+lX)*src_cmp+src_cmp-1]-cH); - LLVector3 up = LLVector3(0, -norm_scale, (F32) src_data[(rY*resX+i)*src_cmp+src_cmp-1]-cH); - LLVector3 down = LLVector3(0, norm_scale, (F32) src_data[(lY*resX+i)*src_cmp+src_cmp-1]-cH); + LLVector3 up = LLVector3(0, -norm_scale, (F32) src_data[(lY*resX+i)*src_cmp+src_cmp-1]-cH); + LLVector3 down = LLVector3(0, norm_scale, (F32) src_data[(rY*resX+i)*src_cmp+src_cmp-1]-cH); LLVector3 norm = right%down + down%left + left%up + up%right; @@ -1155,11 +1167,8 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI F32 twice_one_over_range = 2.f / (maximum - minimum); S32 i; - bool bump_polarity_negative = LLPipeline::sRenderDeferred ? - (BE_BRIGHTNESS == bump_code) : (BE_DARKNESS == bump_code); // deferred mode likes its normal map values inverted - const F32 ARTIFICIAL_SCALE = 2.f; // Advantage: exaggerates the effect in midrange. Disadvantage: clamps at the extremes. - if (bump_polarity_negative) + if (BE_DARKNESS == bump_code) { for( i = minimum; i <= maximum; i++ ) { -- cgit v1.2.3 From 3008d5790d77af740847f1b39dedc117574cce60 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Fri, 21 May 2010 16:09:22 +0100 Subject: Avoid potentially loading the standard bumpmap list twice during startup. (transplanted from 6dfc8d6ec39f6f3af4495c27546054f311b884af) --- indra/newview/lldrawpoolbump.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 3c26809259..eefb93dc0c 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -82,7 +82,7 @@ static S32 bump_channel = -1; // static void LLStandardBumpmap::init() { - LLStandardBumpmap::restoreGL(); + // do nothing } // static @@ -835,6 +835,8 @@ void LLBumpImageList::clear() // these will be re-populated on-demand mBrightnessEntries.clear(); mDarknessEntries.clear(); + + LLStandardBumpmap::clear(); } void LLBumpImageList::shutdown() @@ -851,8 +853,8 @@ void LLBumpImageList::destroyGL() void LLBumpImageList::restoreGL() { - // Images will be recreated as they are needed. LLStandardBumpmap::restoreGL(); + // Images will be recreated as they are needed. } -- cgit v1.2.3 From d0a6165713aa94654f7948151c6fbbe0a7d315f2 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 26 May 2010 16:46:55 +0100 Subject: EXT-7479 FIXED only bumpmaps of type Brightness or Darkness load on 2.0.2 (205107) --- indra/newview/lldrawpoolbump.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index eefb93dc0c..4963b95046 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -82,7 +82,7 @@ static S32 bump_channel = -1; // static void LLStandardBumpmap::init() { - // do nothing + LLStandardBumpmap::restoreGL(); } // static -- cgit v1.2.3 From 383d695fe6d14ba988820475e0cc9b64e18b7de5 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 29 May 2010 06:18:02 +0100 Subject: EXT-7543 FIXED(maybe) - crash in LLRenderPass::pushBatch --- indra/newview/lldrawpoolbump.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview/lldrawpoolbump.cpp') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 4963b95046..84fbb861ba 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -100,7 +100,10 @@ void LLStandardBumpmap::restoreGL() // static void LLStandardBumpmap::addstandard() { - llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 ); + // can't assert; we destroyGL and restoreGL a lot during *first* startup, which populates this list already, THEN we explicitly init the list as part of *normal* startup. Sigh. So clear the list every time before we (re-)add the standard bumpmaps. + //llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 ); + clear(); + llinfos << "Adding standard bumpmaps." << llendl; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("None"); // BE_NO_BUMP gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Brightness"); // BE_BRIGHTNESS gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Darkness"); // BE_DARKNESS @@ -164,6 +167,7 @@ void LLStandardBumpmap::addstandard() // static void LLStandardBumpmap::clear() { + llinfos << "Clearing standard bumpmaps." << llendl; for( U32 i = 0; i < LLStandardBumpmap::sStandardBumpmapCount; i++ ) { gStandardBumpmapList[i].mLabel.assign(""); @@ -817,7 +821,7 @@ void LLDrawPoolBump::renderPostDeferred(S32 pass) } //////////////////////////////////////////////////////////////// -// List of one-component bump-maps created from other texures. +// List of bump-maps created from other textures. //const LLUUID TEST_BUMP_ID("3d33eaf2-459c-6f97-fd76-5fce3fc29447"); @@ -832,6 +836,7 @@ void LLBumpImageList::init() void LLBumpImageList::clear() { + llinfos << "Clearing dynamic bumpmaps." << llendl; // these will be re-populated on-demand mBrightnessEntries.clear(); mDarknessEntries.clear(); -- cgit v1.2.3