Cycles: Cleanup: Remove unused hash function

Also move the remaining one to util/hash.h.
This commit is contained in:
Lukas Stockner 2024-05-13 02:48:54 +02:00
parent 4a1597e39a
commit 12bf5ff7d4
2 changed files with 14 additions and 27 deletions

View file

@ -100,33 +100,6 @@ ccl_device_forceinline float4 path_rng_4D(KernelGlobals kg,
}
}
/**
* 1D hash recommended from "Hash Functions for GPU Rendering" JCGT Vol. 9, No. 3, 2020
* See https://www.shadertoy.com/view/4tXyWN and https://www.shadertoy.com/view/XlGcRh
* http://www.jcgt.org/published/0009/03/02/paper.pdf
*/
ccl_device_inline uint hash_iqint1(uint n)
{
n = (n << 13U) ^ n;
n = n * (n * n * 15731U + 789221U) + 1376312589U;
return n;
}
/**
* 2D hash recommended from "Hash Functions for GPU Rendering" JCGT Vol. 9, No. 3, 2020
* See https://www.shadertoy.com/view/4tXyWN and https://www.shadertoy.com/view/XlGcRh
* http://www.jcgt.org/published/0009/03/02/paper.pdf
*/
ccl_device_inline uint hash_iqnt2d(const uint x, const uint y)
{
const uint qx = 1103515245U * ((x >> 1U) ^ (y));
const uint qy = 1103515245U * ((y >> 1U) ^ (x));
const uint n = 1103515245U * ((qx) ^ (qy >> 3U));
return n;
}
ccl_device_inline uint path_rng_hash_init(KernelGlobals kg,
const int sample,
const int x,

View file

@ -493,6 +493,20 @@ ccl_device_inline uint hash_shuffle_uint(uint i, uint length, uint seed)
return i;
}
/**
* 2D hash recommended from "Hash Functions for GPU Rendering" JCGT Vol. 9, No. 3, 2020
* See https://www.shadertoy.com/view/4tXyWN and https://www.shadertoy.com/view/XlGcRh
* http://www.jcgt.org/published/0009/03/02/paper.pdf
*/
ccl_device_inline uint hash_iqnt2d(const uint x, const uint y)
{
const uint qx = 1103515245U * ((x >> 1U) ^ (y));
const uint qy = 1103515245U * ((y >> 1U) ^ (x));
const uint n = 1103515245U * ((qx) ^ (qy >> 3U));
return n;
}
/* ********** */
#ifndef __KERNEL_GPU__