diff options
author | ruslantproductengine <ruslantproductengine@lindenlab.com> | 2014-11-03 20:05:20 +0200 |
---|---|---|
committer | ruslantproductengine <ruslantproductengine@lindenlab.com> | 2014-11-03 20:05:20 +0200 |
commit | 799d13269a5cdf29a5d68c15ceac42f0407b5833 (patch) | |
tree | ae1f17a27c9d1d02f302d2b5c73ed0aea25e8371 /indra | |
parent | f3d73d9e724e9ae1062bf109b6764d43ccba3114 (diff) |
MAINT-3585 FIXED Viewer Crashes when attempting to upload image.
The bug was fixed, the reasone of crash is following. The Core Flow view
contain another GL context and will not care about restoring a previous.
I restore context manually.
This path also contain a minor changes in another files.
All changes described here.
Сhange's for fix current bug.
indra/llwindow/llwindow.h
indra/llwindow/llwindowheadless.h
indra/llwindow/llwindowmacosx.h
indra/llwindow/llwindowsdl.h
indra/llwindow/llwindowwin32.h
indra/newview/lllocalbitmaps.cpp
indra/newview/llviewerdisplay.cpp
indra/newview/llviewerdisplay.h
Twice mUsage initialization (replace to forward initialization).
indra/llcharacter/lljointstate.h
Looks like condition should be befor memcopy call, otherwise - possible CRASH.
indra/llcommon/llmd5.cpp
Unused condition and variables.
indra/llmath/llsphere.cpp
Looks like should be under if otherwise - possible CRASH
indra\llprimitive\llmodel.cpp
Useless assert's.
indra/llrender/llrender.cpp
indra/newview/lldaycyclemanager.cpp
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/llcharacter/lljointstate.h | 24 | ||||
-rwxr-xr-x | indra/llcommon/llmd5.cpp | 12 | ||||
-rwxr-xr-x | indra/llmath/llsphere.cpp | 6 | ||||
-rwxr-xr-x | indra/llprimitive/llmodel.cpp | 4 | ||||
-rwxr-xr-x | indra/llrender/llrender.cpp | 24 | ||||
-rwxr-xr-x | indra/llwindow/llwindow.h | 1 | ||||
-rwxr-xr-x | indra/llwindow/llwindowheadless.cpp | 3 | ||||
-rwxr-xr-x | indra/llwindow/llwindowheadless.h | 4 | ||||
-rwxr-xr-x | indra/llwindow/llwindowmacosx.cpp | 5 | ||||
-rwxr-xr-x | indra/llwindow/llwindowmacosx.h | 2 | ||||
-rwxr-xr-x | indra/llwindow/llwindowmesaheadless.h | 1 | ||||
-rwxr-xr-x | indra/llwindow/llwindowsdl.h | 1 | ||||
-rwxr-xr-x | indra/llwindow/llwindowwin32.h | 1 | ||||
-rwxr-xr-x | indra/newview/lldaycyclemanager.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/lllocalbitmaps.cpp | 5 | ||||
-rwxr-xr-x | indra/newview/llviewerdisplay.cpp | 8 | ||||
-rwxr-xr-x | indra/newview/llviewerdisplay.h | 2 |
17 files changed, 66 insertions, 39 deletions
diff --git a/indra/llcharacter/lljointstate.h b/indra/llcharacter/lljointstate.h index b9c91f80b5..1ccc6b5093 100755 --- a/indra/llcharacter/lljointstate.h +++ b/indra/llcharacter/lljointstate.h @@ -64,22 +64,18 @@ protected: public: // Constructor LLJointState() - { - mUsage = 0; - mJoint = NULL; - mUsage = 0; - mWeight = 0.f; - mPriority = LLJoint::USE_MOTION_PRIORITY; - } + : mUsage(0) + , mJoint(NULL) + , mWeight(0.f) + , mPriority(LLJoint::USE_MOTION_PRIORITY) + {} LLJointState(LLJoint* joint) - { - mUsage = 0; - mJoint = joint; - mUsage = 0; - mWeight = 0.f; - mPriority = LLJoint::USE_MOTION_PRIORITY; - } + : mUsage(0) + , mJoint(joint) + , mWeight(0.f) + , mPriority(LLJoint::USE_MOTION_PRIORITY) + {} // joint that this state is applied to LLJoint* getJoint() { return mJoint; } diff --git a/indra/llcommon/llmd5.cpp b/indra/llcommon/llmd5.cpp index ed80af36d8..f942a976b7 100755 --- a/indra/llcommon/llmd5.cpp +++ b/indra/llcommon/llmd5.cpp @@ -118,6 +118,12 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) { buffer_space = 64 - buffer_index; // how much space is left in buffer + // now, transform each 64-byte piece of the input, bypassing the buffer + if (input == NULL || input_length == 0){ + std::cerr << "LLMD5::update: Invalid input!" << std::endl; + return; + } + // Transform as many times as possible. if (input_length >= buffer_space) { // ie. we have enough to fill the buffer // fill the rest of the buffer and transform @@ -127,12 +133,6 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) { buffer_space); transform (buffer); - // now, transform each 64-byte piece of the input, bypassing the buffer - if (input == NULL || input_length == 0){ - std::cerr << "LLMD5::update: Invalid input!" << std::endl; - return; - } - for (input_index = buffer_space; input_index + 63 < input_length; input_index += 64) transform (input+input_index); diff --git a/indra/llmath/llsphere.cpp b/indra/llmath/llsphere.cpp index 740047b93a..a8d6200488 100755 --- a/indra/llmath/llsphere.cpp +++ b/indra/llmath/llsphere.cpp @@ -248,8 +248,8 @@ LLSphere LLSphere::getBoundingSphere(const std::vector<LLSphere>& sphere_list) // compute the starting step-size F32 minimum_radius = 0.5f * llmin(diagonal.mV[VX], llmin(diagonal.mV[VY], diagonal.mV[VZ])); F32 step_length = bounding_radius - minimum_radius; - S32 step_count = 0; - S32 max_step_count = 12; + //S32 step_count = 0; + //S32 max_step_count = 12; F32 half_milimeter = 0.0005f; // wander the center around in search of tighter solutions @@ -258,7 +258,7 @@ LLSphere LLSphere::getBoundingSphere(const std::vector<LLSphere>& sphere_list) S32 last_dz = 2; while (step_length > half_milimeter - && step_count < max_step_count) + /*&& step_count < max_step_count*/) { // the algorithm for testing the maximum radius could be expensive enough // that it makes sense to NOT duplicate testing when possible, so we keep diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index aa8dd7697c..1f96d1557d 100755 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -1681,11 +1681,11 @@ LLSD LLModel::writeModel( } } - F32* src_tc = (F32*) face.mTexCoords[j].mV; - //texcoord if (face.mTexCoords) { + F32* src_tc = (F32*) face.mTexCoords[j].mV; + for (U32 k = 0; k < 2; ++k) { //for each component //convert to 16-bit normalized diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 0af402efea..1ca6e99ecf 100755 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -53,7 +53,7 @@ bool LLRender::sGLCoreProfile = false; static const U32 LL_NUM_TEXTURE_LAYERS = 32; static const U32 LL_NUM_LIGHT_UNITS = 8; -static GLenum sGLTextureType[] = +static const GLenum sGLTextureType[] = { GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_ARB, @@ -61,14 +61,14 @@ static GLenum sGLTextureType[] = GL_TEXTURE_2D_MULTISAMPLE }; -static GLint sGLAddressMode[] = +static const GLint sGLAddressMode[] = { GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE }; -static GLenum sGLCompareFunc[] = +static const GLenum sGLCompareFunc[] = { GL_NEVER, GL_ALWAYS, @@ -82,7 +82,7 @@ static GLenum sGLCompareFunc[] = const U32 immediate_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXCOORD0; -static GLenum sGLBlendFactor[] = +static const GLenum sGLBlendFactor[] = { GL_ONE, GL_ZERO, @@ -99,12 +99,12 @@ static GLenum sGLBlendFactor[] = }; LLTexUnit::LLTexUnit(S32 index) -: mCurrTexType(TT_NONE), mCurrBlendType(TB_MULT), -mCurrColorOp(TBO_MULT), mCurrAlphaOp(TBO_MULT), -mCurrColorSrc1(TBS_TEX_COLOR), mCurrColorSrc2(TBS_PREV_COLOR), -mCurrAlphaSrc1(TBS_TEX_ALPHA), mCurrAlphaSrc2(TBS_PREV_ALPHA), -mCurrColorScale(1), mCurrAlphaScale(1), mCurrTexture(0), -mHasMipMaps(false) + : mCurrTexType(TT_NONE), mCurrBlendType(TB_MULT), + mCurrColorOp(TBO_MULT), mCurrAlphaOp(TBO_MULT), + mCurrColorSrc1(TBS_TEX_COLOR), mCurrColorSrc2(TBS_PREV_COLOR), + mCurrAlphaSrc1(TBS_TEX_ALPHA), mCurrAlphaSrc2(TBS_PREV_ALPHA), + mCurrColorScale(1), mCurrAlphaScale(1), mCurrTexture(0), + mHasMipMaps(false) { llassert_always(index < (S32)LL_NUM_TEXTURE_LAYERS); mIndex = index; @@ -1189,7 +1189,7 @@ void LLRender::syncMatrices() if (shader) { - llassert(shader); + //llassert(shader); bool mvp_done = false; @@ -1288,7 +1288,7 @@ void LLRender::syncMatrices() } else if (!LLGLSLShader::sNoFixedFunction) { - GLenum mode[] = + static const GLenum mode[] = { GL_MODELVIEW, GL_PROJECTION, diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 0a30f4c807..0aa1fbe905 100755 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -122,6 +122,7 @@ public: virtual void gatherInput() = 0; virtual void delayInputProcessing() = 0; virtual void swapBuffers() = 0; + virtual void restoreGLContext() = 0; virtual void bringToFront() = 0; virtual void focusClient() { }; // this may not have meaning or be required on other platforms, therefore, it's not abstract virtual void setOldResize(bool oldresize) { }; diff --git a/indra/llwindow/llwindowheadless.cpp b/indra/llwindow/llwindowheadless.cpp index e6e6bc67ff..b6f67c6107 100755 --- a/indra/llwindow/llwindowheadless.cpp +++ b/indra/llwindow/llwindowheadless.cpp @@ -52,3 +52,6 @@ void LLWindowHeadless::swapBuffers() { } +void LLWindowHeadless::restoreGLContext() +{ +} diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h index 1f767f4c97..5975ee3410 100755 --- a/indra/llwindow/llwindowheadless.h +++ b/indra/llwindow/llwindowheadless.h @@ -74,8 +74,10 @@ public: /*virtual*/ void gatherInput() {}; /*virtual*/ void delayInputProcessing() {}; /*virtual*/ void swapBuffers(); + /*virtual*/ void restoreGLContext(); - // handy coordinate space conversion routines + + // handy coordinate space conversion routines /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to) { return FALSE; }; /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to) { return FALSE; }; /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordGL *to) { return FALSE; }; diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index e8d0a8bdb8..9ed298a481 100755 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -901,6 +901,11 @@ void LLWindowMacOSX::swapBuffers() CGLFlushDrawable(mContext); } +void LLWindowMacOSX::restoreGLContext() +{ + CGLSetCurrentContext(mContext); +} + F32 LLWindowMacOSX::getGamma() { F32 result = 2.2; // Default to something sane diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 825fd05c5f..194c9bb27a 100755 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -87,6 +87,8 @@ public: /*virtual*/ void gatherInput(); /*virtual*/ void delayInputProcessing() {}; /*virtual*/ void swapBuffers(); + /*virtual*/ void restoreGLContext(); + // handy coordinate space conversion routines /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to); diff --git a/indra/llwindow/llwindowmesaheadless.h b/indra/llwindow/llwindowmesaheadless.h index 8f70aee4f6..00e42240e6 100755 --- a/indra/llwindow/llwindowmesaheadless.h +++ b/indra/llwindow/llwindowmesaheadless.h @@ -77,6 +77,7 @@ public: /*virtual*/ void gatherInput() {}; /*virtual*/ void delayInputProcessing() {}; /*virtual*/ void swapBuffers(); + /*virtual*/ void restoreGLContext() {}; // handy coordinate space conversion routines /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to) { return FALSE; }; diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index c5ce892a04..7193e6f45a 100755 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -97,6 +97,7 @@ public: /*virtual*/ void processMiscNativeEvents(); /*virtual*/ void gatherInput(); /*virtual*/ void swapBuffers(); + /*virtual*/ void restoreGLContext() {}; /*virtual*/ void delayInputProcessing() { }; diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 169d264808..2ca8d48fc7 100755 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -83,6 +83,7 @@ public: /*virtual*/ void gatherInput(); /*virtual*/ void delayInputProcessing(); /*virtual*/ void swapBuffers(); + /*virtual*/ void restoreGLContext() {}; // handy coordinate space conversion routines /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to); diff --git a/indra/newview/lldaycyclemanager.cpp b/indra/newview/lldaycyclemanager.cpp index 131675310e..803e2b2fb2 100755 --- a/indra/newview/lldaycyclemanager.cpp +++ b/indra/newview/lldaycyclemanager.cpp @@ -207,7 +207,7 @@ bool LLDayCycleManager::addPreset(const std::string& name, const LLSD& data) { if (name.empty()) { - llassert(name.empty()); + //llassert(name.empty()); return false; } diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index 897ee8429a..4a89fc92b4 100755 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -64,6 +64,8 @@ #include "llimagedimensionsinfo.h" #include "llviewercontrol.h" #include "lltrans.h" +#include "llviewerdisplay.h" + /*=======================================*/ /* Formal declarations, constants, etc. */ /*=======================================*/ @@ -842,6 +844,9 @@ bool LLLocalBitmapMgr::addUnit() LLFilePicker& picker = LLFilePicker::instance(); if (picker.getMultipleOpenFiles(LLFilePicker::FFLOAD_IMAGE)) { + //For fix problem with Core Flow view on OSX + restoreGLContext(); + sTimer.stopTimer(); std::string filename = picker.getFirstFile(); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 981e4c40aa..dfbb128d3b 100755 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1344,6 +1344,14 @@ void swap() gDisplaySwapBuffers = TRUE; } +void restoreGLContext() +{ + if(gViewerWindow && gViewerWindow->getWindow()) + { + gViewerWindow->getWindow()->restoreGLContext(); + } +} + void renderCoordinateAxes() { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); diff --git a/indra/newview/llviewerdisplay.h b/indra/newview/llviewerdisplay.h index f6467d7f93..dcc78fe42f 100755 --- a/indra/newview/llviewerdisplay.h +++ b/indra/newview/llviewerdisplay.h @@ -34,6 +34,8 @@ void display_cleanup(); void display(BOOL rebuild = TRUE, F32 zoom_factor = 1.f, int subfield = 0, BOOL for_snapshot = FALSE); +void restoreGLContext(); + extern BOOL gDisplaySwapBuffers; extern BOOL gDepthDirty; extern BOOL gTeleportDisplay; |