diff --git a/indra/aistatemachine/aistatemachine.h b/indra/aistatemachine/aistatemachine.h index 6e6277e60..7ea285c01 100644 --- a/indra/aistatemachine/aistatemachine.h +++ b/indra/aistatemachine/aistatemachine.h @@ -32,7 +32,7 @@ #define AISTATEMACHINE_H #include "aithreadsafe.h" -#include "llfasttimer.h" +#include "lltimer.h" #include //! @@ -271,7 +271,7 @@ class AIStateMachine { void yield_frame(unsigned int frames) { mSleep = -(S64)frames; } //! Temporarily halt the state machine. - void yield_ms(unsigned int ms) { mSleep = LLFastTimer::getCPUClockCount64() + LLFastTimer::countsPerSecond() * ms / 1000; } + void yield_ms(unsigned int ms) { mSleep = get_clock_count() + calc_clock_frequency() * ms / 1000; } //! Continue running after calling idle. void cont(void) diff --git a/indra/llcommon/llfasttimer_class.cpp b/indra/llcommon/llfasttimer_class.cpp index 5fb9fd580..07ea31a5a 100644 --- a/indra/llcommon/llfasttimer_class.cpp +++ b/indra/llcommon/llfasttimer_class.cpp @@ -182,6 +182,7 @@ std::string LLFastTimer::sLogName = ""; BOOL LLFastTimer::sMetricLog = FALSE; LLMutex* LLFastTimer::sLogLock = NULL; std::queue LLFastTimer::sLogQueue; +const int LLFastTimer::NamedTimer::HISTORY_NUM = 300; #if LL_WINDOWS #define USE_RDTSC 1 @@ -435,16 +436,12 @@ LLFastTimer::NamedTimer::NamedTimer(const std::string& name) mFrameStateIndex = frame_state_list.size(); getFrameStateList().push_back(FrameState(this)); - mCountHistory = new U32[HISTORY_NUM]; - memset(mCountHistory, 0, sizeof(U32) * HISTORY_NUM); - mCallHistory = new U32[HISTORY_NUM]; - memset(mCallHistory, 0, sizeof(U32) * HISTORY_NUM); + mCountHistory.resize(HISTORY_NUM); + mCallHistory.resize(HISTORY_NUM); } LLFastTimer::NamedTimer::~NamedTimer() { - delete[] mCountHistory; - delete[] mCallHistory; } std::string LLFastTimer::NamedTimer::getToolTip(S32 history_idx) @@ -637,10 +634,12 @@ void LLFastTimer::NamedTimer::accumulateTimings() // update timer history int hidx = cur_frame % HISTORY_NUM; + int weight = llmin(100, cur_frame); + timerp->mCountHistory[hidx] = timerp->mTotalTimeCounter; - timerp->mCountAverage = ((U64)timerp->mCountAverage * cur_frame + timerp->mTotalTimeCounter) / (cur_frame+1); + timerp->mCountAverage = ((F64)timerp->mCountAverage * weight + (F64)timerp->mTotalTimeCounter) / (weight+1); timerp->mCallHistory[hidx] = timerp->getFrameState().mCalls; - timerp->mCallAverage = ((U64)timerp->mCallAverage * cur_frame + timerp->getFrameState().mCalls) / (cur_frame+1); + timerp->mCallAverage = ((F64)timerp->mCallAverage * weight + (F64)timerp->getFrameState().mCalls) / (weight+1); } } } @@ -776,8 +775,10 @@ void LLFastTimer::NamedTimer::reset() timer.mCountAverage = 0; timer.mCallAverage = 0; - memset(timer.mCountHistory, 0, sizeof(U32) * HISTORY_NUM); - memset(timer.mCallHistory, 0, sizeof(U32) * HISTORY_NUM); + timer.mCountHistory.clear(); + timer.mCountHistory.resize(HISTORY_NUM); + timer.mCallHistory.clear(); + timer.mCallHistory.resize(HISTORY_NUM); } } @@ -856,7 +857,8 @@ void LLFastTimer::nextFrame() if (!sPauseHistory) { NamedTimer::processTimes(); - sLastFrameIndex = sCurFrameIndex++; + sLastFrameIndex = sCurFrameIndex; + ++sCurFrameIndex; } // get ready for next frame diff --git a/indra/llcommon/llfasttimer_class.h b/indra/llcommon/llfasttimer_class.h index c6a6f59c1..aa1f8ffac 100644 --- a/indra/llcommon/llfasttimer_class.h +++ b/indra/llcommon/llfasttimer_class.h @@ -66,7 +66,7 @@ public: public: ~NamedTimer(); - enum { HISTORY_NUM = 300 }; + static const int HISTORY_NUM; const std::string& getName() const { return mName; } NamedTimer* getParent() const { return mParent; } @@ -82,8 +82,8 @@ public: void setCollapsed(bool collapsed) { mCollapsed = collapsed; } bool getCollapsed() const { return mCollapsed; } - U32 getCountAverage() const; //{ return mCountAverage } - U32 getCallAverage() const; //{ return mCallAverage } + U32 getCountAverage() const; + U32 getCallAverage() const; U32 getHistoricalCount(S32 history_index = 0) const; U32 getHistoricalCalls(S32 history_index = 0) const; @@ -122,11 +122,11 @@ public: U32 mTotalTimeCounter; - U32 mCountAverage; - U32 mCallAverage; + F64 mCountAverage; + F64 mCallAverage; - U32* mCountHistory; - U32* mCallHistory; + std::vector mCountHistory; + std::vector mCallHistory; // tree structure NamedTimer* mParent; // NamedTimer of caller(parent) @@ -258,11 +258,10 @@ public: static CurTimerData sCurTimerData; static std::string sClockType; -public: +private: static U32 getCPUClockCount32(); static U64 getCPUClockCount64(); -private: static S32 sCurFrameIndex; static S32 sLastFrameIndex; static U64 sLastFrameTime; diff --git a/indra/llmath/xform.h b/indra/llmath/xform.h index c7e67bcbf..bae69eb59 100644 --- a/indra/llmath/xform.h +++ b/indra/llmath/xform.h @@ -40,7 +40,7 @@ const F32 MAX_OBJECT_Z = 4096.f; // should match REGION_HEIGHT_METERS, Pre-hav const F32 MIN_OBJECT_Z = -256.f; const F32 DEFAULT_MAX_PRIM_SCALE = 256.f; const F32 DEFAULT_MAX_PRIM_SCALE_NO_MESH = DEFAULT_MAX_PRIM_SCALE; -const F32 MIN_PRIM_SCALE = 0.01f; +//const F32 MIN_PRIM_SCALE = 0.01f; const F32 MAX_PRIM_SCALE = 65536.f; // something very high but not near FLT_MAX class LLXform diff --git a/indra/llrender/llfontbitmapcache.cpp b/indra/llrender/llfontbitmapcache.cpp index f01878642..fa231c9e6 100644 --- a/indra/llrender/llfontbitmapcache.cpp +++ b/indra/llrender/llfontbitmapcache.cpp @@ -64,7 +64,7 @@ void LLFontBitmapCache::init(S32 num_components, LLImageRaw *LLFontBitmapCache::getImageRaw(U32 bitmap_num) const { - if ((bitmap_num < 0) || (bitmap_num >= mImageRawVec.size())) + if (bitmap_num >= mImageRawVec.size()) return NULL; return mImageRawVec[bitmap_num]; @@ -72,7 +72,7 @@ LLImageRaw *LLFontBitmapCache::getImageRaw(U32 bitmap_num) const LLImageGL *LLFontBitmapCache::getImageGL(U32 bitmap_num) const { - if ((bitmap_num < 0) || (bitmap_num >= mImageGLVec.size())) + if (bitmap_num >= mImageGLVec.size()) return NULL; return mImageGLVec[bitmap_num]; diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 42139dfec..dfac4c2af 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -557,7 +557,7 @@ bool LLImageGL::checkSize(S32 width, S32 height) return check_power_of_two(width) && check_power_of_two(height); } -void LLImageGL::setSize(S32 width, S32 height, S32 ncomponents) +void LLImageGL::setSize(S32 width, S32 height, S32 ncomponents, S32 discard_level) { if (width != mWidth || height != mHeight || ncomponents != mComponents) { @@ -590,6 +590,11 @@ void LLImageGL::setSize(S32 width, S32 height, S32 ncomponents) width >>= 1; height >>= 1; } + if(discard_level > 0) + { + mMaxDiscardLevel = llmax(mMaxDiscardLevel, (S8)discard_level); + } + } else { @@ -1254,7 +1259,6 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S llassert(mCurrentDiscardLevel >= 0); discard_level = mCurrentDiscardLevel; } - discard_level = llclamp(discard_level, 0, (S32)mMaxDiscardLevel); // Actual image width/height = raw image width/height * 2^discard_level S32 raw_w = imageraw->getWidth() ; @@ -1263,7 +1267,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S S32 h = raw_h << discard_level; // setSize may call destroyGLTexture if the size does not match - setSize(w, h, imageraw->getComponents()); + setSize(w, h, imageraw->getComponents(), discard_level); if( !mHasExplicitFormat ) { @@ -1323,7 +1327,6 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ llassert(mCurrentDiscardLevel >= 0); discard_level = mCurrentDiscardLevel; } - discard_level = llclamp(discard_level, 0, (S32)mMaxDiscardLevel); if (mTexName != 0 && discard_level == mCurrentDiscardLevel) { @@ -1818,6 +1821,7 @@ void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h) llassert(w%2 == 0); llassert(h%2 == 0); const GLubyte* rowstart = ((const GLubyte*) data_in) + mAlphaOffset; + for (U32 y = 0; y < h; y+=2) { const GLubyte* current = rowstart; diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index a80dd0998..ef9a2ec09 100644 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -100,7 +100,7 @@ protected: public: virtual void dump(); // debugging info to llinfos - void setSize(S32 width, S32 height, S32 ncomponents); + void setSize(S32 width, S32 height, S32 ncomponents, S32 discard_level = -1); void setComponents(S32 ncomponents) { mComponents = (S8)ncomponents ;} void setAllowCompression(bool allow) { mAllowCompression = allow; } diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index c75304957..6454f92d9 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -775,11 +775,8 @@ bool LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth //Restrict to valid sample count { mSamples = samples; - mSamples = llmin(mSamples, (U32)4); //Cap to prevent memory bloat. - mSamples = llmin(mSamples, (U32) gGLManager.mMaxIntegerSamples);//GL_RGBA - - if(depth && !stencil) - mSamples = llmin(mSamples, (U32) gGLManager.mMaxSamples); //GL_DEPTH_COMPONENT16_ARB + //mSamples = llmin(mSamples, (U32)4); //Cap to prevent memory bloat. + mSamples = llmin(mSamples, (U32) gGLManager.mMaxSamples); } if (mSamples <= 1) diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index a120b5d32..2531df4b6 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -679,7 +679,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade vec4 diffuseLookup(vec2 texcoord) { - switch (vary_texture_index)) + switch (vary_texture_index.r)) { case 0: ret = texture2D(tex0, texcoord); break; case 1: ret = texture2D(tex1, texcoord); break; @@ -703,7 +703,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade if (texture_index_channels > 1) { - text[count++] = strdup("VARYING_FLAT int vary_texture_index;\n"); + text[count++] = strdup("VARYING_FLAT ivec4 vary_texture_index;\n"); } text[count++] = strdup("vec4 diffuseLookup(vec2 texcoord)\n"); @@ -721,7 +721,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade { //switches are unreliable on old drivers for (S32 i = 0; i < texture_index_channels; ++i) { - std::string if_string = llformat("\t%sif (vary_texture_index == %d) { return texture2D(tex%d, texcoord); }\n", i > 0 ? "else " : "", i, i); + std::string if_string = llformat("\t%sif (vary_texture_index.r == %d) { return texture2D(tex%d, texcoord); }\n", i > 0 ? "else " : "", i, i); text[count++] = strdup(if_string.c_str()); } text[count++] = strdup("\treturn vec4(1,0,1,1);\n"); @@ -730,13 +730,13 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade else { text[count++] = strdup("\tvec4 ret = vec4(1,0,1,1);\n"); - text[count++] = strdup("\tswitch (vary_texture_index)\n"); + text[count++] = strdup("\tswitch (vary_texture_index.r)\n"); text[count++] = strdup("\t{\n"); //switch body for (S32 i = 0; i < texture_index_channels; ++i) { - std::string case_str = llformat("\t\tcase %d: return texture2D(tex%d, texcoord);\n", i, i); + std::string case_str = llformat("\t\tcase %d: ret = texture2D(tex%d, texcoord); break;\n", i, i); text[count++] = strdup(case_str.c_str()); } diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 896560d4d..bc4c201d9 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1249,7 +1249,7 @@ void LLVertexBuffer::setupVertexArray() 1, //TYPE_WEIGHT, 4, //TYPE_WEIGHT4, 4, //TYPE_CLOTHWEIGHT, - 1, //TYPE_TEXTURE_INDEX + 4, //TYPE_TEXTURE_INDEX }; U32 attrib_type[] = @@ -1266,7 +1266,7 @@ void LLVertexBuffer::setupVertexArray() GL_FLOAT, //TYPE_WEIGHT, GL_FLOAT, //TYPE_WEIGHT4, GL_FLOAT, //TYPE_CLOTHWEIGHT, - GL_UNSIGNED_INT, //TYPE_TEXTURE_INDEX + GL_UNSIGNED_BYTE, //TYPE_TEXTURE_INDEX }; bool attrib_integer[] = @@ -2313,7 +2313,7 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) #if !LL_DARWIN S32 loc = TYPE_TEXTURE_INDEX; void *ptr = (void*) (base + mOffsets[TYPE_VERTEX] + 12); - glVertexAttribIPointer(loc, 1, GL_UNSIGNED_INT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); + glVertexAttribIPointer(loc, 4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); #endif } if (data_mask & MAP_VERTEX) diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index cfd3d76ea..70c6f771f 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -387,6 +387,8 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, mhDC = NULL; mhRC = NULL; + llinfos<<"Desired FSAA Samples = "<setCallbacks(callbacks); @@ -1274,21 +1276,155 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO LL_INFOS("Window") << "pixel formats done." << llendl ; - S32 swap_method = 0; - S32 cur_format = num_formats-1; - GLint swap_query = WGL_SWAP_METHOD_ARB; - - BOOL found_format = FALSE; - - while (!found_format && wglGetPixelFormatAttribivARB(mhDC, pixel_format, 0, 1, &swap_query, &swap_method)) + /*for(int i = 0; i <= num_formats-1; ++i) { - if (swap_method == WGL_SWAP_UNDEFINED_ARB || cur_format <= 0) + GLint query[] = { WGL_SAMPLE_BUFFERS_ARB, + WGL_SAMPLES_ARB, + WGL_NUMBER_PIXEL_FORMATS_ARB, + WGL_DRAW_TO_WINDOW_ARB, + WGL_DRAW_TO_BITMAP_ARB, + WGL_ACCELERATION_ARB, + WGL_NEED_PALETTE_ARB, + WGL_NEED_SYSTEM_PALETTE_ARB, + WGL_SWAP_LAYER_BUFFERS_ARB, + WGL_SWAP_METHOD_ARB, + WGL_NUMBER_OVERLAYS_ARB, + WGL_NUMBER_UNDERLAYS_ARB, + WGL_TRANSPARENT_ARB, + WGL_TRANSPARENT_RED_VALUE_ARB, + WGL_TRANSPARENT_GREEN_VALUE_ARB, + WGL_TRANSPARENT_BLUE_VALUE_ARB, + WGL_TRANSPARENT_ALPHA_VALUE_ARB, + WGL_TRANSPARENT_INDEX_VALUE_ARB, + WGL_SHARE_DEPTH_ARB, + WGL_SHARE_STENCIL_ARB, + WGL_SHARE_ACCUM_ARB, + WGL_SUPPORT_GDI_ARB, + WGL_SUPPORT_OPENGL_ARB, + WGL_DOUBLE_BUFFER_ARB, + WGL_STEREO_ARB, + WGL_PIXEL_TYPE_ARB, + WGL_COLOR_BITS_ARB, + WGL_RED_BITS_ARB, + WGL_RED_SHIFT_ARB, + WGL_GREEN_BITS_ARB, + WGL_GREEN_SHIFT_ARB, + WGL_BLUE_BITS_ARB, + WGL_BLUE_SHIFT_ARB, + WGL_ALPHA_BITS_ARB, + WGL_ALPHA_SHIFT_ARB, + WGL_ACCUM_BITS_ARB, + WGL_ACCUM_RED_BITS_ARB, + WGL_ACCUM_GREEN_BITS_ARB, + WGL_ACCUM_BLUE_BITS_ARB, + WGL_ACCUM_ALPHA_BITS_ARB, + WGL_DEPTH_BITS_ARB, + WGL_STENCIL_BITS_ARB, + WGL_AUX_BUFFERS_ARB}; + std::string names[] = { "WGL_SAMPLE_BUFFERS_ARB", + "WGL_SAMPLES_ARB", + "WGL_NUMBER_PIXEL_FORMATS_ARB", + "WGL_DRAW_TO_WINDOW_ARB", + "WGL_DRAW_TO_BITMAP_ARB", + "WGL_ACCELERATION_ARB", + "WGL_NEED_PALETTE_ARB", + "WGL_NEED_SYSTEM_PALETTE_ARB", + "WGL_SWAP_LAYER_BUFFERS_ARB", + "WGL_SWAP_METHOD_ARB", + "WGL_NUMBER_OVERLAYS_ARB", + "WGL_NUMBER_UNDERLAYS_ARB", + "WGL_TRANSPARENT_ARB", + "WGL_TRANSPARENT_RED_VALUE_ARB", + "WGL_TRANSPARENT_GREEN_VALUE_ARB", + "WGL_TRANSPARENT_BLUE_VALUE_ARB", + "WGL_TRANSPARENT_ALPHA_VALUE_ARB", + "WGL_TRANSPARENT_INDEX_VALUE_ARB", + "WGL_SHARE_DEPTH_ARB", + "WGL_SHARE_STENCIL_ARB", + "WGL_SHARE_ACCUM_ARB", + "WGL_SUPPORT_GDI_ARB", + "WGL_SUPPORT_OPENGL_ARB", + "WGL_DOUBLE_BUFFER_ARB", + "WGL_STEREO_ARB", + "WGL_PIXEL_TYPE_ARB", + "WGL_COLOR_BITS_ARB", + "WGL_RED_BITS_ARB", + "WGL_RED_SHIFT_ARB", + "WGL_GREEN_BITS_ARB", + "WGL_GREEN_SHIFT_ARB", + "WGL_BLUE_BITS_ARB", + "WGL_BLUE_SHIFT_ARB", + "WGL_ALPHA_BITS_ARB", + "WGL_ALPHA_SHIFT_ARB", + "WGL_ACCUM_BITS_ARB", + "WGL_ACCUM_RED_BITS_ARB", + "WGL_ACCUM_GREEN_BITS_ARB", + "WGL_ACCUM_BLUE_BITS_ARB", + "WGL_ACCUM_ALPHA_BITS_ARB", + "WGL_DEPTH_BITS_ARB", + "WGL_STENCIL_BITS_ARB", + "WGL_AUX_BUFFERS_ARB"}; + S32 results[sizeof(query)/sizeof(query[0])]={0}; + + if(wglGetPixelFormatAttribivARB(mhDC, pixel_formats[i], 0, sizeof(query)/sizeof(query[0]), query, results)) { + llinfos << i << ":" << llendl; + for(int j = 0; j < sizeof(query)/sizeof(query[0]); ++j) + { + switch(results[j]) + { + case WGL_NO_ACCELERATION_ARB: + llinfos << " " << names[j] << " = " << "WGL_NO_ACCELERATION_ARB" << llendl; + break; + case WGL_GENERIC_ACCELERATION_ARB: + llinfos << " " << names[j] << " = " << "WGL_GENERIC_ACCELERATION_ARB" << llendl; + break; + case WGL_FULL_ACCELERATION_ARB: + llinfos << " " << names[j] << " = " << "WGL_FULL_ACCELERATION_ARB" << llendl; + break; + case WGL_SWAP_EXCHANGE_ARB: + llinfos << " " << names[j] << " = " << "WGL_SWAP_EXCHANGE_ARB" << llendl; + break; + case WGL_SWAP_COPY_ARB: + llinfos << " " << names[j] << " = " << "WGL_SWAP_COPY_ARB" << llendl; + break; + case WGL_SWAP_UNDEFINED_ARB: + llinfos << " " << names[j] << " = " << "WGL_SWAP_UNDEFINED_ARB" << llendl; + break; + case WGL_TYPE_RGBA_ARB: + llinfos << " " << names[j] << " = " << "WGL_TYPE_RGBA_ARB" << llendl; + break; + case WGL_TYPE_COLORINDEX_ARB: + llinfos << " " << names[j] << " = " << "WGL_TYPE_COLORINDEX_ARB" << llendl; + break; + default: + llinfos << " " << names[j] << " = " << results[j] << llendl; + } + + } + } + }*/ + + //Singu note: Reversed order of this loop. Generally, choosepixelformat returns an array with the closer matches towards the start. + S32 swap_method = 0; + S32 cur_format = 0;//num_formats-1; + GLint swap_query = WGL_SWAP_METHOD_ARB; + BOOL found_format = FALSE; + while (!found_format && wglGetPixelFormatAttribivARB(mhDC, pixel_formats[cur_format], 0, 1, &swap_query, &swap_method)) + { + if (swap_method == WGL_SWAP_UNDEFINED_ARB /*|| cur_format <= 0*/) + { + found_format = TRUE; + } + else if(cur_format >= num_formats-1) + { + cur_format = 0; found_format = TRUE; } else { - --cur_format; + //--cur_format; + ++cur_format; } } @@ -1495,6 +1631,10 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO swapBuffers(); } + int buf = 0; + glGetIntegerv(GL_SAMPLES, &buf); + llinfos << "Acquired FSAA Samples = " << buf << llendl; + return TRUE; } diff --git a/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl b/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl index ca29bf314..7c0699d72 100644 --- a/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/indexedTextureV.glsl @@ -23,9 +23,9 @@ * $/LicenseInfo$ */ -ATTRIBUTE int texture_index; +ATTRIBUTE ivec4 texture_index; -VARYING_FLAT int vary_texture_index; +VARYING_FLAT ivec4 vary_texture_index; void passTextureIndex() { diff --git a/indra/newview/hippolimits.cpp b/indra/newview/hippolimits.cpp index ee18070f9..3bdec44d3 100644 --- a/indra/newview/hippolimits.cpp +++ b/indra/newview/hippolimits.cpp @@ -35,10 +35,12 @@ void HippoLimits::setOpenSimLimits() mMaxHeight = 10000.0f; if (gHippoGridManager->getConnectedGrid()->isRenderCompat()) { llinfos << "Using rendering compatible OpenSim limits." << llendl; + mMinPrimScale = 0.01f; mMinHoleSize = 0.05f; mMaxHollow = 0.95f; } else { llinfos << "Using Hippo OpenSim limits." << llendl; + mMinPrimScale = 0.001f; mMinHoleSize = 0.01f; mMaxHollow = 0.99f; } @@ -57,6 +59,7 @@ void HippoLimits::setSecondLifeLimits() mMaxAgentGroups = DEFAULT_MAX_AGENT_GROUPS; } + mMinPrimScale = 0.01f; mMaxHeight = 4096.0f; mMinHoleSize = 0.05f; mMaxHollow = 0.95f; diff --git a/indra/newview/hippolimits.h b/indra/newview/hippolimits.h index 32efe4d12..78d42a7df 100644 --- a/indra/newview/hippolimits.h +++ b/indra/newview/hippolimits.h @@ -13,6 +13,7 @@ public: float getMinHoleSize() const { return mMinHoleSize; } float getMaxHollow() const { return mMaxHollow; } float getMaxPrimScale() const { return mMaxPrimScale; } + float getMinPrimScale() const { return mMinPrimScale; } void setLimits(); @@ -22,6 +23,7 @@ private: float mMinHoleSize; float mMaxHollow; float mMaxPrimScale; + float mMinPrimScale; void setOpenSimLimits(); void setSecondLifeLimits(); diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp index f3ffe732f..7e5377bd1 100644 --- a/indra/newview/llenvmanager.cpp +++ b/indra/newview/llenvmanager.cpp @@ -494,11 +494,13 @@ void LLEnvManagerNew::onRegionSettingsResponse(const LLSD& content) // Load region sky presets. LLWLParamManager::instance().refreshRegionPresets(); - // Not possible to assume M7WL should take precidence as OpenSim will send both - // bool bOverridden = M7WindlightInterface::getInstance()->hasOverride(); + bool bOverridden = M7WindlightInterface::getInstance()->hasOverride(); // If using server settings, update managers. - if (getUseRegionSettings()) +// if (getUseRegionSettings()) +// [RLVa:KB] - Checked: 2011-08-29 (RLVa-1.4.1a) | Added: RLVa-1.4.1a + if (!bOverridden && (getUseRegionSettings()) && (LLWLParamManager::getInstance()->mAnimator.getIsRunning()) ) +// [/RLVa:KB] { updateManagersFromPrefs(mInterpNextChangeMessage); } diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index ba818ed90..c42846b6f 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -758,6 +758,9 @@ static void xform4a(LLVector4a &tex_coord, const LLVector4a& trans, const LLVect bool less_than_max_mag(const LLVector4a& vec) { +#if 1 + return true; +#else LLVector4a MAX_MAG; MAX_MAG.splat(1024.f*1024.f); @@ -767,6 +770,7 @@ bool less_than_max_mag(const LLVector4a& vec) S32 lt = val.lessThan(MAX_MAG).getGatheredBits() & 0x7; return lt == 0x7; +#endif } BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, @@ -1635,8 +1639,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (!do_xform) { LLFastTimer t(FTM_FACE_TEX_QUICK_NO_XFORM); - S32 tc_size = (num_vertices*2*sizeof(F32)+0xF) & ~0xF; - LLVector4a::memcpyNonAliased16((F32*) tex_coords.get(), (F32*) vf.mTexCoords, tc_size); + LLVector4a::memcpyNonAliased16((F32*) tex_coords.get(), (F32*) vf.mTexCoords, num_vertices*2*sizeof(F32)); } else { @@ -1857,12 +1860,15 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLVector4a texIdx; - S32 index = mTextureIndex < 255 ? mTextureIndex : 0; + U8 index = mTextureIndex < 255 ? mTextureIndex : 0; F32 val = 0.f; - S32* vp = (S32*) &val; - *vp = index; - + U8* vp = (U8*) &val; + vp[0] = index; + vp[1] = 0; + vp[2] = 0; + vp[3] = 0; + llassert(index <= LLGLSLShader::sIndexedTextureChannels-1); LLVector4Logical mask; diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 42a14b7f6..eeb53a98d 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -103,6 +103,10 @@ LLFastTimerView::LLFastTimerView(const std::string& name, const LLRect& rect) FTV_NUM_TIMERS = LLFastTimer::NamedTimer::instanceCount(); mPrintStats = -1; mAverageCyclesPerTimer = 0; + // Making the ledgend part of fast timers scrollable + mOverLegend = false; + mScrollOffset = 0; + // LLUICtrlFactory::getInstance()->buildFloater(this, "floater_fast_timers.xml"); } @@ -258,6 +262,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) } mHoverTimer = NULL; mHoverID = NULL; + mOverLegend = false; // Making the ledgend part of fast timers scrollable if(LLFastTimer::sPauseHistory && mBarRect.pointInRect(x, y)) { @@ -311,6 +316,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) { mHoverID = timer_id; } + mOverLegend = true; // Making the ledgend part of fast timers scrollable } return LLFloater::handleHover(x, y, mask); @@ -358,10 +364,36 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* stic BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks) { - LLFastTimer::sPauseHistory = TRUE; - mScrollIndex = llclamp( mScrollIndex + clicks, - 0, - llmin(LLFastTimer::getLastFrameIndex(), (S32)LLFastTimer::NamedTimer::HISTORY_NUM - MAX_VISIBLE_HISTORY)); + //LLFastTimer::sPauseHistory = TRUE; + //mScrollIndex = llclamp( mScrollIndex + clicks, + //0, + //llmin(LLFastTimer::getLastFrameIndex(), (S32)LLFastTimer::NamedTimer::HISTORY_NUM - MAX_VISIBLE_HISTORY)); + // Making the ledgend part of fast timers scrollable + if(mOverLegend) + { + mScrollOffset += clicks; + S32 count = 0; + for (timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer()); + it != timer_tree_iterator_t(); + ++it) + { + count++; + LLFastTimer::NamedTimer* idp = (*it); + if (idp->getCollapsed()) + { + it.skipDescendants(); + } + } + mScrollOffset = llclamp(mScrollOffset,0,count-5); + } + else + { + LLFastTimer::sPauseHistory = TRUE; + mScrollIndex = llclamp( mScrollIndex + clicks, + 0, + llmin(LLFastTimer::getLastFrameIndex(), (S32)LLFastTimer::NamedTimer::HISTORY_NUM - MAX_VISIBLE_HISTORY)); + } + // return TRUE; } @@ -479,11 +511,23 @@ void LLFastTimerView::draw() S32 cur_line = 0; ft_display_idx.clear(); std::map display_line; + S32 mScrollOffset_tmp = mScrollOffset; // Making the ledgend part of fast timers scrollable for (timer_tree_iterator_t it = begin_timer_tree(LLFastTimer::NamedTimer::getRootNamedTimer()); it != timer_tree_iterator_t(); ++it) { LLFastTimer::NamedTimer* idp = (*it); + // Making the ledgend part of fast timers scrollable + if(mScrollOffset_tmp) + { + --mScrollOffset_tmp; + if (idp->getCollapsed()) + { + it.skipDescendants(); + } + continue; + } + // display_line[idp] = cur_line; ft_display_idx.push_back(idp); cur_line++; diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index 04fa500e1..47972b272 100644 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -99,6 +99,11 @@ private: S32 mPrintStats; S32 mAverageCyclesPerTimer; LLRect mGraphRect; + + // Making the ledgend part of fast timers scrollable + bool mOverLegend; + S32 mScrollOffset; + // }; #endif diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 83941b789..d32e08847 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -758,9 +758,13 @@ BOOL LLImagePreviewAvatar::render() // make sure alpha=0 shows avatar material color LLGLDisable no_blend(GL_BLEND); - LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)avatarp->mDrawable->getFace(0)->getPool(); - gPipeline.enableLightsPreview(); - avatarPoolp->renderAvatars(avatarp); // renders only one avatar + LLFace* face = avatarp->mDrawable->getFace(0); + if (face) + { + LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)face->getPool(); + gPipeline.enableLightsPreview(); + avatarPoolp->renderAvatars(avatarp); // renders only one avatar + } } gGL.color4f(1,1,1,1); diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index bb282fb4d..e1e6552f9 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -94,13 +94,6 @@ const LLManip::EManipPart MANIPULATOR_IDS[NUM_MANIPULATORS] = LLManip::LL_FACE_NEGZ }; - -F32 get_default_max_prim_scale(bool is_flora) -{ -//CF: both scales are 256, so what?, I now use gridmanagersetting - return gHippoLimits->getMaxPrimScale(); -} - // static void LLManipScale::setUniform(BOOL b) { @@ -966,8 +959,11 @@ void LLManipScale::dragCorner( S32 x, S32 y ) mInSnapRegime = FALSE; } - F32 max_scale_factor = get_default_max_prim_scale() / MIN_PRIM_SCALE; - F32 min_scale_factor = MIN_PRIM_SCALE / get_default_max_prim_scale(); + F32 max_prim_scale = gHippoLimits->getMaxPrimScale(); + F32 min_prim_scale = gHippoLimits->getMinPrimScale(); + + F32 max_scale_factor = max_prim_scale / min_prim_scale; + F32 min_scale_factor = min_prim_scale / max_prim_scale; // find max and min scale factors that will make biggest object hit max absolute scale and smallest object hit min absolute scale for (LLObjectSelection::iterator iter = mObjectSelection->begin(); @@ -982,10 +978,10 @@ void LLManipScale::dragCorner( S32 x, S32 y ) { const LLVector3& scale = selectNode->mSavedScale; - F32 cur_max_scale_factor = llmin( get_default_max_prim_scale(LLPickInfo::isFlora(cur)) / scale.mV[VX], get_default_max_prim_scale(LLPickInfo::isFlora(cur)) / scale.mV[VY], get_default_max_prim_scale(LLPickInfo::isFlora(cur)) / scale.mV[VZ] ); + F32 cur_max_scale_factor = llmin( max_prim_scale / scale.mV[VX], max_prim_scale / scale.mV[VY], max_prim_scale / scale.mV[VZ] ); max_scale_factor = llmin( max_scale_factor, cur_max_scale_factor ); - F32 cur_min_scale_factor = llmax( MIN_PRIM_SCALE / scale.mV[VX], MIN_PRIM_SCALE / scale.mV[VY], MIN_PRIM_SCALE / scale.mV[VZ] ); + F32 cur_min_scale_factor = llmax( min_prim_scale / scale.mV[VX], min_prim_scale / scale.mV[VY], min_prim_scale / scale.mV[VZ] ); min_scale_factor = llmax( min_scale_factor, cur_min_scale_factor ); } } @@ -1288,7 +1284,7 @@ void LLManipScale::stretchFace( const LLVector3& drag_start_agent, const LLVecto F32 denom = axis * dir_local; F32 desired_delta_size = is_approx_zero(denom) ? 0.f : (delta_local_mag / denom); // in meters - F32 desired_scale = llclamp(selectNode->mSavedScale.mV[axis_index] + desired_delta_size, MIN_PRIM_SCALE, get_default_max_prim_scale(LLPickInfo::isFlora(cur))); + F32 desired_scale = llclamp(selectNode->mSavedScale.mV[axis_index] + desired_delta_size, gHippoLimits->getMinPrimScale(), gHippoLimits->getMaxPrimScale()); // propagate scale constraint back to position offset desired_delta_size = desired_scale - selectNode->mSavedScale.mV[axis_index]; // propagate constraint back to position @@ -1989,7 +1985,7 @@ F32 LLManipScale::partToMaxScale( S32 part, const LLBBox &bbox ) const max_extent = bbox_extents.mV[i]; } } - max_scale_factor = bbox_extents.magVec() * get_default_max_prim_scale() / max_extent; + max_scale_factor = bbox_extents.magVec() * gHippoLimits->getMaxPrimScale() / max_extent; if (getUniform()) { @@ -2004,7 +2000,7 @@ F32 LLManipScale::partToMinScale( S32 part, const LLBBox &bbox ) const { LLVector3 bbox_extents = unitVectorToLocalBBoxExtent( partToUnitVector( part ), bbox ); bbox_extents.abs(); - F32 min_extent = get_default_max_prim_scale(); + F32 min_extent = gHippoLimits->getMaxPrimScale(); for (U32 i = VX; i <= VZ; i++) { if (bbox_extents.mV[i] > 0.f && bbox_extents.mV[i] < min_extent) @@ -2012,7 +2008,7 @@ F32 LLManipScale::partToMinScale( S32 part, const LLBBox &bbox ) const min_extent = bbox_extents.mV[i]; } } - F32 min_scale_factor = bbox_extents.magVec() * MIN_PRIM_SCALE / min_extent; + F32 min_scale_factor = bbox_extents.magVec() * gHippoLimits->getMinPrimScale() / min_extent; if (getUniform()) { diff --git a/indra/newview/llmanipscale.h b/indra/newview/llmanipscale.h index 2de75f2ce..edfe2257a 100644 --- a/indra/newview/llmanipscale.h +++ b/indra/newview/llmanipscale.h @@ -46,8 +46,6 @@ #include "llbbox.h" -F32 get_default_max_prim_scale(bool is_flora = false); - class LLToolComposite; class LLColor4; diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 60d3d9fca..fa60a85e4 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1098,19 +1098,24 @@ bool LLMeshRepoThread::headerReceived(const LLVolumeParams& mesh_params, U8* dat mMeshHeader[mesh_id] = header; } + + LLMutexLock lock(mMutex); // FIRE-7182, make sure only one thread access mPendingLOD at the same time. + //check for pending requests pending_lod_map::iterator iter = mPendingLOD.find(mesh_params); if (iter != mPendingLOD.end()) { - LLMutexLock lock(mMutex); + // LLMutexLock lock(mMutex); FIRE-7182, lock was moved up, before calling mPendingLOD.find for (U32 i = 0; i < iter->second.size(); ++i) { LODRequest req(mesh_params, iter->second[i]); mLODReqQ.push(req); LLMeshRepository::sLODProcessing++; } + + mPendingLOD.erase(iter); // FIRE-7182, only call erase if iter is really valid. } - mPendingLOD.erase(iter); + // mPendingLOD.erase(iter); // avoid crash by moving erase up. } return true; diff --git a/indra/newview/llpaneldisplay.cpp b/indra/newview/llpaneldisplay.cpp index 1e2eccdca..d2f3bdd01 100644 --- a/indra/newview/llpaneldisplay.cpp +++ b/indra/newview/llpaneldisplay.cpp @@ -876,6 +876,10 @@ void LLPanelDisplay::cancel() void LLPanelDisplay::apply() { + U32 fsaa_value = childGetValue("fsaa").asInteger(); + bool apply_fsaa_change = !gSavedSettings.getBOOL("RenderUseFBO") && (mFSAASamples != fsaa_value); + gSavedSettings.setU32("RenderFSAASamples", fsaa_value); + applyResolution(); // Only set window size if we're not in fullscreen mode @@ -887,7 +891,7 @@ void LLPanelDisplay::apply() // Hardware tab //Still do a bit of voodoo here. V2 forces restart to change FSAA with FBOs off. //Let's not do that, and instead do pre-V2 FSAA change handling for that particular case - if(!LLRenderTarget::sUseFBO && (mFSAASamples != (U32)childGetValue("fsaa").asInteger())) + if(apply_fsaa_change) { bool logged_in = (LLStartUp::getStartupState() >= STATE_STARTED); LLWindow* window = gViewerWindow->getWindow(); diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 21868422e..796a535d7 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -550,6 +550,9 @@ void LLPanelObject::getState( ) mCtrlScaleX->setMaxValue(gHippoLimits->getMaxPrimScale()); mCtrlScaleY->setMaxValue(gHippoLimits->getMaxPrimScale()); mCtrlScaleZ->setMaxValue(gHippoLimits->getMaxPrimScale()); + mCtrlScaleX->setMinValue(gHippoLimits->getMinPrimScale()); + mCtrlScaleY->setMinValue(gHippoLimits->getMinPrimScale()); + mCtrlScaleZ->setMinValue(gHippoLimits->getMinPrimScale()); LLQuaternion object_rot = objectp->getRotationEdit(); object_rot.getEulerAngles(&(mCurEulerDegrees.mV[VX]), &(mCurEulerDegrees.mV[VY]), &(mCurEulerDegrees.mV[VZ])); @@ -2537,9 +2540,9 @@ void LLPanelObject::onPasteSize(void* user_data) LLPanelObject* self = (LLPanelObject*) user_data; LLCalc* calcp = LLCalc::getInstance(); - mClipboardSize.mV[VX] = llclamp(mClipboardSize.mV[VX], 0.01f, gHippoLimits->getMaxPrimScale()); - mClipboardSize.mV[VY] = llclamp(mClipboardSize.mV[VY], 0.01f, gHippoLimits->getMaxPrimScale()); - mClipboardSize.mV[VZ] = llclamp(mClipboardSize.mV[VZ], 0.01f, gHippoLimits->getMaxPrimScale()); + mClipboardSize.mV[VX] = llclamp(mClipboardSize.mV[VX], gHippoLimits->getMinPrimScale(), gHippoLimits->getMaxPrimScale()); + mClipboardSize.mV[VY] = llclamp(mClipboardSize.mV[VY], gHippoLimits->getMinPrimScale(), gHippoLimits->getMaxPrimScale()); + mClipboardSize.mV[VZ] = llclamp(mClipboardSize.mV[VZ], gHippoLimits->getMinPrimScale(), gHippoLimits->getMaxPrimScale()); self->mCtrlScaleX->set( mClipboardSize.mV[VX] ); self->mCtrlScaleY->set( mClipboardSize.mV[VY] ); @@ -2620,9 +2623,9 @@ void LLPanelObject::onPasteSizeClip(void* user_data) std::string stringVec = wstring_to_utf8str(temp_string); if(!getvectorfromclip(stringVec, &mClipboardSize)) return; - mClipboardSize.mV[VX] = llclamp(mClipboardSize.mV[VX], 0.01f, gHippoLimits->getMaxPrimScale()); - mClipboardSize.mV[VY] = llclamp(mClipboardSize.mV[VY], 0.01f, gHippoLimits->getMaxPrimScale()); - mClipboardSize.mV[VZ] = llclamp(mClipboardSize.mV[VZ], 0.01f, gHippoLimits->getMaxPrimScale()); + mClipboardSize.mV[VX] = llclamp(mClipboardSize.mV[VX], gHippoLimits->getMinPrimScale(), gHippoLimits->getMaxPrimScale()); + mClipboardSize.mV[VY] = llclamp(mClipboardSize.mV[VY], gHippoLimits->getMinPrimScale(), gHippoLimits->getMaxPrimScale()); + mClipboardSize.mV[VZ] = llclamp(mClipboardSize.mV[VZ], gHippoLimits->getMinPrimScale(), gHippoLimits->getMaxPrimScale()); self->mCtrlScaleX->set( mClipboardSize.mV[VX] ); self->mCtrlScaleY->set( mClipboardSize.mV[VY] ); diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index a6f6ca8c1..513e92f3a 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -389,7 +389,7 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj, // don't include an avatar. LLViewerObject* root = obj; - while(!root->isAvatar() && root->getParent() && !root->isJointChild()) + while(!root->isAvatar() && root->getParent()) { LLViewerObject* parent = (LLViewerObject*)root->getParent(); if (parent->isAvatar()) @@ -704,7 +704,7 @@ void LLSelectMgr::deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_s // don't include an avatar. LLViewerObject* root = object; - while(!root->isAvatar() && root->getParent() && !root->isJointChild()) + while(!root->isAvatar() && root->getParent()) { LLViewerObject* parent = (LLViewerObject*)root->getParent(); if (parent->isAvatar()) @@ -1419,7 +1419,7 @@ void LLSelectMgr::promoteSelectionToRoot() } LLViewerObject* parentp = object; - while(parentp->getParent() && !(parentp->isRootEdit() || parentp->isJointChild())) + while(parentp->getParent() && !(parentp->isRootEdit())) { parentp = (LLViewerObject*)parentp->getParent(); } @@ -4468,8 +4468,7 @@ struct LLSelectMgrApplyFlags : public LLSelectedObjectFunctor virtual bool apply(LLViewerObject* object) { if ( object->permModify() && // preemptive permissions check - object->isRoot() && // don't send for child objects - !object->isJointChild()) + object->isRoot()) // don't send for child objects { object->setFlags( mFlags, mState); } @@ -6302,8 +6301,6 @@ void LLSelectMgr::updateSelectionCenter() // matches the root prim's (affecting the orientation of the manipulators). bbox.addBBoxAgent( (mSelectedObjects->getFirstRootObject(TRUE))->getBoundingBoxAgent() ); - std::vector < LLViewerObject *> jointed_objects; - for (LLObjectSelection::iterator iter = mSelectedObjects->begin(); iter != mSelectedObjects->end(); iter++) { @@ -6321,17 +6318,11 @@ void LLSelectMgr::updateSelectionCenter() } bbox.addBBoxAgent( object->getBoundingBoxAgent() ); - - if (object->isJointChild()) - { - jointed_objects.push_back(object); - } } LLVector3 bbox_center_agent = bbox.getCenterAgent(); mSelectionCenterGlobal = gAgent.getPosGlobalFromAgent(bbox_center_agent); mSelectionBBox = bbox; - } if ( !(gAgentID == LLUUID::null)) @@ -6625,19 +6616,19 @@ void LLSelectMgr::setAgentHUDZoom(F32 target_zoom, F32 current_zoom) bool LLObjectSelection::is_root::operator()(LLSelectNode *node) { LLViewerObject* object = node->getObject(); - return (object != NULL) && !node->mIndividualSelection && (object->isRootEdit() || object->isJointChild()); + return (object != NULL) && !node->mIndividualSelection && (object->isRootEdit()); } bool LLObjectSelection::is_valid_root::operator()(LLSelectNode *node) { LLViewerObject* object = node->getObject(); - return (object != NULL) && node->mValid && !node->mIndividualSelection && (object->isRootEdit() || object->isJointChild()); + return (object != NULL) && node->mValid && !node->mIndividualSelection && (object->isRootEdit()); } bool LLObjectSelection::is_root_object::operator()(LLSelectNode *node) { LLViewerObject* object = node->getObject(); - return (object != NULL) && (object->isRootEdit() || object->isJointChild()); + return (object != NULL) && (object->isRootEdit()); } LLObjectSelection::LLObjectSelection() : diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index f9d880aa0..867ec94ec 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -245,7 +245,8 @@ BOOL LLVisualParamHint::render() LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE); - if (gAgentAvatarp->mDrawable.notNull()) + if (gAgentAvatarp->mDrawable.notNull() && + gAgentAvatarp->mDrawable->getFace(0)) { LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)gAgentAvatarp->mDrawable->getFace(0)->getPool(); LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 64014c015..c33a668f5 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -951,9 +951,47 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo { LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; - LLCachedControl render_depth_pre_pass("RenderDepthPrePass", false); + static LLCachedControl render_ui_occlusion("RenderUIOcclusion", false); + if(render_ui_occlusion && LLGLSLShader::sNoFixedFunction) + { + LLFloater* floaterp = gFloaterView->getFrontmost(); + if(floaterp && floaterp->getVisible() && floaterp->isBackgroundVisible() && floaterp->isBackgroundOpaque()) + { + LLGLDepthTest depth(GL_TRUE, GL_TRUE); + gGL.setColorMask(false, false); + gOcclusionProgram.bind(); + + LLRect rect = floaterp->calcScreenRect(); + rect.stretch(-1); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.loadIdentity(); + gGL.ortho(0.0f, gViewerWindow->getWindowWidth(), 0.0f, gViewerWindow->getWindowHeight(), 0.f, 1.0f); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); + gGL.loadIdentity(); + gGL.color4fv( LLColor4::white.mV ); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.begin( LLRender::QUADS ); + gGL.vertex3f(rect.mLeft, rect.mTop,0.f); + gGL.vertex3f(rect.mLeft, rect.mBottom,0.f); + gGL.vertex3f(rect.mRight, rect.mBottom,0.f); + gGL.vertex3f(rect.mRight, rect.mTop,0.f); + gGL.end(); + + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); + gOcclusionProgram.unbind(); + } + } + + static LLCachedControl render_depth_pre_pass("RenderDepthPrePass", false); if (render_depth_pre_pass && LLGLSLShader::sNoFixedFunction) { + LLGLDepthTest depth(GL_TRUE, GL_TRUE); + LLGLEnable cull_face(GL_CULL_FACE); gGL.setColorMask(false, false); U32 types[] = { @@ -968,11 +1006,9 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo { gPipeline.renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE); } - gOcclusionProgram.unbind(); } - gGL.setColorMask(true, false); if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender) { diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index e87fa206b..b8833d302 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -241,7 +241,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mNumFaces(0), mTimeDilation(1.f), mRotTime(0.f), - mJointInfo(NULL), + mAngularVelocityRot(), mState(0), mMedia(NULL), mClickAction(0), @@ -271,6 +271,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe { mPositionAgent = mRegionp->getOriginAgent(); } + resetRot(); LLViewerObject::sNumObjects++; } @@ -286,12 +287,6 @@ LLViewerObject::~LLViewerObject() mInventory = NULL; } - if (mJointInfo) - { - delete mJointInfo; - mJointInfo = NULL; - } - if (mPartSourcep) { mPartSourcep->setDead(); @@ -345,9 +340,6 @@ void LLViewerObject::markDead() if (getParent()) { ((LLViewerObject *)getParent())->removeChild(this); - // go ahead and delete any jointinfo's that we find - delete mJointInfo; - mJointInfo = NULL; } // Mark itself as dead @@ -764,7 +756,7 @@ void LLViewerObject::addThisAndNonJointChildren(std::vector& ob iter != mChildList.end(); ++iter) { LLViewerObject* child = *iter; - if ( (!child->isAvatar()) && (!child->isJointChild())) + if ( (!child->isAvatar())) { child->addThisAndNonJointChildren(objects); } @@ -1326,27 +1318,6 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, parameterChanged(iter->first, iter->second->data, FALSE, false); } } - - U8 joint_type = 0; - mesgsys->getU8Fast(_PREHASH_ObjectData, _PREHASH_JointType, joint_type, block_num); - if (joint_type) - { - // create new joint info - if (!mJointInfo) - { - mJointInfo = new LLVOJointInfo; - } - mJointInfo->mJointType = (EHavokJointType) joint_type; - mesgsys->getVector3Fast(_PREHASH_ObjectData, _PREHASH_JointPivot, mJointInfo->mPivot, block_num); - mesgsys->getVector3Fast(_PREHASH_ObjectData, _PREHASH_JointAxisOrAnchor, mJointInfo->mAxisOrAnchor, block_num); - } - else if (mJointInfo) - { - // this joint info is no longer needed - delete mJointInfo; - mJointInfo = NULL; - } - break; } @@ -2035,14 +2006,6 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, cur_parentp->removeChild(this); - if (mJointInfo && !parent_id) - { - // since this object is no longer parent-relative - // we make sure we delete any joint info - delete mJointInfo; - mJointInfo = NULL; - } - setChanged(MOVED | SILHOUETTE); if (mDrawable.notNull()) @@ -2144,14 +2107,14 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (new_rot != getRotation() || new_angv != old_angv) { - if (new_rot != getRotation()) + if (new_angv != old_angv) { - setRotation(new_rot); + resetRot(); } - + + // Set the rotation of the object followed by adjusting for the accumulated angular velocity (llSetTargetOmega) + setRotation(new_rot * mAngularVelocityRot); setChanged(ROTATED | SILHOUETTE); - - resetRot(); } @@ -2264,85 +2227,9 @@ BOOL LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) F32 dt_raw = (F32)(time - mLastInterpUpdateSecs); F32 dt = mTimeDilation * dt_raw; - if (!mJointInfo) - { - applyAngularVelocity(dt); - } + applyAngularVelocity(dt); - LLViewerObject *parentp = (LLViewerObject *) getParent(); - if (mJointInfo) - { - if (parentp) - { - // do parent-relative stuff - LLVector3 ang_vel = getAngularVelocity(); - F32 omega = ang_vel.magVecSquared(); - F32 angle = 0.0f; - LLQuaternion dQ; - if (omega > 0.00001f) - { - omega = sqrt(omega); - angle = omega * dt; - dQ.setQuat(angle, ang_vel); - } - LLVector3 pos = getPosition(); - - if (HJT_HINGE == mJointInfo->mJointType) - { - // hinge = uniform circular motion - LLVector3 parent_pivot = getVelocity(); - LLVector3 parent_axis = getAcceleration(); - - angle = dt * (ang_vel * mJointInfo->mAxisOrAnchor); // AxisOrAnchor = axis - dQ.setQuat(angle, mJointInfo->mAxisOrAnchor); // AxisOrAnchor = axis - LLVector3 pivot_offset = pos - mJointInfo->mPivot; // pos in pivot-frame - pivot_offset = pivot_offset * dQ; // new rotated pivot-frame pos - pos = mJointInfo->mPivot + pivot_offset; // parent-frame - LLViewerObject::setPosition(pos); - LLQuaternion Q_PC = getRotation(); - setRotation(Q_PC * dQ); - mLastInterpUpdateSecs = time; - } - else if (HJT_POINT == mJointInfo->mJointType) - // || HJT_LPOINT == mJointInfo->mJointType) - { - // point-to-point = spin about axis and uniform circular motion - // of axis about the pivot point - // - // NOTE: this interpolation scheme is not quite good enough to - // reduce the bandwidth -- needs a gravitational correction. - // Similarly for hinges with axes that deviate from vertical. - - LLQuaternion Q_PC = getRotation(); - Q_PC = Q_PC * dQ; - setRotation(Q_PC); - - LLVector3 pivot_to_child = - mJointInfo->mAxisOrAnchor; // AxisOrAnchor = anchor - pos = mJointInfo->mPivot + pivot_to_child * Q_PC; - LLViewerObject::setPosition(pos); - mLastInterpUpdateSecs = time; - } - /* else if (HJT_WHEEL == mJointInfo->mJointInfo) - { - // wheel = uniform rotation about axis, with linear - // velocity interpolation (if any) - LLVector3 parent_axis = getAcceleration(); // HACK -- accel stores the parent-axis (parent-frame) - - LLQuaternion Q_PC = getRotation(); - - angle = dt * (parent_axis * ang_vel); - dQ.setQuat(angle, parent_axis); - - Q_PC = Q_PC * dQ; - setRotation(Q_PC); - - pos = getPosition() + dt * getVelocity(); - LLViewerObject::setPosition(pos); - mLastInterpUpdateSecs = time; - }*/ - } - } - else if (isAttachment()) + if (isAttachment()) { mLastInterpUpdateSecs = time; return TRUE; @@ -3951,15 +3838,6 @@ void LLViewerObject::setPositionEdit(const LLVector3 &pos_edit, BOOL damped) ((LLViewerObject *)getParent())->setPositionEdit(pos_edit - position_offset); updateDrawable(damped); } - else if (isJointChild()) - { - // compute new parent-relative position - LLViewerObject *parent = (LLViewerObject *) getParent(); - LLQuaternion inv_parent_rot = parent->getRotation(); - inv_parent_rot.transQuat(); - LLVector3 pos_parent = (pos_edit - parent->getPositionRegion()) * inv_parent_rot; - LLViewerObject::setPosition(pos_parent, damped); - } else { LLViewerObject::setPosition(pos_edit, damped); @@ -3973,8 +3851,7 @@ LLViewerObject* LLViewerObject::getRootEdit() const { const LLViewerObject* root = this; while (root->mParent - && !(root->mJointInfo - || ((LLViewerObject*)root->mParent)->isAvatar()) ) + && !((LLViewerObject*)root->mParent)->isAvatar()) { root = (LLViewerObject*)root->mParent; } @@ -4710,19 +4587,11 @@ void LLViewerObject::clearIcon() LLViewerObject* LLViewerObject::getSubParent() { - if (isJointChild()) - { - return this; - } return (LLViewerObject*) getParent(); } const LLViewerObject* LLViewerObject::getSubParent() const { - if (isJointChild()) - { - return this; - } return (const LLViewerObject*) getParent(); } @@ -5631,8 +5500,13 @@ void LLViewerObject::applyAngularVelocity(F32 dt) ang_vel *= 1.f/omega; + // calculate the delta increment based on the object's angular velocity dQ.setQuat(angle, ang_vel); + + // accumulate the angular velocity rotations to re-apply in the case of an object update + mAngularVelocityRot *= dQ; + // Just apply the delta increment to the current rotation setRotation(getRotation()*dQ); setChanged(MOVED | SILHOUETTE); } @@ -5641,6 +5515,9 @@ void LLViewerObject::applyAngularVelocity(F32 dt) void LLViewerObject::resetRot() { mRotTime = 0.0f; + + // Reset the accumulated angular velocity rotation + mAngularVelocityRot.loadIdentity(); } U32 LLViewerObject::getPartitionType() const diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 31562d411..791393533 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -93,18 +93,6 @@ typedef void (*inventory_callback)(LLViewerObject*, S32 serial_num, void*); -// a small struct for keeping track of joints -struct LLVOJointInfo -{ - EHavokJointType mJointType; - LLVector3 mPivot; // parent-frame - // whether the below an axis or anchor (and thus its frame) - // depends on the joint type: - // HINGE ==> axis=parent-frame - // P2P ==> anchor=child-frame - LLVector3 mAxisOrAnchor; -}; - // for exporting textured materials from SL struct LLMaterialExportInfo { @@ -192,8 +180,6 @@ public: virtual void updateRadius() {}; virtual F32 getVObjRadius() const; // default implemenation is mDrawable->getRadius() - BOOL isJointChild() const { return mJointInfo ? TRUE : FALSE; } - EHavokJointType getJointType() const { return mJointInfo ? mJointInfo->mJointType : HJT_INVALID; } // for jointed and other parent-relative hacks LLViewerObject* getSubParent(); const LLViewerObject* getSubParent() const; @@ -750,8 +736,8 @@ protected: F32 mTimeDilation; // Time dilation sent with the object. F32 mRotTime; // Amount (in seconds) that object has rotated according to angular velocity (llSetTargetOmega) + LLQuaternion mAngularVelocityRot; // accumulated rotation from the angular velocity computations - LLVOJointInfo* mJointInfo; U8 mState; // legacy LLViewerObjectMedia* mMedia; // NULL if no media associated U8 mClickAction; diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index b43b4fe29..fe06343b7 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -1113,7 +1113,7 @@ LLVoiceClient::LLVoiceClient() gVoiceClient = this; mWriteInProgress = false; mAreaVoiceDisabled = false; - mPTT = true; + mPTT = false; mUserPTTState = false; mMuteMic = false; mSessionTerminateRequested = false; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 29d6b24f3..9ee00b50c 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1044,9 +1044,9 @@ BOOL LLVOVolume::calcLOD() F32 radius; F32 distance; - if (mDrawable->isState(LLDrawable::RIGGED) && getAvatar()) + if (mDrawable->isState(LLDrawable::RIGGED) && getAvatar() && getAvatar()->mDrawable) { - LLVOAvatar* avatar = getAvatar(); + LLVOAvatar* avatar = getAvatar(); distance = avatar->mDrawable->mDistanceWRTCamera; radius = avatar->getBinRadius(); } diff --git a/indra/newview/m7wlinterface.cpp b/indra/newview/m7wlinterface.cpp index 365e6165a..7906ab81a 100644 --- a/indra/newview/m7wlinterface.cpp +++ b/indra/newview/m7wlinterface.cpp @@ -45,6 +45,22 @@ void M7WindlightInterface::receiveMessage(LLMessageSystem* msg) _PREHASH_ParamList, _PREHASH_Parameter, buf, size, i, 249); +#if 0 + std::ostringstream wldump; + char hex []= "0123456789abcdefRRRR"; + for (int i = 0; i<250; ++i){ + wldump << "\\x" << hex[((U8)buf[i]&0xF0)>>4] << hex[(U8)buf[i]&0x0F]; + } + llinfos << "Received LightShare data: " << wldump.str() << llendl; +#endif + char default_windlight[] = "\x00\x00\x80\x40\x00\x00\x18\x42\x00\x00\x80\x42\x00\x00\x80\x40\x00\x00\x80\x3e\x00\x00\x00\x40\x00\x00\x00\x40\x00\x00\x00\x40\xcd\xcc\xcc\x3e\x00\x00\x00\x3f\x8f\xc2\xf5\x3c\xcd\xcc\x4c\x3e\x0a\xd7\x23\x3d\x66\x66\x86\x3f\x3d\x0a\xd7\xbe\x7b\x14\x8e\x3f\xe1\x7a\x94\xbf\x82\x2d\xed\x49\x9a\x6c\xf6\x1c\xcb\x89\x6d\xf5\x4f\x42\xcd\xf4\x00\x00\x80\x3e\x00\x00\x80\x3e\x0a\xd7\xa3\x3e\x0a\xd7\xa3\x3e\x5c\x8f\x42\x3e\x8f\xc2\xf5\x3d\xae\x47\x61\x3e\x5c\x8f\xc2\x3e\x5c\x8f\xc2\x3e\x33\x33\x33\x3f\xec\x51\x38\x3e\xcd\xcc\x4c\x3f\x8f\xc2\x75\x3e\xb8\x1e\x85\x3e\x9a\x99\x99\x3e\x9a\x99\x99\x3e\xd3\x4d\xa2\x3e\x33\x33\xb3\x3e\x33\x33\xb3\x3e\x33\x33\xb3\x3e\x33\x33\xb3\x3e\x00\x00\x00\x00\xcd\xcc\xcc\x3d\x00\x00\xe0\x3f\x00\x00\x80\x3f\x00\x00\x00\x00\x85\xeb\xd1\x3e\x85\xeb\xd1\x3e\x85\xeb\xd1\x3e\x85\xeb\xd1\x3e\x00\x00\x80\x3f\x14\xae\x07\x3f\x00\x00\x80\x3f\x71\x3d\x8a\x3e\x3d\x0a\xd7\x3e\x00\x00\x80\x3f\x14\xae\x07\x3f\x8f\xc2\xf5\x3d\xcd\xcc\x4c\x3e\x0a\xd7\x23\x3c\x45\x06\x00"; + if(!memcmp(default_windlight, buf, sizeof(default_windlight))) + { + llinfos << "LightShare matches default" << llendl; + receiveReset(); + return; + } + LLWaterParamManager::getInstance()->getParamSet("Default", mWater); Meta7WindlightPacket* wl = (Meta7WindlightPacket*)buf; @@ -120,6 +136,7 @@ void M7WindlightInterface::receiveMessage(LLMessageSystem* msg) void M7WindlightInterface::receiveReset() { + llinfos << "Received LightShare reset" << llendl; mHasOverride = false; LLEnvManagerNew::getInstance()->usePrefs(); } diff --git a/indra/newview/meta7windlight.h b/indra/newview/meta7windlight.h index 04ce86d46..03af81165 100644 --- a/indra/newview/meta7windlight.h +++ b/indra/newview/meta7windlight.h @@ -31,6 +31,9 @@ #include "linden_common.h" +#pragma pack(push) +#pragma pack(1) + struct M7Color3{ M7Color3(){}; M7Color3(F32 pRed, F32 pGreen, F32 pBlue) @@ -124,8 +127,8 @@ struct Meta7WindlightPacket { char cloudScrollXLock; char cloudScrollYLock; char drawClassicClouds; - - }; +#pragma pack(pop) + #endif diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 8440b836a..12f7c170e 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6571,15 +6571,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield, b } else { - LLViewerObject* obj = gAgentCamera.getFocusObject(); - if (obj) - { //focus on alt-zoom target - focus_point = LLVector3(gAgentCamera.getFocusGlobal()-gAgent.getRegion()->getOriginGlobal()); - } - else - { //focus on your avatar - focus_point = gAgent.getPositionAgent(); - } + //focus on alt-zoom target + focus_point = LLVector3(gAgentCamera.getFocusGlobal()-gAgent.getRegion()->getOriginGlobal()); } } diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml index 5393ca535..ce4cf97d9 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml @@ -112,7 +112,7 @@ Antialiasing: - + Disabled 2x 4x