Blender V5.0
kernel.h File Reference

Go to the source code of this file.

Macros

#define KERNEL_NAME_JOIN(x, y, z)
#define KERNEL_NAME_EVAL(arch, name)
#define KERNEL_FUNCTION_FULL_NAME(name)
#define KERNEL_ARCH   cpu
#define KERNEL_ARCH   cpu_avx2

Functions

KernelGlobalsCPUkernel_globals_create ()
void kernel_globals_free (KernelGlobalsCPU *kg)
void * kernel_osl_memory (const KernelGlobalsCPU *kg)
bool kernel_osl_use (const KernelGlobalsCPU *kg)
void kernel_const_copy (KernelGlobalsCPU *kg, const char *name, void *host, const size_t size)
void kernel_global_memory_copy (KernelGlobalsCPU *kg, const char *name, void *mem, const size_t size)

Macro Definition Documentation

◆ KERNEL_ARCH [1/2]

#define KERNEL_ARCH   cpu_avx2

Definition at line 35 of file kernel/device/cpu/kernel.h.

◆ KERNEL_ARCH [2/2]

#define KERNEL_ARCH   cpu

Definition at line 35 of file kernel/device/cpu/kernel.h.

◆ KERNEL_FUNCTION_FULL_NAME

#define KERNEL_FUNCTION_FULL_NAME ( name)
Value:
#define KERNEL_ARCH
#define KERNEL_NAME_EVAL(arch, name)
const char * name

Definition at line 17 of file kernel/device/cpu/kernel.h.

Referenced by shader_eval_displace().

◆ KERNEL_NAME_EVAL

#define KERNEL_NAME_EVAL ( arch,
name )
Value:
KERNEL_NAME_JOIN(kernel, arch, name)
#define KERNEL_NAME_JOIN(x, y, z)

Definition at line 16 of file kernel/device/cpu/kernel.h.

◆ KERNEL_NAME_JOIN

#define KERNEL_NAME_JOIN ( x,
y,
z )
Value:
x##_##y##_##z
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
Definition btQuadWord.h:117

Definition at line 15 of file kernel/device/cpu/kernel.h.

Function Documentation

◆ kernel_const_copy()

void kernel_const_copy ( KernelGlobalsCPU * kg,
const char * name,
void * host,
const size_t size )

Definition at line 56 of file kernel/device/cpu/kernel.cpp.

References assert, KernelGlobalsCPU::data, and name.

Referenced by CPUDevice::const_copy_to().

◆ kernel_global_memory_copy()

void kernel_global_memory_copy ( KernelGlobalsCPU * kg,
const char * name,
void * mem,
const size_t size )

RGBE format represents an RGB value with 4 bytes.

The original implementation by Greg Ward uses 8 bits for RGB each, plus 8 bits shared exponent. It has the same relative precision as the 0 to 255 range of standard 24-bit image formats, but offers extended intensity range: https://www.graphics.cornell.edu/~bjw/rgbe.html GL_EXT_texture_shared_exponent uses 9 bits for RGB and 5 bits for exponent instead, with smaller range but higher precision: https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_shared_exponent.txt

Our implementation is mostly based on GL_EXT_texture_shared_exponent, but uses 8 bits for RGB each, and adds 3 sign bits to represent negative values. The memory layout is as follows:

   xxxxxxxx  xxxxxxxx  xxxxxxxx  xxx  xxxxx
     m(R)      m(G)      m(B)    sgn   exp

Each float component is interpreted as sgn exp - bias f = (-1) * 0.m * 2

We choose a bias of 15, so that the largest representable value is RGBE_MAX = 0.11111111 * 2^(31 - 15) = 65280, and the smallest positive representable value is RGBE_MIN = 0.00000001 * 2^(0 - 15) = 1.1920929e-7

Definition at line 66 of file kernel/device/cpu/kernel.cpp.

References assert, name, and size().

Referenced by CPUDevice::global_alloc().

◆ kernel_globals_create()

KernelGlobalsCPU * kernel_globals_create ( )

◆ kernel_globals_free()

void kernel_globals_free ( KernelGlobalsCPU * kg)

◆ kernel_osl_memory()

void * kernel_osl_memory ( const KernelGlobalsCPU * kg)

◆ kernel_osl_use()

bool kernel_osl_use ( const KernelGlobalsCPU * kg)

References name, and size().