Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/kernel_bake.h
| Show First 20 Lines • Show All 166 Lines • ▼ Show 20 Lines | ccl_device_inline float bake_clamp_mirror_repeat(float u) | ||||
| * to the same value, gives ugly patterns */ | * to the same value, gives ugly patterns */ | ||||
| float fu = floorf(u); | float fu = floorf(u); | ||||
| u = u - fu; | u = u - fu; | ||||
| return (((int)fu) & 1)? 1.0f - u: u; | return (((int)fu) & 1)? 1.0f - u: u; | ||||
| } | } | ||||
| #endif | #endif | ||||
| ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input, ccl_global float4 *output, ShaderEvalType type, int i, int sample) | ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input, ccl_global float4 *output, | ||||
| ShaderEvalType type, int i, int offset, int sample) | |||||
| { | { | ||||
| ShaderData sd; | ShaderData sd; | ||||
| uint4 in = input[i * 2]; | uint4 in = input[i * 2]; | ||||
| uint4 diff = input[i * 2 + 1]; | uint4 diff = input[i * 2 + 1]; | ||||
| float3 out; | float3 out; | ||||
| int object = in.x; | int object = in.x; | ||||
| int prim = in.y; | int prim = in.y; | ||||
| if(prim == -1) | if(prim == -1) | ||||
| return; | return; | ||||
| float u = __uint_as_float(in.z); | float u = __uint_as_float(in.z); | ||||
| float v = __uint_as_float(in.w); | float v = __uint_as_float(in.w); | ||||
| float dudx = __uint_as_float(diff.x); | float dudx = __uint_as_float(diff.x); | ||||
| float dudy = __uint_as_float(diff.y); | float dudy = __uint_as_float(diff.y); | ||||
| float dvdx = __uint_as_float(diff.z); | float dvdx = __uint_as_float(diff.z); | ||||
| float dvdy = __uint_as_float(diff.w); | float dvdy = __uint_as_float(diff.w); | ||||
| int num_samples = kernel_data.integrator.aa_samples; | int num_samples = kernel_data.integrator.aa_samples; | ||||
| /* random number generator */ | /* random number generator */ | ||||
| RNG rng = cmj_hash(i, 0); | RNG rng = cmj_hash(offset + i, 0); | ||||
| #if 0 | #if 0 | ||||
| uint rng_state = cmj_hash(i, 0); | uint rng_state = cmj_hash(i, 0); | ||||
| float filter_x, filter_y; | float filter_x, filter_y; | ||||
| path_rng_init(kg, &rng_state, sample, num_samples, &rng, 0, 0, &filter_x, &filter_y); | path_rng_init(kg, &rng_state, sample, num_samples, &rng, 0, 0, &filter_x, &filter_y); | ||||
| /* subpixel u/v offset */ | /* subpixel u/v offset */ | ||||
| if(sample > 0) { | if(sample > 0) { | ||||
| ▲ Show 20 Lines • Show All 257 Lines • Show Last 20 Lines | |||||