diff options
author | Thomas Dinges <blender@dingto.org> | 2016-06-19 18:31:16 +0300 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2016-06-19 18:31:16 +0300 |
commit | 6311a9ff234aecb054121bf12ad03da6242fc092 (patch) | |
tree | 944abfd285251449ab9d3cccc54b37715ac4e0f6 /intern/cycles/kernel/kernel_compat_cpu.h | |
parent | 7da189b4e8b1afed32716b6b2c127a93a35d498e (diff) |
Cycles: Support half and half4 textures.
This is an initial commit for half texture support in Cycles.
It adds the basic infrastructure inside of the ImageManager and support for these textures on CPU.
Supported:
* Half Float OpenEXR images (can be used for e.g HDRs or Normalmaps) now use 1/2 the memory, when loaded via disk (OIIO).
ToDo:
Various things like support for inbuilt half textures, GPU... will come later, step by step.
Part of my GSoC 2016.
Diffstat (limited to 'intern/cycles/kernel/kernel_compat_cpu.h')
-rw-r--r-- | intern/cycles/kernel/kernel_compat_cpu.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/intern/cycles/kernel/kernel_compat_cpu.h b/intern/cycles/kernel/kernel_compat_cpu.h index bb303b32705..c882b477c35 100644 --- a/intern/cycles/kernel/kernel_compat_cpu.h +++ b/intern/cycles/kernel/kernel_compat_cpu.h @@ -122,6 +122,17 @@ template<typename T> struct texture_image { return make_float4(r, r, r, 1.0f); } + ccl_always_inline float4 read(half4 r) + { + return half4_to_float4(r); + } + + ccl_always_inline float4 read(half r) + { + float f = half_to_float(r); + return make_float4(f, f, f, 1.0f); + } + ccl_always_inline int wrap_periodic(int x, int width) { x %= width; @@ -486,8 +497,10 @@ typedef texture<uint4> texture_uint4; typedef texture<uchar4> texture_uchar4; typedef texture_image<float> texture_image_float; typedef texture_image<uchar> texture_image_uchar; +typedef texture_image<half> texture_image_half; typedef texture_image<float4> texture_image_float4; typedef texture_image<uchar4> texture_image_uchar4; +typedef texture_image<half4> texture_image_half4; /* Macros to handle different memory storage on different devices */ |