diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-12-30 17:04:01 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-12-30 17:04:04 +0300 |
commit | 3918c8b9a52ae9dcdb0488df92d7d3ca615be8c7 (patch) | |
tree | 3740e477610ab3ed020d505cd98308d29f663f5b /intern/cycles/kernel/kernel_bake.h | |
parent | c8a551bf13edf711b93ea89cd3fcd244e4206cee (diff) |
Cycles: Optionally output luminance from the shader evaluation kernel
This makes it possible to move some parts of evaluation from host to the device
and hopefully reduce memory usage by avoid having full RGBA buffer on the host.
Reviewers: juicyfruit, lukasstockner97, brecht
Reviewed By: lukasstockner97, brecht
Differential Revision: https://developer.blender.org/D1702
Diffstat (limited to 'intern/cycles/kernel/kernel_bake.h')
-rw-r--r-- | intern/cycles/kernel/kernel_bake.h | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/intern/cycles/kernel/kernel_bake.h b/intern/cycles/kernel/kernel_bake.h index 715c11c7ea0..b54afbd21b8 100644 --- a/intern/cycles/kernel/kernel_bake.h +++ b/intern/cycles/kernel/kernel_bake.h @@ -453,7 +453,13 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input, output[i] += make_float4(out.x, out.y, out.z, 1.0f) * output_fac; } -ccl_device void kernel_shader_evaluate(KernelGlobals *kg, ccl_global uint4 *input, ccl_global float4 *output, ShaderEvalType type, int i, int sample) +ccl_device void kernel_shader_evaluate(KernelGlobals *kg, + ccl_global uint4 *input, + ccl_global float4 *output, + ccl_global float *output_luma, + ShaderEvalType type, + int i, + int sample) { ShaderData sd; uint4 in = input[i]; @@ -500,10 +506,22 @@ ccl_device void kernel_shader_evaluate(KernelGlobals *kg, ccl_global uint4 *inpu } /* write output */ - if(sample == 0) - output[i] = make_float4(out.x, out.y, out.z, 0.0f); - else - output[i] += make_float4(out.x, out.y, out.z, 0.0f); + if(sample == 0) { + if(output != NULL) { + output[i] = make_float4(out.x, out.y, out.z, 0.0f); + } + if(output_luma != NULL) { + output_luma[i] = average(out); + } + } + else { + if(output != NULL) { + output[i] += make_float4(out.x, out.y, out.z, 0.0f); + } + if(output_luma != NULL) { + output_luma[i] += average(out); + } + } } CCL_NAMESPACE_END |