Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions indra/llappearance/llwearable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,17 +727,22 @@ void LLWearable::writeToAvatar(LLAvatarAppearance* avatarp)
if (!avatarp) return;

// Pull params
for( const LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam() )
// Iterate over wearable's params first since they should be fewer than avatar params.
// Wearables are cloned from avatar params by mType, so they should be always be a
// subset of the avatar's params and a situation where mType param doesn't exist in
// a wearable yet exist in the avatar should not happen.
for (const visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
{
LLVisualParam* wearable_param = vp_pair.second;

// cross-wearable parameters are not authoritative, as they are driven by a different wearable. So don't copy the values to the
// avatar object if cross wearable. Cross wearable params get their values from the avatar, they shouldn't write the other way.
if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (!((LLViewerVisualParam*)param)->getCrossWearable()) )
{
S32 param_id = param->getID();
F32 weight = getVisualParamWeight(param_id);
if (((LLViewerVisualParam*)wearable_param)->getCrossWearable())
continue;

avatarp->setVisualParamWeight( param_id, weight);
}
F32 weight = wearable_param->getWeight();
// Silently fails if param was not found
avatarp->setVisualParamWeight(vp_pair.first, mType, weight);
}
}

Expand Down
25 changes: 25 additions & 0 deletions indra/llcharacter/llcharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,31 @@ bool LLCharacter::setVisualParamWeight(S32 index, F32 weight)
return false;
}

//-----------------------------------------------------------------------------
// setVisualParamWeight()
//-----------------------------------------------------------------------------
bool LLCharacter::setVisualParamWeight(S32 index, S32 type, F32 weight)
{
visual_param_index_map_t::iterator index_iter = mVisualParamIndexMap.find(index);
if (index_iter != mVisualParamIndexMap.end())
{
LLVisualParam* param = index_iter->second;
if (param->getWearableType() == type)
{
param->setWeight(weight);
return true;
}
else
{
// setVisualParamWeight at the moment is only used in writeToAvatar.
// The type is supposed to match since wearable is a subset of avatar by type.
llassert(false);
LL_WARNS() << "Visual param index " << index << " is not of type " << type << LL_ENDL;
}
}
return false;
}

//-----------------------------------------------------------------------------
// getVisualParamWeight()
//-----------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions indra/llcharacter/llcharacter.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class LLCharacter
virtual bool setVisualParamWeight(const LLVisualParam *which_param, F32 weight);
virtual bool setVisualParamWeight(const char* param_name, F32 weight);
virtual bool setVisualParamWeight(S32 index, F32 weight);
virtual bool setVisualParamWeight(S32 index, S32 type, F32 weight);

// get visual param weight by param or name
F32 getVisualParamWeight(LLVisualParam *distortion);
Expand Down
1 change: 1 addition & 0 deletions indra/llcharacter/llvisualparam.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class LLVisualParam
// Pure virtuals
//virtual bool parseData( LLXmlTreeNode *node ) = 0;
virtual void apply( ESex avatar_sex ) = 0;
virtual S32 getWearableType() const = 0;
// Default functions
virtual void setWeight(F32 weight);
virtual void setAnimationTarget( F32 target_value);
Expand Down
13 changes: 13 additions & 0 deletions indra/llrender/llvertexbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,12 +939,14 @@ void LLVertexBuffer::initClass(LLWindow* window)
{
llassert(sVBOPool == nullptr);

#if LL_DARWIN || LL_ARM64
Comment thread
akleshchev marked this conversation as resolved.
if (gGLManager.mIsApple)
Comment thread
akleshchev marked this conversation as resolved.
{
LL_INFOS() << "VBO Pooling Disabled" << LL_ENDL;
sVBOPool = new LLAppleVBOPool();
}
else
#endif
{
LL_INFOS() << "VBO Pooling Enabled" << LL_ENDL;
sVBOPool = new LLDefaultVBOPool();
Expand Down Expand Up @@ -1282,7 +1284,12 @@ U8* LLVertexBuffer::mapVertexBuffer(LLVertexBuffer::AttributeType type, U32 inde
count = mNumVerts - index;
}

#if LL_DARWIN || LL_ARM64
// Region tracking not needed on apple silicon - it recreates entire buffer
// While mIsApple can be encountered under windows, this is a
// macOS OpenGL behavior workaround. LL_ARM64 check might be not needed
if (!gGLManager.mIsApple)
#endif
{
U32 start = mOffsets[type] + sTypeSize[type] * index;
U32 end = start + sTypeSize[type] * count-1;
Expand Down Expand Up @@ -1319,7 +1326,9 @@ U8* LLVertexBuffer::mapIndexBuffer(U32 index, S32 count)
count = mNumIndices-index;
}

#if LL_DARWIN || LL_ARM64
if (!gGLManager.mIsApple)
#endif
{
U32 start = sizeof(U16) * index;
U32 end = start + sizeof(U16) * count-1;
Expand Down Expand Up @@ -1354,6 +1363,7 @@ U8* LLVertexBuffer::mapIndexBuffer(U32 index, S32 count)
// dst -- mMappedData or mMappedIndexData
void LLVertexBuffer::flush_vbo(GLenum target, U32 start, U32 end, void* data, U8* dst)
{
#if LL_DARWIN || LL_ARM64
if (gGLManager.mIsApple)
{
// on OS X, flush_vbo doesn't actually write to the GL buffer, so be sure to call
Expand All @@ -1365,6 +1375,7 @@ void LLVertexBuffer::flush_vbo(GLenum target, U32 start, U32 end, void* data, U8
memcpy(dst+start, data, end-start+1);
}
else
#endif
{
llassert(target == GL_ARRAY_BUFFER ? sGLRenderBuffer == mGLBuffer : sGLRenderIndices == mGLIndices);

Expand Down Expand Up @@ -1420,6 +1431,7 @@ void LLVertexBuffer::_unmapBuffer()
}
};

#if LL_DARWIN || LL_ARM64
if (gGLManager.mIsApple)
{
STOP_GLERROR;
Expand Down Expand Up @@ -1462,6 +1474,7 @@ void LLVertexBuffer::_unmapBuffer()
STOP_GLERROR;
}
else
#endif // LL_DARWIN || LL_ARM64
{
if (!mMappedVertexRegions.empty())
{
Expand Down
21 changes: 21 additions & 0 deletions indra/newview/llvoavatarself.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,27 @@ bool LLVOAvatarSelf::setVisualParamWeight(S32 index, F32 weight)
return setParamWeight(param,weight);
}

bool LLVOAvatarSelf::setVisualParamWeight(S32 index, S32 type, F32 weight)
{
LLViewerVisualParam* param = (LLViewerVisualParam*)LLCharacter::getVisualParam(index);
if (!param)
{
return false;
}
if (param->getWearableType() == type)
{
return setParamWeight(param, weight);
}
else
{
// setVisualParamWeight at the moment is only used in writeToAvatar.
// The type is supposed to match since wearable is a subset of avatar by type.
llassert(false);
LL_WARNS() << "Visual param index " << index << " is not of type " << type << LL_ENDL;
}
return false;
}

bool LLVOAvatarSelf::setParamWeight(const LLViewerVisualParam *param, F32 weight)
{
if (!param)
Expand Down
1 change: 1 addition & 0 deletions indra/newview/llvoavatarself.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class LLVOAvatarSelf :
/*virtual*/ bool setVisualParamWeight(const LLVisualParam *which_param, F32 weight);
/*virtual*/ bool setVisualParamWeight(const char* param_name, F32 weight);
/*virtual*/ bool setVisualParamWeight(S32 index, F32 weight);
/*virtual*/ bool setVisualParamWeight(S32 index, S32 type, F32 weight);
/*virtual*/ void updateVisualParams();
void writeWearablesToAvatar();
/*virtual*/ void idleUpdateAppearanceAnimation();
Expand Down
Loading