From 2d0b310e191088cb45308edc4dbd2c9821f519b5 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 29 Mar 2014 02:19:14 -0500 Subject: [PATCH 1/4] Framerate llinfos spew was clobbering cout decimal precision. --- indra/llcommon/llsys.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index c96f2191f..315b42a71 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -1288,7 +1288,7 @@ public: LL_CONT << "slowest framerate for last " << int(prevSize * MEM_INFO_THROTTLE) << " seconds "; } - LL_CONT << std::fixed << std::setprecision(1) << framerate << '\n' + LL_CONT << std::fixed << std::setprecision(1) << framerate << std::setprecision(6) << '\n' << LLMemoryInfo() << LL_ENDL; return false; From 7158a3c83d1541e07f144f9050b0a8c90609a407 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Thu, 8 May 2014 15:11:12 -0500 Subject: [PATCH 2/4] Fixed an annoying showstopper regarding rigged attachment vertex corruption. Rigged meshes have can have poor weighting, causing potential div-by-zero issues. --- indra/llrender/llvertexbuffer.cpp | 8 +- indra/llrender/llvertexbuffer.h | 4 +- .../shaders/class1/avatar/objectSkinV.glsl | 22 +++-- indra/newview/lldrawpoolavatar.cpp | 91 +----------------- indra/newview/lldrawpoolavatar.h | 1 + indra/newview/llface.cpp | 14 +-- indra/newview/llface.h | 2 +- indra/newview/llfloatermodelpreview.cpp | 68 +------------- indra/newview/llviewerjointmesh.cpp | 2 +- indra/newview/llvoavatar.cpp | 94 +++++++++++++++++++ indra/newview/llvoavatar.h | 2 + indra/newview/llvovolume.cpp | 29 +++--- 12 files changed, 149 insertions(+), 188 deletions(-) diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 1b163ee4c..5171dcf87 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -2065,14 +2065,14 @@ bool LLVertexBuffer::getWeightStrider(LLStrider& strider, S32 index, S32 co return VertexBufferStrider::get(*this, strider, index, count, map_range); } -bool LLVertexBuffer::getWeight4Strider(LLStrider& strider, S32 index, S32 count, bool map_range) +bool LLVertexBuffer::getWeight4Strider(LLStrider& strider, S32 index, S32 count, bool map_range) { - return VertexBufferStrider::get(*this, strider, index, count, map_range); + return VertexBufferStrider::get(*this, strider, index, count, map_range); } -bool LLVertexBuffer::getClothWeightStrider(LLStrider& strider, S32 index, S32 count, bool map_range) +bool LLVertexBuffer::getClothWeightStrider(LLStrider& strider, S32 index, S32 count, bool map_range) { - return VertexBufferStrider::get(*this, strider, index, count, map_range); + return VertexBufferStrider::get(*this, strider, index, count, map_range); } //---------------------------------------------------------------------------- diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index d33bc9ff4..77c753fc9 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -255,8 +255,8 @@ public: bool getColorStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); bool getEmissiveStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); bool getWeightStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); - bool getWeight4Strider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); - bool getClothWeightStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + bool getWeight4Strider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); + bool getClothWeightStrider(LLStrider& strider, S32 index=0, S32 count = -1, bool map_range = false); bool useVBOs() const; diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl index 44bd9f5ed..aa445fd14 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -22,30 +22,34 @@ * $/LicenseInfo$ */ +#define FLT_MAX 3.402823466e+38 + ATTRIBUTE vec4 weight4; uniform mat3 matrixPalette[52]; uniform vec3 translationPalette[52]; uniform float maxWeight; + + mat4 getObjectSkinnedTransform() { int i; vec4 w = fract(weight4); vec4 index = floor(weight4); - + index = min(index, vec4(maxWeight)); index = max(index, vec4( 0.0)); - float scale = 1.0/(w.x+w.y+w.z+w.w); - w *= scale; - + float sum = (w.x+w.y+w.z+w.w); + int i1 = int(index.x); int i2 = int(index.y); int i3 = int(index.z); int i4 = int(index.w); - + + mat3 mat = matrixPalette[i1]*w.x; mat += matrixPalette[i2]*w.y; mat += matrixPalette[i3]*w.z; @@ -58,10 +62,10 @@ mat4 getObjectSkinnedTransform() mat4 ret; - ret[0] = vec4(mat[0], 0); - ret[1] = vec4(mat[1], 0); - ret[2] = vec4(mat[2], 0); - ret[3] = vec4(trans, 1.0); + ret[0] = vec4(mat[0].xyz, 0); + ret[1] = vec4(mat[1].xyz, 0); + ret[2] = vec4(mat[2].xyz, 0); + ret[3] = vec4(trans, scale); return ret; } diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 42dcd4547..4597f6e9d 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -61,8 +61,6 @@ static U32 sDataMask = LLDrawPoolAvatar::VERTEX_DATA_MASK; static U32 sBufferUsage = GL_STREAM_DRAW_ARB; static U32 sShaderLevel = 0; -#define JOINT_COUNT 52 - LLGLSLShader* LLDrawPoolAvatar::sVertexProgram = NULL; BOOL LLDrawPoolAvatar::sSkipOpaque = FALSE; BOOL LLDrawPoolAvatar::sSkipTransparent = FALSE; @@ -1550,93 +1548,8 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* } if (sShaderLevel <= 0 && face->mLastSkinTime < avatar->getLastSkinTime()) - { //perform software vertex skinning for this face - LLStrider position; - LLStrider normal; - - bool has_normal = buffer->hasDataType(LLVertexBuffer::TYPE_NORMAL); - buffer->getVertexStrider(position); - - if (has_normal) - { - buffer->getNormalStrider(normal); - } - - LLVector4a* pos = (LLVector4a*) position.get(); - - LLVector4a* norm = has_normal ? (LLVector4a*) normal.get() : NULL; - - //build matrix palette - LLMatrix4a mp[JOINT_COUNT]; - LLMatrix4* mat = (LLMatrix4*) mp; - - U32 count = llmin((U32) skin->mJointNames.size(), (U32) JOINT_COUNT); - - for (U32 j = 0; j < count; ++j) - { - LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); - if(!joint) - { - joint = avatar->getJoint("mRoot"); - } - if (joint) - { - mat[j] = skin->mInvBindMatrix[j]; - mat[j] *= joint->getWorldMatrix(); - } - } - - LLMatrix4a bind_shape_matrix; - bind_shape_matrix.loadu(skin->mBindShapeMatrix); - - for (U32 j = 0; j < (U32)buffer->getNumVerts(); ++j) - { - LLMatrix4a final_mat; - final_mat.clear(); - - S32 idx[4]; - - LLVector4 wght; - - F32 scale = 0.f; - for (U32 k = 0; k < 4; k++) - { - F32 w = weight[j][k]; - - idx[k] = llclamp((S32) floorf(w), 0, S32(count-1)); - wght[k] = w - floorf(w); - scale += wght[k]; - } - - wght *= 1.f/scale; - - for (U32 k = 0; k < 4; k++) - { - F32 w = wght[k]; - - LLMatrix4a src; - src.setMul(mp[idx[k]], w); - - final_mat.add(src); - } - - - LLVector4a& v = vol_face.mPositions[j]; - LLVector4a t; - LLVector4a dst; - bind_shape_matrix.affineTransform(v, t); - final_mat.affineTransform(t, dst); - pos[j] = dst; - - if (norm) - { - LLVector4a& n = vol_face.mNormals[j]; - bind_shape_matrix.rotate(n, t); - final_mat.rotate(t, dst); - dst.normalize3fast(); - norm[j] = dst; - } - } + { + avatar->updateSoftwareSkinnedVertices(skin, weight, vol_face, buffer); } } diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h index 9569a9b1f..af06c4836 100644 --- a/indra/newview/lldrawpoolavatar.h +++ b/indra/newview/lldrawpoolavatar.h @@ -42,6 +42,7 @@ class LLMeshSkinInfo; class LLVolume; class LLVolumeFace; +const U32 JOINT_COUNT = 52; class LLDrawPoolAvatar : public LLFacePool { diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 15430989e..692724a38 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -452,7 +452,7 @@ U16 LLFace::getGeometryAvatar( LLStrider &normals, LLStrider &tex_coords, LLStrider &vertex_weights, - LLStrider &clothing_weights) + LLStrider &clothing_weights) { if (mVertexBuffer.notNull()) { @@ -1143,11 +1143,11 @@ void LLFace::cacheFaceInVRAM(const LLVolumeFace& vf) if (vf.mWeights) { - LLStrider f_wght; + LLStrider f_wght; buff->getWeight4Strider(f_wght); for (U32 i = 0; i < (U32)vf.mNumVertices; ++i) { - (*f_wght++).set(vf.mWeights[i].getF32ptr()); + (*f_wght++) = vf.mWeights[i]; } } @@ -1253,7 +1253,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLStrider colors; LLStrider tangent; LLStrider indicesp; - LLStrider wght; + LLStrider wght; BOOL full_rebuild = force_rebuild || mDrawablep->isState(LLDrawable::REBUILD_VOLUME); @@ -2126,8 +2126,10 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { LLFastTimer t(FTM_FACE_GEOM_WEIGHTS); mVertexBuffer->getWeight4Strider(wght, mGeomIndex, mGeomCount, map_range); - F32* weights = (F32*) wght.get(); - LLVector4a::memcpyNonAliased16(weights, (F32*) vf.mWeights, num_vertices*4*sizeof(F32)); + for(S32 i=0;iflush(); diff --git a/indra/newview/llface.h b/indra/newview/llface.h index 7cdb6272e..470375b04 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -183,7 +183,7 @@ public: LLStrider &normals, LLStrider &texCoords, LLStrider &vertex_weights, - LLStrider &clothing_weights); + LLStrider &clothing_weights); // For volumes, etc. U16 getGeometry(LLStrider &vertices, diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 16c33c6b5..4c2e68a6c 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4692,7 +4692,7 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights) LLStrider normal_strider; LLStrider tc_strider; LLStrider index_strider; - LLStrider weights_strider; + LLStrider weights_strider; vb->getVertexStrider(vertex_strider); vb->getIndexStrider(index_strider); @@ -4735,7 +4735,7 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights) w.mV[i] = joint + wght; } - *(weights_strider++) = w; + (*(weights_strider++)).loadua(w.mV); } } @@ -5372,71 +5372,11 @@ BOOL LLModelPreview::render() for (U32 i = 0; i < mVertexBuffer[mPreviewLOD][model].size(); ++i) { LLVertexBuffer* buffer = mVertexBuffer[mPreviewLOD][model][i]; - const LLVolumeFace& face = model->getVolumeFace(i); - - LLStrider position; - buffer->getVertexStrider(position); - - LLStrider weight; + LLStrider weight; buffer->getWeight4Strider(weight); - //quick 'n dirty software vertex skinning - - //build matrix palette - - LLMatrix4 mat[64]; - for (U32 j = 0; j < model->mSkinInfo.mJointNames.size(); ++j) - { - LLJoint* joint = getPreviewAvatar()->getJoint(model->mSkinInfo.mJointNames[j]); - if (joint) - { - mat[j] = model->mSkinInfo.mInvBindMatrix[j]; - mat[j] *= joint->getWorldMatrix(); - } - } - - for (S32 j = 0; j < buffer->getNumVerts(); ++j) - { - LLMatrix4 final_mat; - final_mat.mMatrix[0][0] = final_mat.mMatrix[1][1] = final_mat.mMatrix[2][2] = final_mat.mMatrix[3][3] = 0.f; - - LLVector4 wght; - S32 idx[4]; - - F32 scale = 0.f; - for (U32 k = 0; k < 4; k++) - { - F32 w = weight[j].mV[k]; - - idx[k] = (S32) floorf(w); - wght.mV[k] = w - floorf(w); - scale += wght.mV[k]; - } - - wght *= 1.f/scale; - - for (U32 k = 0; k < 4; k++) - { - F32* src = (F32*) mat[idx[k]].mMatrix; - F32* dst = (F32*) final_mat.mMatrix; - - F32 w = wght.mV[k]; - - for (U32 l = 0; l < 16; l++) - { - dst[l] += src[l]*w; - } - } - - //VECTORIZE THIS - LLVector3 v(face.mPositions[j].getF32ptr()); - - v = v * model->mSkinInfo.mBindShapeMatrix; - v = v * final_mat; - - position[j] = v; - } + getPreviewAvatar()->updateSoftwareSkinnedVertices(&model->mSkinInfo, weight.get(), face, buffer); const std::string& binding = instance.mModel->mMaterialList[i]; const LLImportMaterial& material = instance.mMaterial[binding]; diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 1184cf73c..c3bdfe5f8 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -413,7 +413,7 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w LLStrider normalsp; LLStrider tex_coordsp; LLStrider vertex_weightsp; - LLStrider clothing_weightsp; + LLStrider clothing_weightsp; LLStrider indicesp; // Copy data into the faces from the polymesh data. diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 3b15311e7..62b4a9a60 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -8743,6 +8743,100 @@ void LLVOAvatar::updateLODRiggedAttachments( void ) updateLOD(); rebuildRiggedAttachments(); } + +void LLVOAvatar::updateSoftwareSkinnedVertices(const LLMeshSkinInfo* skin, const LLVector4a* weight, const LLVolumeFace& vol_face, LLVertexBuffer *buffer) +{ + //perform software vertex skinning for this face + LLStrider position; + LLStrider normal; + + bool has_normal = buffer->hasDataType(LLVertexBuffer::TYPE_NORMAL); + buffer->getVertexStrider(position); + + if (has_normal) + { + buffer->getNormalStrider(normal); + } + + LLVector4a* pos = (LLVector4a*) position.get(); + + LLVector4a* norm = has_normal ? (LLVector4a*) normal.get() : NULL; + + //build matrix palette + LLMatrix4a mp[JOINT_COUNT]; + LLMatrix4* mat = (LLMatrix4*) mp; + + U32 count = llmin((U32) skin->mJointNames.size(), (U32) JOINT_COUNT); + + llassert_always(count); + + for (U32 j = 0; j < count; ++j) + { + LLJoint* joint = getJoint(skin->mJointNames[j]); + if(!joint) + { + joint = getJoint("mRoot"); + } + if (joint) + { + mat[j] = skin->mInvBindMatrix[j]; + mat[j] *= joint->getWorldMatrix(); + } + } + + LLMatrix4a bind_shape_matrix; + bind_shape_matrix.loadu(skin->mBindShapeMatrix); + + for (U32 j = 0; j < (U32)buffer->getNumVerts(); ++j) + { + LLMatrix4a final_mat; + final_mat.clear(); + + S32 idx[4]; + + LLVector4 wght; + + F32 scale = 0.f; + for (U32 k = 0; k < 4; k++) + { + F32 w = weight[j][k]; + + idx[k] = (S32) floorf(w); + wght[k] = w - floorf(w); + scale += wght[k]; + } + + if(scale > 0.f) + wght *= 1.f/scale; + else + wght = LLVector4(F32_MAX,F32_MAX,F32_MAX,F32_MAX); + + for (U32 k = 0; k < 4; k++) + { + F32 w = wght[k]; + LLMatrix4a src; + src.setMul(mp[idx[k]], w); + + final_mat.add(src); + } + + LLVector4a& v = vol_face.mPositions[j]; + LLVector4a t; + LLVector4a dst; + bind_shape_matrix.affineTransform(v, t); + final_mat.affineTransform(t, dst); + pos[j] = dst; + + if (norm) + { + LLVector4a& n = vol_face.mNormals[j]; + bind_shape_matrix.rotate(n, t); + final_mat.rotate(t, dst); + dst.normalize3fast(); + norm[j] = dst; + } + } +} U32 LLVOAvatar::getPartitionType() const { // Avatars merely exist as drawables in the bridge partition diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 891fae7d9..7044c1e1c 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -74,6 +74,7 @@ class LLHUDEffectSpiral; class LLTexGlobalColor; class LLViewerJoint; struct LLAppearanceMessageContents; +class LLMeshSkinInfo; class SHClientTagMgr : public LLSingleton, public boost::signals2::trackable { @@ -176,6 +177,7 @@ public: /*virtual*/ BOOL updateLOD(); BOOL updateJointLODs(); void updateLODRiggedAttachments( void ); + void updateSoftwareSkinnedVertices(const LLMeshSkinInfo* skin, const LLVector4a* weight, const LLVolumeFace& vol_face, LLVertexBuffer *buffer); /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. S32 totalTextureMemForUUIDS(std::set& ids); bool allTexturesCompletelyDownloaded(std::set& ids) const; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index a94d9e856..2c7aa39aa 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3916,15 +3916,20 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons } //build matrix palette - static const size_t kMaxJoints = 64; - - LLMatrix4a mp[kMaxJoints]; + LLMatrix4a mp[JOINT_COUNT]; LLMatrix4* mat = (LLMatrix4*) mp; - - U32 maxJoints = llmin(skin->mJointNames.size(), kMaxJoints); - for (U32 j = 0; j < maxJoints; ++j) + + U32 count = llmin((U32) skin->mJointNames.size(), (U32) JOINT_COUNT); + + llassert_always(count); + + for (U32 j = 0; j < count; ++j) { LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); + if(!joint) + { + joint = avatar->getJoint("mRoot"); + } if (joint) { mat[j] = skin->mInvBindMatrix[j]; @@ -3973,17 +3978,17 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons scale += wght[k]; } - wght *= 1.f/scale; + if(scale > 0.f) + wght *= 1.f/scale; + else + wght = LLVector4(F32_MAX,F32_MAX,F32_MAX,F32_MAX); for (U32 k = 0; k < 4; k++) { F32 w = wght[k]; - LLMatrix4a src; - // Ensure ref'd bone is in our clamped array of mats - llassert(idx[k] < kMaxJoints); - // clamp k to kMaxJoints to avoid reading garbage off stack in release - src.setMul(mp[idx[(k < kMaxJoints) ? k : 0]], w); + src.setMul(mp[idx[k]], w); + final_mat.add(src); } From 162e7b76993b727bbe0d822c4902f54fe72f0f61 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Thu, 8 May 2014 15:30:02 -0500 Subject: [PATCH 3/4] Fixed a silly mistake that was causing vsync to be enabled when it should have been. Also fix typo in objectSkinV.glsl previous commit --- indra/llwindow/llwindowwin32.cpp | 10 +++++----- .../shaders/class1/avatar/objectSkinV.glsl | 2 +- indra/newview/llviewerwindow.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 8e6b4c57c..6b8a1a45b 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -635,7 +635,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, LLCoordScreen windowPos(x,y); LLCoordScreen windowSize(window_rect.right - window_rect.left, window_rect.bottom - window_rect.top); - if (!switchContext(mFullscreen, windowSize, TRUE, &windowPos)) + if (!switchContext(mFullscreen, windowSize, vsync_mode, &windowPos)) { return; } @@ -1654,21 +1654,21 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, co { if (vsync_mode == 0) { - LL_DEBUGS("Window") << "Disabling vertical sync" << LL_ENDL; + LL_INFOS("Window") << "Disabling vertical sync" << LL_ENDL; wglSwapIntervalEXT(0); } else if(vsync_mode == -1) { - LL_DEBUGS("Window") << "Enabling adaptive vertical sync" << LL_ENDL; + LL_INFOS("Window") << "Enabling adaptive vertical sync" << LL_ENDL; if(wglSwapIntervalEXT(-1) == 0) { - LL_DEBUGS("Window") << "Failed to enable adaptive vertical sync. Disabling vsync." << LL_ENDL; + LL_INFOS("Window") << "Failed to enable adaptive vertical sync. Disabling vsync." << LL_ENDL; wglSwapIntervalEXT(0); } } else { - LL_DEBUGS("Window") << "Enabling vertical sync" << LL_ENDL; + LL_INFOS("Window") << "Enabling vertical sync" << LL_ENDL; wglSwapIntervalEXT(1); } } diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl index aa445fd14..f4e86409c 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -65,7 +65,7 @@ mat4 getObjectSkinnedTransform() ret[0] = vec4(mat[0].xyz, 0); ret[1] = vec4(mat[1].xyz, 0); ret[2] = vec4(mat[2].xyz, 0); - ret[3] = vec4(trans, scale); + ret[3] = vec4(trans, sum); return ret; } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 1e77f7b43..37ac057dd 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -5512,7 +5512,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, mWindow->setSize(size); } - if (fsaa == old_fsaa && vsync_mode == mWindow->getFSAASamples()) + if (fsaa == old_fsaa && vsync_mode == mWindow->getVsyncMode()) { return TRUE; } From f0763fd31cb64efd0ae06c179886dca78e535b64 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Thu, 8 May 2014 15:48:08 -0500 Subject: [PATCH 4/4] Tweaked context-recreation logic to force a 0xAA context when fbos are in use. Should also handle toggling of fbo checkbox a bit gracefully as well. --- indra/newview/llpaneldisplay.cpp | 12 ++++++++++-- indra/newview/llviewerwindow.cpp | 4 ++-- indra/newview/pipeline.cpp | 3 +++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/indra/newview/llpaneldisplay.cpp b/indra/newview/llpaneldisplay.cpp index 9fc9b96c9..0c1e60d76 100644 --- a/indra/newview/llpaneldisplay.cpp +++ b/indra/newview/llpaneldisplay.cpp @@ -865,11 +865,20 @@ void LLPanelDisplay::apply() { U32 fsaa_value = childGetValue("fsaa").asInteger(); S32 vsync_value = childGetValue("vsync").asInteger(); + bool fbo_value = childGetValue("fbo").asBoolean(); + + LLWindow* window = gViewerWindow->getWindow(); if(vsync_value == -1 && !gGLManager.mHasAdaptiveVsync) vsync_value = 0; - bool apply_fsaa_change = !gSavedSettings.getBOOL("RenderUseFBO") && (mFSAASamples != fsaa_value); + bool apply_fsaa_change = fbo_value ? false : (mFSAASamples != fsaa_value); + + if(!apply_fsaa_change && (bool)mUseFBO != fbo_value) + { + apply_fsaa_change = fsaa_value != 0 || mFSAASamples != 0 ; + } + bool apply_vsync_change = vsync_value != mVsyncMode; gSavedSettings.setU32("RenderFSAASamples", fsaa_value); @@ -889,7 +898,6 @@ void LLPanelDisplay::apply() if(apply_fsaa_change || apply_vsync_change) { bool logged_in = (LLStartUp::getStartupState() >= STATE_STARTED); - LLWindow* window = gViewerWindow->getWindow(); LLCoordScreen size; window->getSize(&size); LLGLState::checkStates(); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 37ac057dd..f0b74c6e1 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1654,7 +1654,7 @@ LLViewerWindow::LLViewerWindow( vsync_mode, !gNoRender, ignore_pixel_depth, - gSavedSettings.getBOOL("RenderUseFBO") ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled + LLRenderTarget::sUseFBO ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled if (!LLViewerShaderMgr::sInitialized) { //immediately initialize shaders @@ -5500,7 +5500,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, return TRUE; } - U32 fsaa = gSavedSettings.getU32("RenderFSAASamples"); + U32 fsaa = LLRenderTarget::sUseFBO ? 0 : gSavedSettings.getU32("RenderFSAASamples"); //don't use window level anti-aliasing if FBOs are enabled U32 old_fsaa = mWindow->getFSAASamples(); // going from windowed to windowed diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 2593391be..4e40e2a89 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -428,6 +428,9 @@ void LLPipeline::init() { refreshCachedSettings(); + bool can_defer = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred"); + LLRenderTarget::sUseFBO = gSavedSettings.getBOOL("RenderUseFBO") || (gSavedSettings.getBOOL("RenderDeferred") && can_defer); + gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity"); gOctreeReserveCapacity = llmin(gSavedSettings.getU32("OctreeReserveNodeCapacity"),U32(512)); sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD");