Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/kernel_bake.h
| Show First 20 Lines • Show All 250 Lines • ▼ Show 20 Lines | ccl_device float3 kernel_bake_evaluate_direct_indirect(KernelGlobals *kg, | ||||
| return out; | return out; | ||||
| } | } | ||||
| ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input, ccl_global float4 *output, | ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input, ccl_global float4 *output, | ||||
| ShaderEvalType type, int pass_filter, int i, int offset, int sample) | ShaderEvalType type, int pass_filter, int i, int offset, int sample) | ||||
| { | { | ||||
| ShaderData sd; | ShaderData sd; | ||||
| #ifndef __KERNEL_OPENCL__ | |||||
| ShaderClosure sd_closure[MAX_MAIN_CLOSURE]; | |||||
| sd.closure = sd_closure; | |||||
| sd.max_closure = MAX_MAIN_CLOSURE; | |||||
| #endif | |||||
| PathState state = {0}; | PathState state = {0}; | ||||
| uint4 in = input[i * 2]; | uint4 in = input[i * 2]; | ||||
| uint4 diff = input[i * 2 + 1]; | uint4 diff = input[i * 2 + 1]; | ||||
| float3 out = make_float3(0.0f, 0.0f, 0.0f); | float3 out = make_float3(0.0f, 0.0f, 0.0f); | ||||
| int object = in.x; | int object = in.x; | ||||
| int prim = in.y; | int prim = in.y; | ||||
| ▲ Show 20 Lines • Show All 191 Lines • ▼ Show 20 Lines | #ifdef __RAY_DIFFERENTIALS__ | ||||
| ray.dP = differential3_zero(); | ray.dP = differential3_zero(); | ||||
| #endif | #endif | ||||
| /* setup shader data */ | /* setup shader data */ | ||||
| shader_setup_from_background(kg, &sd, &ray); | shader_setup_from_background(kg, &sd, &ray); | ||||
| /* evaluate */ | /* evaluate */ | ||||
| int flag = 0; /* we can't know which type of BSDF this is for */ | int flag = 0; /* we can't know which type of BSDF this is for */ | ||||
| out = shader_eval_background(kg, &sd, &state, flag, SHADER_CONTEXT_MAIN); | out = shader_eval_background(kg, &sd, &state, flag, SHADER_CONTEXT_EMISSION); | ||||
| break; | break; | ||||
| } | } | ||||
| default: | default: | ||||
| { | { | ||||
| /* no real shader, returning the position of the verts for debugging */ | /* no real shader, returning the position of the verts for debugging */ | ||||
| out = normalize(P); | out = normalize(P); | ||||
| break; | break; | ||||
| } | } | ||||
| Show All 14 Lines | ccl_device void kernel_shader_evaluate(KernelGlobals *kg, | ||||
| ccl_global uint4 *input, | ccl_global uint4 *input, | ||||
| ccl_global float4 *output, | ccl_global float4 *output, | ||||
| ccl_global float *output_luma, | ccl_global float *output_luma, | ||||
| ShaderEvalType type, | ShaderEvalType type, | ||||
| int i, | int i, | ||||
| int sample) | int sample) | ||||
| { | { | ||||
| ShaderData sd; | ShaderData sd; | ||||
| #ifndef __KERNEL_OPENCL__ | |||||
| ShaderClosure sd_closure[MAX_MAIN_CLOSURE]; | |||||
| sd.closure = sd_closure; | |||||
| sd.max_closure = MAX_MAIN_CLOSURE; | |||||
| #endif | |||||
| PathState state = {0}; | PathState state = {0}; | ||||
| uint4 in = input[i]; | uint4 in = input[i]; | ||||
| float3 out; | float3 out; | ||||
| if(type == SHADER_EVAL_DISPLACE) { | if(type == SHADER_EVAL_DISPLACE) { | ||||
| /* setup shader data */ | /* setup shader data */ | ||||
| int object = in.x; | int object = in.x; | ||||
| int prim = in.y; | int prim = in.y; | ||||
| Show All 25 Lines | #ifdef __RAY_DIFFERENTIALS__ | ||||
| ray.dP = differential3_zero(); | ray.dP = differential3_zero(); | ||||
| #endif | #endif | ||||
| /* setup shader data */ | /* setup shader data */ | ||||
| shader_setup_from_background(kg, &sd, &ray); | shader_setup_from_background(kg, &sd, &ray); | ||||
| /* evaluate */ | /* evaluate */ | ||||
| int flag = 0; /* we can't know which type of BSDF this is for */ | int flag = 0; /* we can't know which type of BSDF this is for */ | ||||
| out = shader_eval_background(kg, &sd, &state, flag, SHADER_CONTEXT_MAIN); | out = shader_eval_background(kg, &sd, &state, flag, SHADER_CONTEXT_EMISSION); | ||||
| } | } | ||||
| /* write output */ | /* write output */ | ||||
| if(sample == 0) { | if(sample == 0) { | ||||
| if(output != NULL) { | if(output != NULL) { | ||||
| output[i] = make_float4(out.x, out.y, out.z, 0.0f); | output[i] = make_float4(out.x, out.y, out.z, 0.0f); | ||||
| } | } | ||||
| if(output_luma != NULL) { | if(output_luma != NULL) { | ||||
| Show All 15 Lines | |||||