[PICA] Switch to xxh3 by default

This commit is contained in:
wheremyfoodat 2023-06-14 15:39:29 +03:00
parent f82b27ddba
commit f0f7327b90
4 changed files with 60 additions and 23 deletions

View file

@ -0,0 +1,16 @@
#pragma once
#include <cstdint>
#include <cstddef>
// Defines to pick which hash algorithm to use for the PICA (For hashing shaders, etc)
// Please only define one of them
//#define PANDA3DS_PICA_CITYHASH
#define PANDA3DS_PICA_XXHASH3
namespace PICAHash {
#if defined(PANDA3DS_PICA_CITYHASH) || defined(PANDA3DS_PICA_XXHASH3)
using HashType = std::uint64_t;
#endif
HashType computeHash(const char* buf, std::size_t len);
} // namespace PICAHash

View file

@ -5,6 +5,7 @@
#include "helpers.hpp"
#include "opengl.hpp"
#include "PICA/float_types.hpp"
#include "PICA/pica_hash.hpp"
enum class ShaderType {
Vertex, Geometry
@ -105,7 +106,7 @@ protected:
// We use a hashmap for matching 3DS shaders to their equivalent compiled code in our shader cache in the shader JIT
// We choose our hash type to be a 64-bit integer by default, as the collision chance is very tiny and generating it is decently optimal
// Ideally we want to be able to support multiple different types of hash depending on compilation settings, but let's get this working first
using Hash = u64;
using Hash = PICAHash::HashType;
Hash lastCodeHash = 0; // Last hash computed for the shader code (Used for the JIT caching mechanism)
Hash lastOpdescHash = 0; // Last hash computed for the operand descriptors (Also used for the JIT)