Last active
October 19, 2020 08:53
-
-
Save warmist/f5183b4cd424b79238796eabbcca9965 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//from Hash Functions for GPU Rendering (Jarzynski et al.) | |
//http://www.jcgt.org/published/0009/03/02/ | |
uint3 pcg3d(uint3 v) | |
{ | |
v = v * 1664525u + 1013904223u; | |
v.x += v.y*v.z; v.y += v.z*v.x; v.z += v.x*v.y; | |
v ˆ= v >> 16u; | |
v.x += v.y*v.z; v.y += v.z*v.x; v.z += v.x*v.y; | |
return v; | |
} | |
uint4 pcg4d(uint4 v) | |
{ | |
v = v * 1664525u + 1013904223u; | |
v.x += v.y*v.w; v.y += v.z*v.x; v.z += v.x*v.y; v.w += v.y*v.z; | |
v ˆ= v >> 16u; | |
v.x += v.y*v.w; v.y += v.z*v.x; v.z += v.x*v.y; v.w += v.y*v.z; | |
return v; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment