SL-18459 WIP -- fix for assert in setGLTFMaterial

meow-7.2.2
Dave Parks 2022-10-27 11:27:21 -05:00
parent eb4581edf2
commit 0451d51f4d
5 changed files with 31 additions and 16 deletions

View File

@ -340,4 +340,28 @@ private:
bool mStayUnique;
};
// boost hash adapter
template <class Type>
struct boost::hash<LLPointer<Type>>
{
typedef LLPointer<Type> argument_type;
typedef std::size_t result_type;
result_type operator()(argument_type const& s) const
{
return (std::size_t) s.get();
}
};
// Adapt boost hash to std hash
namespace std
{
template<class Type> struct hash<LLPointer<Type>>
{
std::size_t operator()(LLPointer<Type> const& s) const noexcept
{
return boost::hash<LLPointer<Type>>()(s);
}
};
}
#endif

View File

@ -42,6 +42,7 @@
#include "llrect.h"
#include "llappviewer.h" // for gFrameTimeSeconds
#include "llvieweroctree.h"
#include <unordered_set>
class LLCamera;
class LLDrawPool;
@ -223,7 +224,8 @@ public:
friend class LLDrawPool;
friend class LLSpatialBridge;
typedef std::set<LLPointer<LLDrawable> > drawable_set_t;
typedef std::unordered_set<LLPointer<LLDrawable> > drawable_set_t;
typedef std::set<LLPointer<LLDrawable> > ordered_drawable_set_t;
typedef std::vector<LLPointer<LLDrawable> > drawable_vector_t;
typedef std::list<LLPointer<LLDrawable> > drawable_list_t;
typedef std::queue<LLPointer<LLDrawable> > drawable_queue_t;

View File

@ -7234,22 +7234,11 @@ void LLViewerObject::setRenderMaterialIDs(const LLRenderMaterialParams* material
{
if (!local_origin)
{
const S32 num_tes = llmin((S32)getNumTEs(), (S32)getNumFaces()); // avatars have TEs but no faces
for (S32 te = 0; te < num_tes; ++te)
for (S32 te = 0; te < getNumTEs(); ++te)
{
const LLUUID& id = material_params ? material_params->getMaterial(te) : LLUUID::null;
if (id.notNull())
{
getTE(te)->setGLTFMaterial(gGLTFMaterialList.getMaterial(id));
setHasRenderMaterialParams(true);
}
else
{
getTE(te)->setGLTFMaterial(nullptr);
}
setRenderMaterialID(te, id, false);
}
faceMappingChanged();
gPipeline.markTextured(mDrawable);
}
}

View File

@ -6150,7 +6150,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)
// FIND NEW LIGHTS THAT ARE IN RANGE
light_set_t new_nearby_lights;
for (LLDrawable::drawable_set_t::iterator iter = mLights.begin();
for (LLDrawable::ordered_drawable_set_t::iterator iter = mLights.begin();
iter != mLights.end(); ++iter)
{
LLDrawable* drawable = *iter;

View File

@ -798,7 +798,7 @@ protected:
};
typedef std::set< Light, Light::compare > light_set_t;
LLDrawable::drawable_set_t mLights;
LLDrawable::ordered_drawable_set_t mLights;
light_set_t mNearbyLights; // lights near camera
LLColor4 mHWLightColors[8];