diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-11-12 01:18:46 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-11-12 01:18:46 +0300 |
commit | c29795452cc71cb9f5a571a4aff0f593a2d7acaf (patch) | |
tree | 53a46bb77f3102c545f7e55d3344e310b3bf6116 /intern/cycles/util/half.h | |
parent | 9980fd0b8e1f3a07060316f28469f55a3f2fc0cd (diff) | |
parent | 03ccf37162d365f3fdc8d8cd0cd6e9ff314fec6e (diff) |
Merge branch 'master' into temp-sculpt-roll-mappingtemp-sculpt-roll-mapping
Diffstat (limited to 'intern/cycles/util/half.h')
-rw-r--r-- | intern/cycles/util/half.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/intern/cycles/util/half.h b/intern/cycles/util/half.h index c668638eb02..5665dd4c075 100644 --- a/intern/cycles/util/half.h +++ b/intern/cycles/util/half.h @@ -154,17 +154,17 @@ ccl_device_inline half float_to_half_display(const float f) ccl_device_inline half4 float4_to_half4_display(const float4 f) { -#ifdef __KERNEL_SSE2__ +#ifdef __KERNEL_SSE__ /* CPU: SSE and AVX. */ - ssef x = min(max(load4f(f), 0.0f), 65504.0f); + float4 x = min(max(f, make_float4(0.0f)), make_float4(65504.0f)); # ifdef __KERNEL_AVX2__ - ssei rpack = _mm_cvtps_ph(x, 0); + int4 rpack = int4(_mm_cvtps_ph(x, 0)); # else - ssei absolute = cast(x) & 0x7FFFFFFF; - ssei Z = absolute + 0xC8000000; - ssei result = andnot(absolute < 0x38800000, Z); - ssei rshift = (result >> 13) & 0x7FFF; - ssei rpack = _mm_packs_epi32(rshift, rshift); + int4 absolute = cast(x) & make_int4(0x7FFFFFFF); + int4 Z = absolute + make_int4(0xC8000000); + int4 result = andnot(absolute < make_int4(0x38800000), Z); + int4 rshift = (result >> 13) & make_int4(0x7FFF); + int4 rpack = int4(_mm_packs_epi32(rshift, rshift)); # endif half4 h; _mm_storel_pi((__m64 *)&h, _mm_castsi128_ps(rpack)); |