From 2c02a04c464c2f5c6e211ceb7b21255eaca7e087 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 1 Nov 2017 19:00:42 +0100 Subject: Code refactor: remove emission and background closures, sum directly. --- intern/cycles/kernel/kernel_types.h | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'intern/cycles/kernel/kernel_types.h') diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index d1733d8a6e7..acd06b57a81 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -812,7 +812,7 @@ enum ShaderDataFlag { /* Set when ray hits backside of surface. */ SD_BACKFACING = (1 << 0), - /* Shader has emissive closure. */ + /* Shader has non-zero emission. */ SD_EMISSION = (1 << 1), /* Shader has BSDF closure. */ SD_BSDF = (1 << 2), @@ -970,16 +970,6 @@ typedef ccl_addr_space struct ShaderData { Transform ob_itfm; #endif - /* Closure data, we store a fixed array of closures */ - struct ShaderClosure closure[MAX_CLOSURE]; - int num_closure; - int num_closure_extra; - float randb_closure; - float3 svm_closure_weight; - - /* LCG state for closures that require additional random numbers. */ - uint lcg_state; - /* ray start position, only set for backgrounds */ float3 ray_P; differential3 ray_dP; @@ -988,6 +978,22 @@ typedef ccl_addr_space struct ShaderData { struct KernelGlobals *osl_globals; struct PathState *osl_path_state; #endif + + /* LCG state for closures that require additional random numbers. */ + uint lcg_state; + + /* Closure data, we store a fixed array of closures */ + int num_closure; + int num_closure_extra; + float randb_closure; + float3 svm_closure_weight; + + /* Closure weights summed directly, so we can evaluate + * emission and shadow transparency with MAX_CLOSURE 0. */ + float3 closure_emission_background; + + /* At the end so we can adjust size in ShaderDataTinyStorage. */ + struct ShaderClosure closure[MAX_CLOSURE]; } ShaderData; /* Path State */ -- cgit v1.2.3