23 lines
512 B
GLSL
23 lines
512 B
GLSL
#ifdef _ONE_AT_A_TIME_
|
|
|
|
uint x;
|
|
|
|
void init_random_state_one_at_a_time(in float seed) {
|
|
x = ((gl_GlobalInvocationID.y << 16) | (gl_GlobalInvocationID.x)) + floatBitsToInt(seed);
|
|
}
|
|
|
|
// A single iteration of Bob Jenkins' One-At-A-Time hashing algorithm.
|
|
uint one_at_a_time_hash() {
|
|
x += (x << 10u);
|
|
x ^= (x >> 6u);
|
|
x += (x << 3u);
|
|
x ^= (x >> 11u);
|
|
x += (x << 15u);
|
|
return x;
|
|
}
|
|
|
|
#define HASH_FUNCTION one_at_a_time_hash
|
|
#define INIT_STATE_FUNCTION init_random_state_one_at_a_time
|
|
|
|
#endif
|