mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-27 20:28:35 +01:00
Optimize LoadClut a little
This commit is contained in:
1 parent
b04f6b562b
commit
4b98e0d6d6
2 files changed
+16
-1
No files matched your search
@@ -703,10 +703,24 @@ inline bool TextureCache::TexCacheEntry::Matches(u16 dim2, u8 format2, int maxLe
|
||||
|
||||
void TextureCache::LoadClut() {
|
||||
u32 clutAddr = gstate.getClutAddress();
|
||||
clutTotalBytes_ = gstate.getClutLoadBytes();
|
||||
if (Memory::IsValidAddress(clutAddr)) {
|
||||
#if defined(_M_IX86) || defined(_M_X64)
|
||||
int numBlocks = gstate.getClutLoadBlocks();
|
||||
clutTotalBytes_ = numBlocks * 32;
|
||||
const __m128i *source = (const __m128i *)Memory::GetPointerUnchecked(clutAddr);
|
||||
__m128i *dest = (__m128i *)clutBufRaw_;
|
||||
for (int i = 0; i < numBlocks; i++, source += 2, dest += 2) {
|
||||
__m128i data1 = _mm_loadu_si128(source);
|
||||
__m128i data2 = _mm_loadu_si128(source + 1);
|
||||
_mm_store_si128(dest, data1);
|
||||
_mm_store_si128(dest + 1, data2);
|
||||
}
|
||||
#else
|
||||
clutTotalBytes_ = gstate.getClutLoadBytes();
|
||||
Memory::MemcpyUnchecked(clutBufRaw_, clutAddr, clutTotalBytes_);
|
||||
#endif
|
||||
} else {
|
||||
clutTotalBytes_ = gstate.getClutLoadBytes();
|
||||
memset(clutBufRaw_, 0xFF, clutTotalBytes_);
|
||||
}
|
||||
// Reload the clut next time.
|
||||
|
||||
Reference in new issue
Block a user