diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-04-29 17:00:05 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-04-29 17:00:05 +0300 |
commit | 734c8f9a7717cf1b94a53045f19d1af22031db35 (patch) | |
tree | ca57bbd778c12e84afe4b5ba594e0d02ef2a69b9 | |
parent | 7627e0980ddc860917f0484a976956eacbcbe1ac (diff) | |
parent | 87ba01dba90b0b2ffbad2b9e07552734959814db (diff) |
Merge branch 'blender-v2.93-release'
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 1 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_light_common.h | 8 | ||||
-rw-r--r-- | intern/cycles/render/attribute.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/render/nodes.h | 14 | ||||
-rw-r--r-- | intern/cycles/util/util_system.cpp | 10 | ||||
-rw-r--r-- | source/blender/imbuf/intern/anim_movie.c | 120 |
6 files changed, 91 insertions, 65 deletions
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 73bc114893a..0b7f548c792 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -552,6 +552,7 @@ class CYCLES_RENDER_PT_light_paths_fast_gi(CyclesButtonsPanel, Panel): if world: light = world.light_settings + sub.prop(light, "ao_factor", text="AO Factor") layout.prop(light, "distance", text="AO Distance") diff --git a/intern/cycles/kernel/kernel_light_common.h b/intern/cycles/kernel/kernel_light_common.h index c21c517a353..4a683d36226 100644 --- a/intern/cycles/kernel/kernel_light_common.h +++ b/intern/cycles/kernel/kernel_light_common.h @@ -200,12 +200,12 @@ ccl_device bool light_spread_clamp_area_light(const float3 P, * uv coordinates. */ const float new_center_u = 0.5f * (min_u + max_u); const float new_center_v = 0.5f * (min_v + max_v); - const float new_len_u = 0.5f * (max_u - min_u); - const float new_len_v = 0.5f * (max_v - min_v); + const float new_len_u = max_u - min_u; + const float new_len_v = max_v - min_v; *lightP = *lightP + new_center_u * u + new_center_v * v; - *axisu = u * new_len_u * 2.0f; - *axisv = v * new_len_v * 2.0f; + *axisu = u * new_len_u; + *axisv = v * new_len_v; return true; } diff --git a/intern/cycles/render/attribute.cpp b/intern/cycles/render/attribute.cpp index 331d30802f1..d6a638fd4cd 100644 --- a/intern/cycles/render/attribute.cpp +++ b/intern/cycles/render/attribute.cpp @@ -689,6 +689,9 @@ void AttributeSet::update(AttributeSet &&new_attributes) it++; } + + /* If all attributes were replaced, transform is no longer applied. */ + geometry->transform_applied = false; } void AttributeSet::clear_modified() diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h index fb9cf0c9836..99cb0b779b8 100644 --- a/intern/cycles/render/nodes.h +++ b/intern/cycles/render/nodes.h @@ -1600,11 +1600,23 @@ class SetNormalNode : public ShaderNode { NODE_SOCKET_API(float3, direction) }; -class OSLNode : public ShaderNode { +class OSLNode final : public ShaderNode { public: static OSLNode *create(ShaderGraph *graph, size_t num_inputs, const OSLNode *from = NULL); ~OSLNode(); + static void operator delete(void *ptr) + { + /* Override delete operator to silence new-delete-type-mismatch ASAN warnings + * regarding size mismatch in the destructor. This is intentional as we allocate + * extra space at the end of the node. */ + ::operator delete(ptr); + } + static void operator delete(void *, void *) + { + /* Deliberately empty placement delete operator, to avoid MSVC warning C4291. */ + } + ShaderNode *clone(ShaderGraph *graph) const; char *input_default_value(); diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp index 6500a59e42c..8971867b736 100644 --- a/intern/cycles/util/util_system.cpp +++ b/intern/cycles/util/util_system.cpp @@ -145,7 +145,7 @@ int system_cpu_num_active_group_processors() return numaAPI_GetNumCurrentNodesProcessors(); } -#if !defined(_WIN32) || defined(FREE_WINDOWS) +#if !defined(__APPLE__) && (!defined(_WIN32) || defined(FREE_WINDOWS)) static void __cpuid(int data[4], int selector) { # if defined(__x86_64__) @@ -166,7 +166,13 @@ static void __cpuid(int data[4], int selector) string system_cpu_brand_string() { -#if !defined(WIN32) && !defined(__x86_64__) && !defined(__i386__) +#if defined(__APPLE__) + char modelname[512] = ""; + size_t bufferlen = 512; + if (sysctlbyname("machdep.cpu.brand_string", &modelname, &bufferlen, NULL, 0) == 0) { + return modelname; + } +#elif !defined(WIN32) && !defined(__x86_64__) && !defined(__i386__) FILE *cpuinfo = fopen("/proc/cpuinfo", "r"); if (cpuinfo != nullptr) { char cpuinfo_buf[513] = ""; diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 6c63c1a1b5b..9e8224f58b2 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -815,66 +815,70 @@ static void ffmpeg_postprocess(struct anim *anim) anim->y); } - if (ENDIAN_ORDER == B_ENDIAN) { - int *dstStride = anim->pFrameRGB->linesize; - uint8_t **dst = anim->pFrameRGB->data; - const int dstStride2[4] = {dstStride[0], 0, 0, 0}; - uint8_t *dst2[4] = {dst[0], 0, 0, 0}; - int x, y, h, w; - unsigned char *bottom; - unsigned char *top; - - sws_scale(anim->img_convert_ctx, - (const uint8_t *const *)input->data, - input->linesize, - 0, - anim->y, - dst2, - dstStride2); - - bottom = (unsigned char *)ibuf->rect; - top = bottom + ibuf->x * (ibuf->y - 1) * 4; - - h = (ibuf->y + 1) / 2; - w = ibuf->x; - - for (y = 0; y < h; y++) { - unsigned char tmp[4]; - unsigned int *tmp_l = (unsigned int *)tmp; - - for (x = 0; x < w; x++) { - tmp[0] = bottom[0]; - tmp[1] = bottom[1]; - tmp[2] = bottom[2]; - tmp[3] = bottom[3]; - - bottom[0] = top[0]; - bottom[1] = top[1]; - bottom[2] = top[2]; - bottom[3] = top[3]; - - *(unsigned int *)top = *tmp_l; - - bottom += 4; - top += 4; - } - top -= 8 * w; +# if defined(__x86_64__) || defined(_M_X64) + /* Scale and flip image over Y axis in one go, using negative strides. + * This doesn't work with arm/powerpc though and may be misusing the API. + * Limit it x86_64 where it appears to work. + * http://trac.ffmpeg.org/ticket/9060 */ + int *dstStride = anim->pFrameRGB->linesize; + uint8_t **dst = anim->pFrameRGB->data; + const int dstStride2[4] = {-dstStride[0], 0, 0, 0}; + uint8_t *dst2[4] = {dst[0] + (anim->y - 1) * dstStride[0], 0, 0, 0}; + + sws_scale(anim->img_convert_ctx, + (const uint8_t *const *)input->data, + input->linesize, + 0, + anim->y, + dst2, + dstStride2); +# else + /* Scale with swscale then flip image over Y axis. */ + int *dstStride = anim->pFrameRGB->linesize; + uint8_t **dst = anim->pFrameRGB->data; + const int dstStride2[4] = {dstStride[0], 0, 0, 0}; + uint8_t *dst2[4] = {dst[0], 0, 0, 0}; + int x, y, h, w; + unsigned char *bottom; + unsigned char *top; + + sws_scale(anim->img_convert_ctx, + (const uint8_t *const *)input->data, + input->linesize, + 0, + anim->y, + dst2, + dstStride2); + + bottom = (unsigned char *)ibuf->rect; + top = bottom + ibuf->x * (ibuf->y - 1) * 4; + + h = (ibuf->y + 1) / 2; + w = ibuf->x; + + for (y = 0; y < h; y++) { + unsigned char tmp[4]; + unsigned int *tmp_l = (unsigned int *)tmp; + + for (x = 0; x < w; x++) { + tmp[0] = bottom[0]; + tmp[1] = bottom[1]; + tmp[2] = bottom[2]; + tmp[3] = bottom[3]; + + bottom[0] = top[0]; + bottom[1] = top[1]; + bottom[2] = top[2]; + bottom[3] = top[3]; + + *(unsigned int *)top = *tmp_l; + + bottom += 4; + top += 4; } + top -= 8 * w; } - else { - int *dstStride = anim->pFrameRGB->linesize; - uint8_t **dst = anim->pFrameRGB->data; - const int dstStride2[4] = {-dstStride[0], 0, 0, 0}; - uint8_t *dst2[4] = {dst[0] + (anim->y - 1) * dstStride[0], 0, 0, 0}; - - sws_scale(anim->img_convert_ctx, - (const uint8_t *const *)input->data, - input->linesize, - 0, - anim->y, - dst2, - dstStride2); - } +# endif if (need_aligned_ffmpeg_buffer(anim)) { uint8_t *src = anim->pFrameRGB->data[0]; |