FITMESH-6, FITMESH-20 Fix for some objects disappearing when hardware skinning enabled and ALM disabled.

NOTE: There appears to be a driver bug on some AMD systems that will cause hardware skinning to break given different combinations of shaders. Users should be advised that if they see improper skinning on their avatars, they should either enable advanced lighting model, or disable atmospheric shaders or hardware skinning.

davep
This commit is contained in:
Latif Khalifa
2014-01-24 12:26:43 +01:00
parent de29ea779a
commit aaf06fa2cc
2 changed files with 11 additions and 14 deletions

View File

@@ -22,17 +22,14 @@
* $/LicenseInfo$
*/
ATTRIBUTE vec4 weight4;
uniform mat3 matrixPalette[64];
uniform vec3 translationPalette[64];
uniform mat3 matrixPalette[52];
uniform vec3 translationPalette[52];
mat4 getObjectSkinnedTransform()
{
int i;
int i;
vec4 w = fract(weight4);
vec4 index = floor(weight4);

View File

@@ -61,6 +61,7 @@ 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;
@@ -1566,12 +1567,10 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*
LLVector4a* norm = has_normal ? (LLVector4a*) normal.get() : NULL;
//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)
for (U32 j = 0; j < skin->mJointNames.size(); ++j)
{
LLJoint* joint = avatar->getJoint(skin->mJointNames[j]);
if (joint)
@@ -1628,6 +1627,7 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*
LLVector4a& n = vol_face.mNormals[j];
bind_shape_matrix.rotate(n, t);
final_mat.rotate(t, dst);
dst.normalize3fast();
norm[j] = dst;
}
}
@@ -1694,9 +1694,9 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
{
if (sShaderLevel > 0)
{ //upload matrix palette to shader
LLMatrix4 mat[64];
LLMatrix4 mat[JOINT_COUNT];
U32 count = llmin((U32) skin->mJointNames.size(), (U32) 64);
U32 count = llmin((U32) skin->mJointNames.size(), (U32) JOINT_COUNT);
for (U32 i = 0; i < count; ++i)
{
@@ -1710,9 +1710,9 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
stop_glerror();
F32 mp[64*9];
F32 mp[JOINT_COUNT*9];
F32 transp[64*3];
F32 transp[JOINT_COUNT*3];
for (U32 i = 0; i < count; ++i)
{