Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/util/util_half.h
| Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | |||||
| #endif | #endif | ||||
| struct half4 { | struct half4 { | ||||
| half x, y, z, w; | half x, y, z, w; | ||||
| }; | }; | ||||
| #if defined(__KERNEL_CUDA__) || defined(__KERNEL_HIP__) | #if defined(__KERNEL_CUDA__) || defined(__KERNEL_HIP__) | ||||
| ccl_device_inline void float4_store_half(half *h, float4 f) | ccl_device_inline void float4_store_half(ccl_private half *h, float4 f) | ||||
| { | { | ||||
| h[0] = __float2half(f.x); | h[0] = __float2half(f.x); | ||||
| h[1] = __float2half(f.y); | h[1] = __float2half(f.y); | ||||
| h[2] = __float2half(f.z); | h[2] = __float2half(f.z); | ||||
| h[3] = __float2half(f.w); | h[3] = __float2half(f.w); | ||||
| } | } | ||||
| #else | #else | ||||
| ccl_device_inline void float4_store_half(half *h, float4 f) | ccl_device_inline void float4_store_half(ccl_private half *h, float4 f) | ||||
| { | { | ||||
| # ifndef __KERNEL_SSE2__ | # ifndef __KERNEL_SSE2__ | ||||
| for (int i = 0; i < 4; i++) { | for (int i = 0; i < 4; i++) { | ||||
| /* optimized float to half for pixels: | /* optimized float to half for pixels: | ||||
| * assumes no negative, no nan, no inf, and sets denormal to 0 */ | * assumes no negative, no nan, no inf, and sets denormal to 0 */ | ||||
| union { | union { | ||||
| uint i; | uint i; | ||||
| ▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines | |||||