From 0bbb61e5d24b7735c986496902c0b99adf88c770 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sun, 19 Mar 2017 12:08:21 +0100 Subject: [PATCH] Vertexcache ComputeMiniHashRange: Doesn't make sense to hash more data than the step size. --- GPU/D3D11/DrawEngineD3D11.cpp | 3 ++- GPU/Directx9/DrawEngineDX9.cpp | 3 ++- GPU/GLES/DrawEngineGLES.cpp | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/GPU/D3D11/DrawEngineD3D11.cpp b/GPU/D3D11/DrawEngineD3D11.cpp index 15f2d18bdf..6a0bcdb06e 100644 --- a/GPU/D3D11/DrawEngineD3D11.cpp +++ b/GPU/D3D11/DrawEngineD3D11.cpp @@ -444,9 +444,10 @@ inline u32 ComputeMiniHashRange(const void *ptr, size_t sz) { if (sz > 100) { size_t step = sz / 4; + size_t len = std::min((int)step, 100); u32 hash = 0; for (size_t i = 0; i < sz; i += step) { - hash += DoReliableHash32(p + i, 100, 0x3A44B9C4); + hash += DoReliableHash32(p + i, len, 0x3A44B9C4); } return hash; } else { diff --git a/GPU/Directx9/DrawEngineDX9.cpp b/GPU/Directx9/DrawEngineDX9.cpp index 5c1510c60b..55f2cf9fd7 100644 --- a/GPU/Directx9/DrawEngineDX9.cpp +++ b/GPU/Directx9/DrawEngineDX9.cpp @@ -428,9 +428,10 @@ inline u32 ComputeMiniHashRange(const void *ptr, size_t sz) { if (sz > 100) { size_t step = sz / 4; + size_t len = std::min((int)step, 100); u32 hash = 0; for (size_t i = 0; i < sz; i += step) { - hash += DoReliableHash32(p + i, 100, 0x3A44B9C4); + hash += DoReliableHash32(p + i, len, 0x3A44B9C4); } return hash; } else { diff --git a/GPU/GLES/DrawEngineGLES.cpp b/GPU/GLES/DrawEngineGLES.cpp index 4034684bc7..0eae334cc7 100644 --- a/GPU/GLES/DrawEngineGLES.cpp +++ b/GPU/GLES/DrawEngineGLES.cpp @@ -445,8 +445,9 @@ inline u32 ComputeMiniHashRange(const void *ptr, size_t sz) { if (sz > 100) { size_t step = sz / 4; u32 hash = 0; + size_t len = std::min((int)step, 100); for (size_t i = 0; i < sz; i += step) { - hash += DoReliableHash32(p + i, 100, 0x3A44B9C4); + hash += DoReliableHash32(p + i, len, 0x3A44B9C4); } return hash; } else {