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