Always use the stable quick tex hash. Doesn't actually make a difference except on new CPU archs.

This commit is contained in:
Henrik Rydgård 2022-04-13 11:18:18 +02:00
parent e6fe31365a
commit f54ed3757c
4 changed files with 7 additions and 21 deletions

View File

@ -316,7 +316,7 @@ protected:
gpuStats.numTextureDataBytesHashed += sizeInRAM;
if (Memory::IsValidAddress(addr + sizeInRAM)) {
return DoQuickTexHash(checkp, sizeInRAM);
return StableQuickTexHash(checkp, sizeInRAM);
} else {
return 0;
}

View File

@ -276,16 +276,6 @@ static u32 QuickTexHashBasic(const void *checkp, u32 size) {
return check;
}
u32 DoQuickTexHash(const void *checkp, u32 size) {
#if defined(_M_SSE)
return QuickTexHashSSE2(checkp, size);
#elif PPSSPP_ARCH(ARM_NEON)
return QuickTexHashNEON(checkp, size);
#else
return QuickTexHashBasic(checkp, size);
#endif
}
u32 StableQuickTexHash(const void *checkp, u32 size) {
#if defined(_M_SSE)
return QuickTexHashSSE2(checkp, size);
@ -388,9 +378,6 @@ void DoUnswizzleTex16(const u8 *texptr, u32 *ydestp, int bxc, int byc, u32 pitch
} else
#elif PPSSPP_ARCH(ARM_NEON)
if (((uintptr_t)ydestp & 0xF) == 0 && (pitch & 0xF) == 0) {
// TODO: Does this really do anything meaningful?
__builtin_prefetch(texptr, 0, 0);
const u32 *src = (const u32 *)texptr;
for (int by = 0; by < byc; by++) {
u32 *xdest = ydestp;

View File

@ -36,7 +36,6 @@ enum CheckAlphaResult {
void DoSwizzleTex16(const u32 *ysrcp, u8 *texptr, int bxc, int byc, u32 pitch);
void DoUnswizzleTex16(const u8 *texptr, u32 *ydestp, int bxc, int byc, u32 pitch);
u32 DoQuickTexHash(const void *checkp, u32 size);
u32 StableQuickTexHash(const void *checkp, u32 size);
CheckAlphaResult CheckAlphaRGBA8888Basic(const u32 *pixelData, int stride, int w, int h);

View File

@ -478,23 +478,23 @@ bool TestQuickTexHash() {
AlignedMem buf(BUF_SIZE, 16);
memset(buf, 0, BUF_SIZE);
EXPECT_EQ_HEX(DoQuickTexHash(buf, BUF_SIZE), 0xaa756edc);
EXPECT_EQ_HEX(StableQuickTexHash(buf, BUF_SIZE), 0xaa756edc);
memset(buf, 1, BUF_SIZE);
EXPECT_EQ_HEX(DoQuickTexHash(buf, BUF_SIZE), 0x66f81b1c);
EXPECT_EQ_HEX(StableQuickTexHash(buf, BUF_SIZE), 0x66f81b1c);
strncpy(buf, "hello", BUF_SIZE);
EXPECT_EQ_HEX(DoQuickTexHash(buf, BUF_SIZE), 0xf6028131);
EXPECT_EQ_HEX(StableQuickTexHash(buf, BUF_SIZE), 0xf6028131);
strncpy(buf, "goodbye", BUF_SIZE);
EXPECT_EQ_HEX(DoQuickTexHash(buf, BUF_SIZE), 0xef81b54f);
EXPECT_EQ_HEX(StableQuickTexHash(buf, BUF_SIZE), 0xef81b54f);
// Simple patterns.
for (int i = 0; i < BUF_SIZE; ++i) {
char *p = buf;
p[i] = i & 0xFF;
}
EXPECT_EQ_HEX(DoQuickTexHash(buf, BUF_SIZE), 0x0d64531c);
EXPECT_EQ_HEX(StableQuickTexHash(buf, BUF_SIZE), 0x0d64531c);
int j = 573;
for (int i = 0; i < BUF_SIZE; ++i) {
@ -502,7 +502,7 @@ bool TestQuickTexHash() {
j += ((i * 7) + (i & 3)) * 11;
p[i] = j & 0xFF;
}
EXPECT_EQ_HEX(DoQuickTexHash(buf, BUF_SIZE), 0x58de8dbc);
EXPECT_EQ_HEX(StableQuickTexHash(buf, BUF_SIZE), 0x58de8dbc);
return true;
}