From a710bf9067bd4c4217b9febc0ad277a1636ec882 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 9 Jan 2023 15:18:57 -0600 Subject: SL-18869 Optimizations -- Use _mm_prefetch to cut down on cache misses when iterating over render batches. --- indra/newview/llspatialpartition.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'indra/newview/llspatialpartition.h') diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 020a010405..b765bd1632 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -87,8 +87,6 @@ public: // return mSkinHash->mHash, or 0 if mSkinHash is null U64 getSkinHash(); - LLVector4a mExtents[2]; - LLPointer mVertexBuffer; LLPointer mTexture; std::vector > mTextureList; @@ -505,6 +503,23 @@ public: typedef LLDrawInfo** drawinfo_iterator; typedef LLDrawable** drawable_iterator; + // Helper function for taking advantage of _mm_prefetch when iterating over cull results + static inline void increment_iterator(LLCullResult::drawinfo_iterator& i, const LLCullResult::drawinfo_iterator& end) + { + ++i; + + if (i != end) + { + _mm_prefetch((char*)(*i)->mVertexBuffer.get(), _MM_HINT_NTA); + + auto* ni = i + 1; + if (ni != end) + { + _mm_prefetch((char*)*ni, _MM_HINT_NTA); + } + } + } + void clear(); sg_iterator beginVisibleGroups(); -- cgit v1.2.3