From b1584775515b9830d277343db7a25701fd054578 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 18 May 2021 14:02:41 +0200 Subject: [PATCH 1/2] Fix ocean modifier giving different result on Arm than x86 And re-enable the test on macOS Arm. Ref T78710 --- source/blender/blenkernel/intern/ocean.c | 8 ++++++-- tests/python/CMakeLists.txt | 19 ++++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index d2f4d0702ed..9d53dad8d03 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -911,8 +911,12 @@ void BKE_ocean_init(struct Ocean *o, for (i = 0; i < o->_M; i++) { for (j = 0; j < o->_N; j++) { /* This ensures we get a value tied to the surface location, avoiding dramatic surface - * change with changing resolution. */ - int new_seed = seed + BLI_hash_int_2d(o->_kx[i] * 360.0f, o->_kz[j] * 360.0f); + * change with changing resolution. + * Explicitly cast to signed int first to ensure consistent behavior on all processors, + * since behavior of float to unsigned int cast is undefined in C. */ + const int hash_x = o->_kx[i] * 360.0f; + const int hash_z = o->_kz[j] * 360.0f; + int new_seed = seed + BLI_hash_int_2d(hash_x, hash_z); BLI_rng_seed(rng, new_seed); float r1 = gaussRand(rng); diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index 4770a421ba9..92cebb7d274 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -240,17 +240,14 @@ add_blender_test( --run-all-tests ) -# disabled on macOS arm64 until updated & working -if(NOT (APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))) - if(WITH_MOD_OCEANSIM) - add_blender_test( - physics_ocean - ${TEST_SRC_DIR}/physics/ocean_test.blend - --python ${TEST_PYTHON_DIR}/physics_ocean.py - -- - --run-all-tests - ) - endif() +if(WITH_MOD_OCEANSIM) + add_blender_test( + physics_ocean + ${TEST_SRC_DIR}/physics/ocean_test.blend + --python ${TEST_PYTHON_DIR}/physics_ocean.py + -- + --run-all-tests + ) endif() From a9da73ab95f07b7965df133edb6f32429ccb7302 Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Tue, 18 May 2021 15:42:26 +0200 Subject: [PATCH 2/2] Fix T88370: GPencil render crash when use viewlayer and masking When filtering the render using view layer, could be possible the mask is NULL and just need to be ignored. --- source/blender/draw/engines/gpencil/gpencil_engine.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index 8bb336ebc96..32884eb9e3f 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -819,7 +819,10 @@ static void gpencil_draw_mask(GPENCIL_Data *vedata, GPENCIL_tObject *ob, GPENCIL } GPENCIL_tLayer *mask_layer = gpencil_layer_cache_get(ob, i); - BLI_assert(mask_layer); + /* When filtering by viewlayer, the mask could be null and must be ignored. */ + if (mask_layer == NULL) { + continue; + } DRW_draw_pass(mask_layer->geom_ps); }