diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-28 14:58:30 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-28 14:58:30 +0300 |
commit | b880c13c3aa9e0d00509586224a0b30586ebb594 (patch) | |
tree | 3f63af5ab8fb50adc042df2971556cf96951eb5c | |
parent | a33034cc3fd17802ffdd3e87e9958f5539f67bbb (diff) | |
parent | b030277e791e429e8f8de90316144830eda6bbf8 (diff) |
Merge branch 'master' into blender2.8
-rw-r--r-- | intern/cycles/kernel/bvh/bvh.h | 28 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/obvh_local.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/obvh_shadow_all.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/obvh_traversal.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/obvh_volume.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/obvh_volume_all.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/qbvh_local.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/qbvh_shadow_all.h | 5 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/qbvh_traversal.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/qbvh_volume.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/qbvh_volume_all.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/writeffmpeg.c | 20 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 10 |
14 files changed, 61 insertions, 64 deletions
diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h index 2ad55d041bf..b3135573878 100644 --- a/intern/cycles/kernel/bvh/bvh.h +++ b/intern/cycles/kernel/bvh/bvh.h @@ -160,6 +160,19 @@ CCL_NAMESPACE_BEGIN #undef BVH_NAME_EVAL #undef BVH_FUNCTION_FULL_NAME +ccl_device_inline bool scene_intersect_valid(const Ray *ray) +{ + /* NOTE: Due to some vectorization code non-finite origin point might + * cause lots of false-positive intersections which will overflow traversal + * stack. + * This code is a quick way to perform early output, to avoid crashes in + * such cases. + * From production scenes so far it seems it's enough to test first element + * only. + */ + return finite(ray->P.x); +} + /* Note: ray is passed by value to work around a possible CUDA compiler bug. */ ccl_device_intersect bool scene_intersect(KernelGlobals *kg, const Ray ray, @@ -169,6 +182,9 @@ ccl_device_intersect bool scene_intersect(KernelGlobals *kg, float difl, float extmax) { + if (!scene_intersect_valid(&ray)) { + return false; + } #ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { # ifdef __HAIR__ @@ -213,6 +229,9 @@ ccl_device_intersect bool scene_intersect_local(KernelGlobals *kg, uint *lcg_state, int max_hits) { + if (!scene_intersect_valid(&ray)) { + return false; + } #ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { return bvh_intersect_local_motion(kg, @@ -240,6 +259,9 @@ ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals *kg, uint max_hits, uint *num_hits) { + if (!scene_intersect_valid(ray)) { + return false; + } # ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { # ifdef __HAIR__ @@ -299,6 +321,9 @@ ccl_device_intersect bool scene_intersect_volume(KernelGlobals *kg, Intersection *isect, const uint visibility) { + if (!scene_intersect_valid(ray)) { + return false; + } # ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { return bvh_intersect_volume_motion(kg, ray, isect, visibility); @@ -327,6 +352,9 @@ ccl_device_intersect uint scene_intersect_volume_all(KernelGlobals *kg, const uint max_hits, const uint visibility) { + if (!scene_intersect_valid(ray)) { + return false; + } # ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { return bvh_intersect_volume_all_motion(kg, ray, isect, max_hits, visibility); diff --git a/intern/cycles/kernel/bvh/obvh_local.h b/intern/cycles/kernel/bvh/obvh_local.h index 92143193a6a..eb24a607caa 100644 --- a/intern/cycles/kernel/bvh/obvh_local.h +++ b/intern/cycles/kernel/bvh/obvh_local.h @@ -73,12 +73,6 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg, object = local_object; } -#ifndef __KERNEL_SSE41__ - if(!isfinite(P.x)) { - return false; - } -#endif - avxf tnear(0.0f), tfar(isect_t); #if BVH_FEATURE(BVH_HAIR) avx3f dir4(avxf(dir.x), avxf(dir.y), avxf(dir.z)); diff --git a/intern/cycles/kernel/bvh/obvh_shadow_all.h b/intern/cycles/kernel/bvh/obvh_shadow_all.h index 3e877065127..6ea93c5e7b2 100644 --- a/intern/cycles/kernel/bvh/obvh_shadow_all.h +++ b/intern/cycles/kernel/bvh/obvh_shadow_all.h @@ -66,12 +66,6 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg, *num_hits = 0; isect_array->t = tmax; -#ifndef __KERNEL_SSE41__ - if(!isfinite(P.x)) { - return false; - } -#endif - #if BVH_FEATURE(BVH_INSTANCING) int num_hits_in_instance = 0; #endif diff --git a/intern/cycles/kernel/bvh/obvh_traversal.h b/intern/cycles/kernel/bvh/obvh_traversal.h index 98cd8f000ba..5010983057d 100644 --- a/intern/cycles/kernel/bvh/obvh_traversal.h +++ b/intern/cycles/kernel/bvh/obvh_traversal.h @@ -64,12 +64,6 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg, Transform ob_itfm; #endif -#ifndef __KERNEL_SSE41__ - if(!isfinite(P.x)) { - return false; - } -#endif - isect->t = ray->t; isect->u = 0.0f; isect->v = 0.0f; diff --git a/intern/cycles/kernel/bvh/obvh_volume.h b/intern/cycles/kernel/bvh/obvh_volume.h index da9ddbd4f24..80d09c59039 100644 --- a/intern/cycles/kernel/bvh/obvh_volume.h +++ b/intern/cycles/kernel/bvh/obvh_volume.h @@ -52,12 +52,6 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg, Transform ob_itfm; #endif -#ifndef __KERNEL_SSE41__ - if(!isfinite(P.x)) { - return false; - } -#endif - isect->t = ray->t; isect->u = 0.0f; isect->v = 0.0f; diff --git a/intern/cycles/kernel/bvh/obvh_volume_all.h b/intern/cycles/kernel/bvh/obvh_volume_all.h index a88573e6f86..87216127ddb 100644 --- a/intern/cycles/kernel/bvh/obvh_volume_all.h +++ b/intern/cycles/kernel/bvh/obvh_volume_all.h @@ -58,12 +58,6 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(OBVH)(KernelGlobals *kg, uint num_hits = 0; isect_array->t = tmax; -#ifndef __KERNEL_SSE41__ - if(!isfinite(P.x)) { - return 0; - } -#endif - #if BVH_FEATURE(BVH_INSTANCING) int num_hits_in_instance = 0; #endif diff --git a/intern/cycles/kernel/bvh/qbvh_local.h b/intern/cycles/kernel/bvh/qbvh_local.h index ee3827de309..22d434a8737 100644 --- a/intern/cycles/kernel/bvh/qbvh_local.h +++ b/intern/cycles/kernel/bvh/qbvh_local.h @@ -82,12 +82,6 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, object = local_object; } -#ifndef __KERNEL_SSE41__ - if(!isfinite(P.x)) { - return false; - } -#endif - ssef tnear(0.0f), tfar(isect_t); #if BVH_FEATURE(BVH_HAIR) sse3f dir4(ssef(dir.x), ssef(dir.y), ssef(dir.z)); diff --git a/intern/cycles/kernel/bvh/qbvh_shadow_all.h b/intern/cycles/kernel/bvh/qbvh_shadow_all.h index 46fd178aed6..3610bdd560b 100644 --- a/intern/cycles/kernel/bvh/qbvh_shadow_all.h +++ b/intern/cycles/kernel/bvh/qbvh_shadow_all.h @@ -66,11 +66,6 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, *num_hits = 0; isect_array->t = tmax; -#ifndef __KERNEL_SSE41__ - if(!isfinite(P.x)) { - return false; - } -#endif #if BVH_FEATURE(BVH_INSTANCING) int num_hits_in_instance = 0; diff --git a/intern/cycles/kernel/bvh/qbvh_traversal.h b/intern/cycles/kernel/bvh/qbvh_traversal.h index b36689b2a2e..ff675cab76b 100644 --- a/intern/cycles/kernel/bvh/qbvh_traversal.h +++ b/intern/cycles/kernel/bvh/qbvh_traversal.h @@ -71,12 +71,6 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, Transform ob_itfm; #endif -#ifndef __KERNEL_SSE41__ - if(!isfinite(P.x)) { - return false; - } -#endif - isect->t = ray->t; isect->u = 0.0f; isect->v = 0.0f; diff --git a/intern/cycles/kernel/bvh/qbvh_volume.h b/intern/cycles/kernel/bvh/qbvh_volume.h index 192ce009524..7ec264e5f78 100644 --- a/intern/cycles/kernel/bvh/qbvh_volume.h +++ b/intern/cycles/kernel/bvh/qbvh_volume.h @@ -58,12 +58,6 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, Transform ob_itfm; #endif -#ifndef __KERNEL_SSE41__ - if(!isfinite(P.x)) { - return false; - } -#endif - isect->t = ray->t; isect->u = 0.0f; isect->v = 0.0f; diff --git a/intern/cycles/kernel/bvh/qbvh_volume_all.h b/intern/cycles/kernel/bvh/qbvh_volume_all.h index 1e454e4d36b..dd603d79334 100644 --- a/intern/cycles/kernel/bvh/qbvh_volume_all.h +++ b/intern/cycles/kernel/bvh/qbvh_volume_all.h @@ -64,12 +64,6 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, uint num_hits = 0; isect_array->t = tmax; -#ifndef __KERNEL_SSE41__ - if(!isfinite(P.x)) { - return 0; - } -#endif - #if BVH_FEATURE(BVH_INSTANCING) int num_hits_in_instance = 0; #endif diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 394f4cc1122..9cdb48998a0 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -725,6 +725,26 @@ static AVStream *alloc_audio_stream(FFMpegContext *context, RenderData *rd, int c->sample_fmt = AV_SAMPLE_FMT_S16; c->channels = rd->ffcodecdata.audio_channels; +#ifdef FFMPEG_HAVE_FRAME_CHANNEL_LAYOUT + switch (rd->ffcodecdata.audio_channels) { + case FFM_CHANNELS_MONO: + c->channel_layout = AV_CH_LAYOUT_MONO; + break; + case FFM_CHANNELS_STEREO: + c->channel_layout = AV_CH_LAYOUT_STEREO; + break; + case FFM_CHANNELS_SURROUND4: + c->channel_layout = AV_CH_LAYOUT_QUAD; + break; + case FFM_CHANNELS_SURROUND51: + c->channel_layout = AV_CH_LAYOUT_5POINT1_BACK; + break; + case FFM_CHANNELS_SURROUND71: + c->channel_layout = AV_CH_LAYOUT_7POINT1; + break; + } +#endif + if (request_float_audio_buffer(codec_id)) { /* mainly for AAC codec which is experimental */ c->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 5fe57dd6d1e..73d6249a263 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -136,6 +136,14 @@ typedef enum eFFMpegCrf { FFM_CRF_LOWEST = 32, } eFFMpegCrf; +typedef enum eFFMpegAudioChannels { + FFM_CHANNELS_MONO = 1, + FFM_CHANNELS_STEREO = 2, + FFM_CHANNELS_SURROUND4 = 4, + FFM_CHANNELS_SURROUND51 = 6, + FFM_CHANNELS_SURROUND71 = 8, +} eFFMpegAudioChannels; + typedef struct FFMpegCodecData { int type; int codec; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 2c457aaaa60..3bb098fcd09 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -4345,11 +4345,11 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) #endif static const EnumPropertyItem audio_channel_items[] = { - {1, "MONO", 0, "Mono", "Set audio channels to mono"}, - {2, "STEREO", 0, "Stereo", "Set audio channels to stereo"}, - {4, "SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels"}, - {6, "SURROUND51", 0, "5.1 Surround", "Set audio channels to 5.1 surround sound"}, - {8, "SURROUND71", 0, "7.1 Surround", "Set audio channels to 7.1 surround sound"}, + {FFM_CHANNELS_MONO, "MONO", 0, "Mono", "Set audio channels to mono"}, + {FFM_CHANNELS_STEREO, "STEREO", 0, "Stereo", "Set audio channels to stereo"}, + {FFM_CHANNELS_SURROUND4, "SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels"}, + {FFM_CHANNELS_SURROUND51, "SURROUND51", 0, "5.1 Surround", "Set audio channels to 5.1 surround sound"}, + {FFM_CHANNELS_SURROUND71, "SURROUND71", 0, "7.1 Surround", "Set audio channels to 7.1 surround sound"}, {0, NULL, 0, NULL, NULL} }; |