From e76211216dafc82b752bb0b34f1c7670f67f4784 Mon Sep 17 00:00:00 2001 From: Cinders Date: Tue, 4 Dec 2012 20:46:22 -0700 Subject: [PATCH] Fixed FIRE-8417. Also, support for aurora-sim regions with non power of two sizes --- indra/llrender/llimagegl.cpp | 5 +- indra/newview/llpatchvertexarray.cpp | 86 ++++++++++++++++------------ indra/newview/llworld.cpp | 6 +- 3 files changed, 55 insertions(+), 42 deletions(-) diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index e276629034..3daab179da 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -485,7 +485,10 @@ void LLImageGL::setSize(S32 width, S32 height, S32 ncomponents) // Check if dimensions are a power of two! if (!checkSize(width,height)) { - llerrs << llformat("Texture has non power of two dimension: %dx%d",width,height) << llendl; + // FIRE-8063: Don't error out if texture has non power of two dimensions, just warn us + //llerrs << llformat("Texture has non power of two dimension: %dx%d",width,height) << llendl; + llwarns << llformat("Texture has non power of two dimension: %dx%d",width,height) << llendl; + // } if (mTexName) diff --git a/indra/newview/llpatchvertexarray.cpp b/indra/newview/llpatchvertexarray.cpp index dece2928c0..0d40348fd1 100644 --- a/indra/newview/llpatchvertexarray.cpp +++ b/indra/newview/llpatchvertexarray.cpp @@ -75,47 +75,61 @@ void LLPatchVertexArray::create(U32 surface_width, U32 patch_width, F32 meters_p power_of_two *= 2; surface_order += 1; } - - if (power_of_two == (surface_width-1)) - { - mSurfaceWidth = surface_width; - - // Make sure patch_width is a factor of (surface_width - 1) - U32 ratio = (surface_width - 1) / patch_width; - F32 fratio = ((float)(surface_width - 1)) / ((float)(patch_width)); - if ( fratio == (float)(ratio)) - { - // Make sure patch_width is a power of two - power_of_two = 1; - U32 patch_order = 0; - while (power_of_two < patch_width) - { - power_of_two *= 2; - patch_order += 1; - } - if (power_of_two == patch_width) - { - mPatchWidth = patch_width; - mPatchOrder = patch_order; - } - else // patch_width is not a power of two... - { - mPatchWidth = 0; - mPatchOrder = 0; - } - } - else // patch_width is not a factor of (surface_width - 1)... - { - mPatchWidth = 0; - mPatchOrder = 0; - } +// FIRE-8063 - Aurora non power of two regions + //if (power_of_two == (surface_width-1)) + if (power_of_two != (surface_width-1)) + { + surface_width = power_of_two + 1; } - else // surface_width is not a power of two... +// + + mSurfaceWidth = surface_width; + + // Make sure patch_width is a factor of (surface_width - 1) + U32 ratio = (surface_width - 1) / patch_width; + F32 fratio = ((float)(surface_width - 1)) / ((float)(patch_width)); + if ( fratio == (float)(ratio)) + { + // Make sure patch_width is a power of two + power_of_two = 1; + U32 patch_order = 0; + while (power_of_two < patch_width) + { + power_of_two *= 2; + patch_order += 1; + } +// FIRE-8063 - Aurora non power of two regions + //if (power_of_two == patch_width) + if (power_of_two != patch_width) + { + patch_width = power_of_two; + } +// + + mPatchWidth = patch_width; + mPatchOrder = patch_order; + +// FIRE-8063 - Aurora non power of two regions + //else // patch_width is not a power of two... + //{ + // mPatchWidth = 0; + // mPatchOrder = 0; + //} +// + } + else // patch_width is not a factor of (surface_width - 1)... { - mSurfaceWidth = 0; mPatchWidth = 0; mPatchOrder = 0; } +// FIRE-8063 - Aurora non power of two regions + //else // surface_width is not a power of two... + //{ + // mSurfaceWidth = 0; + // mPatchWidth = 0; + // mPatchOrder = 0; + //} +// // PART 2 -- Allocate memory for the render level table if (mPatchWidth > 0) diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 0a9099db98..23924890f4 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -122,10 +122,6 @@ LLWorld::LLWorld() : mDefaultWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE); gGL.getTexUnit(0)->bind(mDefaultWaterTexturep); mDefaultWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); - -// Aurora Sim> - refreshLimits(); -// Aurora Sim> } @@ -664,7 +660,7 @@ LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host, if(dir == NORTH || dir == SOUTH) adj_x += WORLD_PATCH_SIZE; if(dir == EAST || dir == WEST) adj_y += WORLD_PATCH_SIZE; -// Aurora Sim +// Aurora Sim } }