Blender V5.3
hash.h File Reference
#include "util/defines.h"
#include "util/math.h"
#include "util/types.h"

Go to the source code of this file.

Macros

#define rot(x, k)
#define mix(a, b, c)
#define final(a, b, c)

Functions

CCL_NAMESPACE_BEGIN ccl_device_forceinline float uint_to_float_excl (const uint n)
ccl_device_forceinline float uint_to_float_incl (const uint n)
ccl_ignore_integer_overflow ccl_device_inline int2 hash_pcg2d_i (int2 v)
ccl_ignore_integer_overflow ccl_device_inline int3 hash_pcg3d_i (int3 v)
ccl_ignore_integer_overflow ccl_device_inline int4 hash_pcg4d_i (int4 v)
ccl_device_inline uint hash_uint (const uint kx)
ccl_device_inline uint hash_uint2 (const uint kx, const uint ky)
ccl_device_inline uint hash_uint3 (const uint kx, const uint ky, const uint kz)
ccl_device_inline uint hash_uint4 (const uint kx, const uint ky, const uint kz, const uint kw)
ccl_device_inline float hash_uint_to_float (const uint kx)
ccl_device_inline float hash_uint2_to_float (const uint kx, const uint ky)
ccl_device_inline float hash_uint3_to_float (const uint kx, const uint ky, const uint kz)
ccl_device_inline float hash_uint4_to_float (const uint kx, const uint ky, const uint kz, const uint kw)
ccl_device_inline float hash_float_to_float (const float k)
ccl_device_inline float hash_float2_to_float (const float2 k)
ccl_device_inline float hash_float3_to_float (const float3 k)
ccl_device_inline float hash_float4_to_float (const float4 k)
ccl_device_inline float2 hash_int2_to_float2 (const int2 k)
ccl_device_inline float3 hash_int3_to_float3 (const int3 k)
ccl_device_inline float4 hash_int4_to_float4 (const int4 k)
ccl_device_inline float3 hash_int2_to_float3 (const int2 k)
ccl_device_inline float3 hash_int4_to_float3 (const int4 k)
ccl_device_inline float2 hash_float2_to_float2 (const float2 k)
ccl_device_inline float3 hash_float3_to_float3 (const float3 k)
ccl_device_inline float4 hash_float4_to_float4 (const float4 k)
ccl_device_inline float3 hash_float_to_float3 (const float k)
ccl_device_inline float3 hash_float2_to_float3 (const float2 k)
ccl_device_inline float3 hash_float4_to_float3 (const float4 k)
ccl_device_inline float2 hash_float_to_float2 (const float k)
ccl_device_inline float2 hash_float3_to_float2 (const float3 k)
ccl_device_inline float2 hash_float4_to_float2 (const float4 k)
ccl_device_inline uint hash_hp_uint (uint i)
ccl_device_inline uint hash_hp_seeded_uint (const uint i, uint seed)
ccl_device_inline float hash_hp_float (const uint i)
ccl_device_inline float hash_hp_seeded_float (const uint i, const uint seed)
ccl_device_inline uint hash_wang_seeded_uint (uint i, const uint seed)
ccl_device_inline float hash_wang_seeded_float (const uint i, const uint seed)
ccl_device_inline uint hash_shuffle_uint (uint i, const uint length, const uint seed)
ccl_device_inline uint hash_iqnt2d (const uint x, const uint y)
static uint hash_string (const char *str)

Macro Definition Documentation

◆ final

#define final ( a,
b,
c )
Value:
{ \
c ^= b; \
c -= rot(b, 14); \
a ^= c; \
a -= rot(c, 11); \
b ^= a; \
b -= rot(a, 25); \
c ^= b; \
c -= rot(b, 16); \
a ^= c; \
a -= rot(c, 4); \
b ^= a; \
b -= rot(a, 14); \
c ^= b; \
c -= rot(b, 24); \
} \
((void)0)
#define rot(x, k)

Definition at line 107 of file hash.h.

◆ mix

#define mix ( a,
b,
c )
Value:
{ \
a -= c; \
a ^= rot(c, 4); \
c += b; \
b -= a; \
b ^= rot(a, 6); \
a += c; \
c -= b; \
c ^= rot(b, 8); \
b += a; \
a -= c; \
a ^= rot(c, 16); \
c += b; \
b -= a; \
b ^= rot(a, 19); \
a += c; \
c -= b; \
c ^= rot(b, 4); \
b += a; \
} \
((void)0)

Definition at line 84 of file hash.h.

◆ rot

#define rot ( x,
k )
Value:
(((x) << (k)) | ((x) >> (32 - (k))))

Definition at line 82 of file hash.h.

Function Documentation

◆ hash_float2_to_float()

◆ hash_float2_to_float2()

◆ hash_float2_to_float3()

◆ hash_float3_to_float()

◆ hash_float3_to_float2()

◆ hash_float3_to_float3()

◆ hash_float4_to_float()

◆ hash_float4_to_float2()

◆ hash_float4_to_float3()

◆ hash_float4_to_float4()

ccl_device_inline float4 hash_float4_to_float4 ( const float4 k)

◆ hash_float_to_float()

ccl_device_inline float hash_float_to_float ( const float k)

◆ hash_float_to_float2()

ccl_device_inline float2 hash_float_to_float2 ( const float k)

◆ hash_float_to_float3()

◆ hash_hp_float()

ccl_device_inline float hash_hp_float ( const uint i)

◆ hash_hp_seeded_float()

ccl_device_inline float hash_hp_seeded_float ( const uint i,
const uint seed )

◆ hash_hp_seeded_uint()

ccl_device_inline uint hash_hp_seeded_uint ( const uint i,
uint seed )

◆ hash_hp_uint()

◆ hash_int2_to_float2()

◆ hash_int2_to_float3()

◆ hash_int3_to_float3()

◆ hash_int4_to_float3()

◆ hash_int4_to_float4()

◆ hash_iqnt2d()

ccl_device_inline uint hash_iqnt2d ( const uint x,
const uint y )

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

Definition at line 625 of file hash.h.

References ccl_device_inline, hash_iqnt2d(), x, and y.

Referenced by hash_iqnt2d(), and path_rng_pixel_init().

◆ hash_pcg2d_i()

◆ hash_pcg3d_i()

◆ hash_pcg4d_i()

◆ hash_shuffle_uint()

ccl_device_inline uint hash_shuffle_uint ( uint i,
const uint length,
const uint seed )

◆ hash_string()

uint hash_string ( const char * str)
inlinestatic

Definition at line 637 of file hash.h.

References str.

◆ hash_uint()

ccl_device_inline uint hash_uint ( const uint kx)

Definition at line 126 of file hash.h.

References b, ccl_device_inline, and hash_uint().

◆ hash_uint2()

ccl_device_inline uint hash_uint2 ( const uint kx,
const uint ky )

Definition at line 139 of file hash.h.

References b, ccl_device_inline, and hash_uint2().

◆ hash_uint2_to_float()

ccl_device_inline float hash_uint2_to_float ( const uint kx,
const uint ky )

Definition at line 197 of file hash.h.

References ccl_device_inline, hash_uint2(), hash_uint2_to_float(), and uint_to_float_incl().

◆ hash_uint3()

ccl_device_inline uint hash_uint3 ( const uint kx,
const uint ky,
const uint kz )

Definition at line 153 of file hash.h.

References b, ccl_device_inline, and hash_uint3().

◆ hash_uint3_to_float()

ccl_device_inline float hash_uint3_to_float ( const uint kx,
const uint ky,
const uint kz )

Definition at line 202 of file hash.h.

References ccl_device_inline, hash_uint3(), hash_uint3_to_float(), and uint_to_float_incl().

◆ hash_uint4()

ccl_device_inline uint hash_uint4 ( const uint kx,
const uint ky,
const uint kz,
const uint kw )

Definition at line 168 of file hash.h.

References b, ccl_device_inline, hash_uint4(), and mix.

◆ hash_uint4_to_float()

ccl_device_inline float hash_uint4_to_float ( const uint kx,
const uint ky,
const uint kz,
const uint kw )

Definition at line 207 of file hash.h.

References ccl_device_inline, hash_uint4(), hash_uint4_to_float(), and uint_to_float_incl().

◆ hash_uint_to_float()

ccl_device_inline float hash_uint_to_float ( const uint kx)

Definition at line 192 of file hash.h.

References ccl_device_inline, hash_uint(), hash_uint_to_float(), and uint_to_float_incl().

◆ hash_wang_seeded_float()

◆ hash_wang_seeded_uint()

ccl_device_inline uint hash_wang_seeded_uint ( uint i,
const uint seed )

◆ uint_to_float_excl()

◆ uint_to_float_incl()