diff options
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/kernel_compat_cpu.h | 1 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_textures.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_image.h | 17 |
3 files changed, 18 insertions, 2 deletions
diff --git a/intern/cycles/kernel/kernel_compat_cpu.h b/intern/cycles/kernel/kernel_compat_cpu.h index c882b477c35..3775934f293 100644 --- a/intern/cycles/kernel/kernel_compat_cpu.h +++ b/intern/cycles/kernel/kernel_compat_cpu.h @@ -495,6 +495,7 @@ typedef texture<uint> texture_uint; typedef texture<int> texture_int; typedef texture<uint4> texture_uint4; typedef texture<uchar4> texture_uchar4; +typedef texture<uchar> texture_uchar; typedef texture_image<float> texture_image_float; typedef texture_image<uchar> texture_image_uchar; typedef texture_image<half> texture_image_half; diff --git a/intern/cycles/kernel/kernel_textures.h b/intern/cycles/kernel/kernel_textures.h index 7d6fec02331..8d5bb75a428 100644 --- a/intern/cycles/kernel/kernel_textures.h +++ b/intern/cycles/kernel/kernel_textures.h @@ -188,6 +188,8 @@ KERNEL_TEX(uint, texture_uint, __bindless_mapping) /* packed image (opencl) */ KERNEL_TEX(uchar4, texture_uchar4, __tex_image_byte4_packed) KERNEL_TEX(float4, texture_float4, __tex_image_float4_packed) +KERNEL_TEX(uchar, texture_uchar, __tex_image_byte_packed) +KERNEL_TEX(float, texture_float, __tex_image_float_packed) KERNEL_TEX(uint4, texture_uint4, __tex_image_packed_info) #undef KERNEL_TEX diff --git a/intern/cycles/kernel/svm/svm_image.h b/intern/cycles/kernel/svm/svm_image.h index 9050ce93951..5d02be1fa2f 100644 --- a/intern/cycles/kernel/svm/svm_image.h +++ b/intern/cycles/kernel/svm/svm_image.h @@ -36,13 +36,26 @@ CCL_NAMESPACE_BEGIN ccl_device_inline float4 svm_image_texture_read(KernelGlobals *kg, int id, int offset) { - if(id >= TEX_NUM_FLOAT4_IMAGES) { + /* Float4 */ + if(id < TEX_START_BYTE4_OPENCL) { + return kernel_tex_fetch(__tex_image_float4_packed, offset); + } + /* Byte4 */ + else if(id < TEX_START_FLOAT_OPENCL) { uchar4 r = kernel_tex_fetch(__tex_image_byte4_packed, offset); float f = 1.0f/255.0f; return make_float4(r.x*f, r.y*f, r.z*f, r.w*f); } + /* Float */ + else if(id < TEX_START_BYTE_OPENCL) { + float f = kernel_tex_fetch(__tex_image_float_packed, offset); + return make_float4(f, f, f, 1.0f); + } + /* Byte */ else { - return kernel_tex_fetch(__tex_image_float4_packed, offset); + uchar r = kernel_tex_fetch(__tex_image_byte_packed, offset); + float f = r * (1.0f/255.0f); + return make_float4(f, f, f, 1.0f); } } |