Merge branch 'master' into blender2.8
This commit is contained in:
@@ -70,7 +70,7 @@ set(FFMPEG_LIBRARIES
|
||||
)
|
||||
|
||||
# SndFile libraries
|
||||
set(LIBSNDFILE_LIBRARY "/usr/lib/libsndfile.a;/usr/lib/libFLAC.a" CACHE STRING "" FORCE)
|
||||
set(SNDFILE_LIBRARY "/usr/lib${MULTILIB}/libsndfile.a;/usr/lib${MULTILIB}/libFLAC.a" CACHE STRING "" FORCE)
|
||||
|
||||
# OpenAL libraries
|
||||
set(OPENAL_ROOT_DIR "/opt/lib/openal" CACHE STRING "" FORCE)
|
||||
|
||||
@@ -84,7 +84,7 @@ ccl_device_noinline void kernel_path_ao(KernelGlobals *kg,
|
||||
light_ray.dP = sd->dP;
|
||||
light_ray.dD = differential3_zero();
|
||||
|
||||
if(!shadow_blocked(kg, emission_sd, state, &light_ray, &ao_shadow)) {
|
||||
if(!shadow_blocked(kg, sd, emission_sd, state, &light_ray, &ao_shadow)) {
|
||||
path_radiance_accum_ao(L, state, throughput, ao_alpha, ao_bsdf, ao_shadow);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -54,7 +54,7 @@ ccl_device_inline void kernel_branched_path_ao(KernelGlobals *kg,
|
||||
light_ray.dP = sd->dP;
|
||||
light_ray.dD = differential3_zero();
|
||||
|
||||
if(!shadow_blocked(kg, emission_sd, state, &light_ray, &ao_shadow)) {
|
||||
if(!shadow_blocked(kg, sd, emission_sd, state, &light_ray, &ao_shadow)) {
|
||||
path_radiance_accum_ao(L, state, throughput*num_samples_inv, ao_alpha, ao_bsdf, ao_shadow);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -67,7 +67,7 @@ ccl_device_noinline void kernel_branched_path_surface_connect_light(
|
||||
/* trace shadow ray */
|
||||
float3 shadow;
|
||||
|
||||
if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) {
|
||||
if(!shadow_blocked(kg, sd, emission_sd, state, &light_ray, &shadow)) {
|
||||
/* accumulate */
|
||||
path_radiance_accum_light(L, state, throughput*num_samples_inv, &L_light, shadow, num_samples_inv, is_lamp);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ ccl_device_noinline void kernel_branched_path_surface_connect_light(
|
||||
/* trace shadow ray */
|
||||
float3 shadow;
|
||||
|
||||
if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) {
|
||||
if(!shadow_blocked(kg, sd, emission_sd, state, &light_ray, &shadow)) {
|
||||
/* accumulate */
|
||||
path_radiance_accum_light(L, state, throughput*num_samples_inv, &L_light, shadow, num_samples_inv, is_lamp);
|
||||
}
|
||||
@@ -130,7 +130,7 @@ ccl_device_noinline void kernel_branched_path_surface_connect_light(
|
||||
/* trace shadow ray */
|
||||
float3 shadow;
|
||||
|
||||
if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) {
|
||||
if(!shadow_blocked(kg, sd, emission_sd, state, &light_ray, &shadow)) {
|
||||
/* accumulate */
|
||||
path_radiance_accum_light(L, state, throughput*num_samples_adjust, &L_light, shadow, num_samples_adjust, is_lamp);
|
||||
}
|
||||
@@ -257,7 +257,7 @@ ccl_device_inline void kernel_path_surface_connect_light(KernelGlobals *kg,
|
||||
/* trace shadow ray */
|
||||
float3 shadow;
|
||||
|
||||
if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) {
|
||||
if(!shadow_blocked(kg, sd, emission_sd, state, &light_ray, &shadow)) {
|
||||
/* accumulate */
|
||||
path_radiance_accum_light(L, state, throughput, &L_light, shadow, 1.0f, is_lamp);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ ccl_device_inline void kernel_path_volume_connect_light(
|
||||
/* trace shadow ray */
|
||||
float3 shadow;
|
||||
|
||||
if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) {
|
||||
if(!shadow_blocked(kg, sd, emission_sd, state, &light_ray, &shadow)) {
|
||||
/* accumulate */
|
||||
path_radiance_accum_light(L, state, throughput, &L_light, shadow, 1.0f, is_lamp);
|
||||
}
|
||||
@@ -179,7 +179,7 @@ ccl_device void kernel_branched_path_volume_connect_light(
|
||||
/* trace shadow ray */
|
||||
float3 shadow;
|
||||
|
||||
if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) {
|
||||
if(!shadow_blocked(kg, sd, emission_sd, state, &light_ray, &shadow)) {
|
||||
/* accumulate */
|
||||
path_radiance_accum_light(L, state, tp*num_samples_inv, &L_light, shadow, num_samples_inv, is_lamp);
|
||||
}
|
||||
@@ -228,7 +228,7 @@ ccl_device void kernel_branched_path_volume_connect_light(
|
||||
/* trace shadow ray */
|
||||
float3 shadow;
|
||||
|
||||
if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) {
|
||||
if(!shadow_blocked(kg, sd, emission_sd, state, &light_ray, &shadow)) {
|
||||
/* accumulate */
|
||||
path_radiance_accum_light(L, state, tp*num_samples_inv, &L_light, shadow, num_samples_inv, is_lamp);
|
||||
}
|
||||
@@ -266,7 +266,7 @@ ccl_device void kernel_branched_path_volume_connect_light(
|
||||
/* trace shadow ray */
|
||||
float3 shadow;
|
||||
|
||||
if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) {
|
||||
if(!shadow_blocked(kg, sd, emission_sd, state, &light_ray, &shadow)) {
|
||||
/* accumulate */
|
||||
path_radiance_accum_light(L, state, tp, &L_light, shadow, 1.0f, is_lamp);
|
||||
}
|
||||
|
||||
@@ -119,12 +119,46 @@ ccl_device bool shadow_blocked_opaque(KernelGlobals *kg,
|
||||
|
||||
# define SHADOW_STACK_MAX_HITS 64
|
||||
|
||||
# ifdef __VOLUME__
|
||||
struct VolumeState {
|
||||
# ifdef __SPLIT_KERNEL__
|
||||
# else
|
||||
PathState ps;
|
||||
# endif
|
||||
};
|
||||
|
||||
/* Get PathState ready for use for volume stack evaluation. */
|
||||
ccl_device_inline PathState *shadow_blocked_volume_path_state(
|
||||
KernelGlobals *kg,
|
||||
VolumeState *volume_state,
|
||||
ccl_addr_space PathState *state,
|
||||
ShaderData *sd,
|
||||
Ray *ray)
|
||||
{
|
||||
# ifdef __SPLIT_KERNEL__
|
||||
ccl_addr_space PathState *ps =
|
||||
&kernel_split_state.state_shadow[ccl_global_id(1) * ccl_global_size(0) + ccl_global_id(0)];
|
||||
# else
|
||||
PathState *ps = &volume_state->ps;
|
||||
# endif
|
||||
*ps = *state;
|
||||
/* We are checking for shadow on the "other" side of the surface, so need
|
||||
* to discard volume we are currently at.
|
||||
*/
|
||||
if(dot(sd->Ng, ray->D) < 0.0f) {
|
||||
kernel_volume_stack_enter_exit(kg, sd, ps->volume_stack);
|
||||
}
|
||||
return ps;
|
||||
}
|
||||
#endif // __VOLUME__
|
||||
|
||||
/* Actual logic with traversal loop implementation which is free from device
|
||||
* specific tweaks.
|
||||
*
|
||||
* Note that hits array should be as big as max_hits+1.
|
||||
*/
|
||||
ccl_device bool shadow_blocked_transparent_all_loop(KernelGlobals *kg,
|
||||
ShaderData *sd,
|
||||
ShaderData *shadow_sd,
|
||||
ccl_addr_space PathState *state,
|
||||
const uint visibility,
|
||||
@@ -143,6 +177,9 @@ ccl_device bool shadow_blocked_transparent_all_loop(KernelGlobals *kg,
|
||||
visibility,
|
||||
max_hits,
|
||||
&num_hits);
|
||||
# ifdef __VOLUME__
|
||||
VolumeState volume_state;
|
||||
# endif
|
||||
/* If no opaque surface found but we did find transparent hits,
|
||||
* shade them.
|
||||
*/
|
||||
@@ -153,13 +190,11 @@ ccl_device bool shadow_blocked_transparent_all_loop(KernelGlobals *kg,
|
||||
int bounce = state->transparent_bounce;
|
||||
Intersection *isect = hits;
|
||||
# ifdef __VOLUME__
|
||||
# ifdef __SPLIT_KERNEL__
|
||||
ccl_addr_space PathState *ps = &kernel_split_state.state_shadow[ccl_global_id(1) * ccl_global_size(0) + ccl_global_id(0)];
|
||||
# else
|
||||
PathState ps_object;
|
||||
PathState *ps = &ps_object;
|
||||
# endif
|
||||
*ps = *state;
|
||||
PathState *ps = shadow_blocked_volume_path_state(kg,
|
||||
&volume_state,
|
||||
state,
|
||||
sd,
|
||||
ray);
|
||||
# endif
|
||||
sort_intersections(hits, num_hits);
|
||||
for(int hit = 0; hit < num_hits; hit++, isect++) {
|
||||
@@ -205,7 +240,12 @@ ccl_device bool shadow_blocked_transparent_all_loop(KernelGlobals *kg,
|
||||
# ifdef __VOLUME__
|
||||
if(!blocked && state->volume_stack[0].shader != SHADER_NONE) {
|
||||
/* Apply attenuation from current volume shader. */
|
||||
kernel_volume_shadow(kg, shadow_sd, state, ray, shadow);
|
||||
PathState *ps = shadow_blocked_volume_path_state(kg,
|
||||
&volume_state,
|
||||
state,
|
||||
sd,
|
||||
ray);
|
||||
kernel_volume_shadow(kg, shadow_sd, ps, ray, shadow);
|
||||
}
|
||||
# endif
|
||||
return blocked;
|
||||
@@ -215,6 +255,7 @@ ccl_device bool shadow_blocked_transparent_all_loop(KernelGlobals *kg,
|
||||
* loop to help readability of the actual logic.
|
||||
*/
|
||||
ccl_device bool shadow_blocked_transparent_all(KernelGlobals *kg,
|
||||
ShaderData *sd,
|
||||
ShaderData *shadow_sd,
|
||||
ccl_addr_space PathState *state,
|
||||
const uint visibility,
|
||||
@@ -250,6 +291,7 @@ ccl_device bool shadow_blocked_transparent_all(KernelGlobals *kg,
|
||||
# endif /* __KERNEL_GPU__ */
|
||||
/* Invoke actual traversal. */
|
||||
return shadow_blocked_transparent_all_loop(kg,
|
||||
sd,
|
||||
shadow_sd,
|
||||
state,
|
||||
visibility,
|
||||
@@ -275,6 +317,7 @@ ccl_device bool shadow_blocked_transparent_all(KernelGlobals *kg,
|
||||
*/
|
||||
ccl_device bool shadow_blocked_transparent_stepped_loop(
|
||||
KernelGlobals *kg,
|
||||
ShaderData *sd,
|
||||
ShaderData *shadow_sd,
|
||||
ccl_addr_space PathState *state,
|
||||
const uint visibility,
|
||||
@@ -284,18 +327,19 @@ ccl_device bool shadow_blocked_transparent_stepped_loop(
|
||||
const bool is_transparent_isect,
|
||||
float3 *shadow)
|
||||
{
|
||||
# ifdef __VOLUME__
|
||||
VolumeState volume_state;
|
||||
# endif
|
||||
if(blocked && is_transparent_isect) {
|
||||
float3 throughput = make_float3(1.0f, 1.0f, 1.0f);
|
||||
float3 Pend = ray->P + ray->D*ray->t;
|
||||
int bounce = state->transparent_bounce;
|
||||
# ifdef __VOLUME__
|
||||
# ifdef __SPLIT_KERNEL__
|
||||
ccl_addr_space PathState *ps = &kernel_split_state.state_shadow[ccl_global_id(1) * ccl_global_size(0) + ccl_global_id(0)];
|
||||
# else
|
||||
PathState ps_object;
|
||||
PathState *ps = &ps_object;
|
||||
# endif
|
||||
*ps = *state;
|
||||
PathState *ps = shadow_blocked_volume_path_state(kg,
|
||||
&volume_state,
|
||||
state,
|
||||
sd,
|
||||
ray);
|
||||
# endif
|
||||
for(;;) {
|
||||
if(bounce >= kernel_data.integrator.transparent_max_bounce) {
|
||||
@@ -345,7 +389,12 @@ ccl_device bool shadow_blocked_transparent_stepped_loop(
|
||||
# ifdef __VOLUME__
|
||||
if(!blocked && state->volume_stack[0].shader != SHADER_NONE) {
|
||||
/* Apply attenuation from current volume shader. */
|
||||
kernel_volume_shadow(kg, shadow_sd, state, ray, shadow);
|
||||
PathState *ps = shadow_blocked_volume_path_state(kg,
|
||||
&volume_state,
|
||||
state,
|
||||
sd,
|
||||
ray);
|
||||
kernel_volume_shadow(kg, shadow_sd, ps, ray, shadow);
|
||||
}
|
||||
# endif
|
||||
return blocked;
|
||||
@@ -353,6 +402,7 @@ ccl_device bool shadow_blocked_transparent_stepped_loop(
|
||||
|
||||
ccl_device bool shadow_blocked_transparent_stepped(
|
||||
KernelGlobals *kg,
|
||||
ShaderData *sd,
|
||||
ShaderData *shadow_sd,
|
||||
ccl_addr_space PathState *state,
|
||||
const uint visibility,
|
||||
@@ -370,6 +420,7 @@ ccl_device bool shadow_blocked_transparent_stepped(
|
||||
? shader_transparent_shadow(kg, isect)
|
||||
: false;
|
||||
return shadow_blocked_transparent_stepped_loop(kg,
|
||||
sd,
|
||||
shadow_sd,
|
||||
state,
|
||||
visibility,
|
||||
@@ -384,6 +435,7 @@ ccl_device bool shadow_blocked_transparent_stepped(
|
||||
#endif /* __TRANSPARENT_SHADOWS__ */
|
||||
|
||||
ccl_device_inline bool shadow_blocked(KernelGlobals *kg,
|
||||
ShaderData *sd,
|
||||
ShaderData *shadow_sd,
|
||||
ccl_addr_space PathState *state,
|
||||
Ray *ray_input,
|
||||
@@ -452,6 +504,7 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg,
|
||||
max_hits + 1 >= SHADOW_STACK_MAX_HITS)
|
||||
{
|
||||
return shadow_blocked_transparent_stepped_loop(kg,
|
||||
sd,
|
||||
shadow_sd,
|
||||
state,
|
||||
visibility,
|
||||
@@ -463,6 +516,7 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg,
|
||||
}
|
||||
# endif /* __KERNEL_GPU__ */
|
||||
return shadow_blocked_transparent_all(kg,
|
||||
sd,
|
||||
shadow_sd,
|
||||
state,
|
||||
visibility,
|
||||
|
||||
@@ -89,6 +89,7 @@ ccl_device void kernel_shadow_blocked_dl(KernelGlobals *kg)
|
||||
float3 shadow;
|
||||
|
||||
if(!shadow_blocked(kg,
|
||||
sd,
|
||||
emission_sd,
|
||||
state,
|
||||
&ray,
|
||||
|
||||
@@ -3619,7 +3619,13 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
|
||||
psys_get_pointcache_start_end(scene, pid->calldata, &cache->startframe, &cache->endframe);
|
||||
}
|
||||
|
||||
if (((cache->flag & PTCACHE_BAKED) == 0) && (render || bake)) {
|
||||
// XXX workaround for regression inroduced in ee3fadd, needs looking into
|
||||
if (pid->type == PTCACHE_TYPE_RIGIDBODY) {
|
||||
if ((cache->flag & PTCACHE_REDO_NEEDED || (cache->flag & PTCACHE_SIMULATION_VALID)==0) && (render || bake)) {
|
||||
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
|
||||
}
|
||||
}
|
||||
else if (((cache->flag & PTCACHE_BAKED) == 0) && (render || bake)) {
|
||||
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1595,8 +1595,12 @@ void BKE_rigidbody_do_simulation(const struct EvaluationContext *eval_ctx, Scene
|
||||
BKE_ptcache_id_time(&pid, scene, ctime, &startframe, &endframe, NULL);
|
||||
cache = rbw->pointcache;
|
||||
|
||||
if (ctime <= startframe) {
|
||||
rbw->ltime = startframe;
|
||||
return;
|
||||
}
|
||||
/* make sure we don't go out of cache frame range */
|
||||
if (ctime > endframe) {
|
||||
else if (ctime > endframe) {
|
||||
ctime = endframe;
|
||||
}
|
||||
|
||||
@@ -1610,12 +1614,9 @@ void BKE_rigidbody_do_simulation(const struct EvaluationContext *eval_ctx, Scene
|
||||
// RB_TODO deal with interpolated, old and baked results
|
||||
bool can_simulate = (ctime == rbw->ltime + 1) && !(cache->flag & PTCACHE_BAKED);
|
||||
|
||||
if (cache->flag & PTCACHE_OUTDATED || cache->last_exact == 0) {
|
||||
rbw->ltime = cache->startframe;
|
||||
}
|
||||
|
||||
if (BKE_ptcache_read(&pid, ctime, can_simulate)) {
|
||||
if (BKE_ptcache_read(&pid, ctime, can_simulate) == PTCACHE_READ_EXACT) {
|
||||
BKE_ptcache_validate(cache, (int)ctime);
|
||||
rbw->ltime = ctime;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1229,6 +1229,7 @@ static bool knife_ray_intersect_face(
|
||||
|
||||
for (; tri_i < tottri; tri_i++) {
|
||||
const float *lv1, *lv2, *lv3;
|
||||
float ray_tri_uv[2];
|
||||
|
||||
tri = kcd->em->looptris[tri_i];
|
||||
if (tri[0]->f != f)
|
||||
@@ -1240,7 +1241,7 @@ static bool knife_ray_intersect_face(
|
||||
* tesselation edge and might not hit either tesselation tri with
|
||||
* an exact test;
|
||||
* we will exclude hits near real edges by a later test */
|
||||
if (isect_ray_tri_epsilon_v3(v1, raydir, lv1, lv2, lv3, &lambda, NULL, KNIFE_FLT_EPS)) {
|
||||
if (isect_ray_tri_epsilon_v3(v1, raydir, lv1, lv2, lv3, &lambda, ray_tri_uv, KNIFE_FLT_EPS)) {
|
||||
/* check if line coplanar with tri */
|
||||
normal_tri_v3(tri_norm, lv1, lv2, lv3);
|
||||
plane_from_point_normal_v3(tri_plane, lv1, tri_norm);
|
||||
@@ -1249,8 +1250,7 @@ static bool knife_ray_intersect_face(
|
||||
{
|
||||
return false;
|
||||
}
|
||||
copy_v3_v3(hit_cageco, v1);
|
||||
madd_v3_v3fl(hit_cageco, raydir, lambda);
|
||||
interp_v3_v3v3v3_uv(hit_cageco, lv1, lv2, lv3, ray_tri_uv);
|
||||
/* Now check that far enough away from verts and edges */
|
||||
lst = knife_get_face_kedges(kcd, f);
|
||||
for (ref = lst->first; ref; ref = ref->next) {
|
||||
@@ -1262,11 +1262,7 @@ static bool knife_ray_intersect_face(
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
transform_point_by_tri_v3(
|
||||
hit_co, hit_cageco,
|
||||
tri[0]->v->co, tri[1]->v->co, tri[2]->v->co,
|
||||
lv1, lv2, lv3);
|
||||
interp_v3_v3v3v3_uv(hit_co, tri[0]->v->co, tri[1]->v->co, tri[2]->v->co, ray_tri_uv);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -579,10 +579,10 @@ int GPU_verify_image(
|
||||
if (do_color_management) {
|
||||
srgb_frect = MEM_mallocN(ibuf->x * ibuf->y * sizeof(float) * 4, "floar_buf_col_cor");
|
||||
gpu_verify_high_bit_srgb_buffer(srgb_frect, ibuf);
|
||||
frect = srgb_frect + texwinsy * ibuf->x + texwinsx;
|
||||
frect = srgb_frect + (4 * (texwinsy * ibuf->x + texwinsx));
|
||||
}
|
||||
else {
|
||||
frect = ibuf->rect_float + texwinsy * ibuf->x + texwinsx;
|
||||
frect = ibuf->rect_float + (ibuf->channels * (texwinsy * ibuf->x + texwinsx));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user