From bd764a5796b29414df96d930a138413eb72d4e99 Mon Sep 17 00:00:00 2001 From: Anthony Roberts Date: Thu, 13 Jun 2024 18:48:44 +0100 Subject: [PATCH 1/3] Windows: 4.2 Library updates for ARM64 Pull Request: https://projects.blender.org/blender/blender/pulls/123203 --- lib/windows_arm64 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/windows_arm64 b/lib/windows_arm64 index 57ad26e0ccc..06a9cd56a27 160000 --- a/lib/windows_arm64 +++ b/lib/windows_arm64 @@ -1 +1 @@ -Subproject commit 57ad26e0ccc9a69808ff44b9bb05a18278f4154b +Subproject commit 06a9cd56a271b0d44a600858aedc8e32d18229a9 From 7a7f64cf9dc2abd3178b4b61de6e41fa20f6274f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Thu, 13 Jun 2024 20:39:57 +0200 Subject: [PATCH 2/3] Fix: EEVEE-Next: Broken area and spot light culling in planar probes These two lights have a second culling pass that uses some shapes defined in view space. These shapes need to have their handedness flipped otherwise the test fails. Fix #122614 --- source/blender/draw/engines/eevee_next/eevee_light.cc | 1 + source/blender/draw/engines/eevee_next/eevee_light.hh | 2 ++ .../blender/draw/engines/eevee_next/eevee_shader_shared.hh | 5 +++++ .../eevee_next/shaders/eevee_light_culling_tile_comp.glsl | 6 +++++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/source/blender/draw/engines/eevee_next/eevee_light.cc b/source/blender/draw/engines/eevee_next/eevee_light.cc index 6967c1355a1..2f75750fa3a 100644 --- a/source/blender/draw/engines/eevee_next/eevee_light.cc +++ b/source/blender/draw/engines/eevee_next/eevee_light.cc @@ -572,6 +572,7 @@ void LightModule::set_view(View &view, const int2 extent) culling_data_buf_.zbin_bias = -near_z * culling_data_buf_.zbin_scale; culling_data_buf_.tile_to_uv_fac = (culling_data_buf_.tile_size / float2(extent)); culling_data_buf_.visible_count = 0; + culling_data_buf_.view_is_flipped = view.is_inverted(); culling_data_buf_.push_update(); inst_.manager->submit(culling_ps_, view); diff --git a/source/blender/draw/engines/eevee_next/eevee_light.hh b/source/blender/draw/engines/eevee_next/eevee_light.hh index ce2acd89f2b..25557f54a43 100644 --- a/source/blender/draw/engines/eevee_next/eevee_light.hh +++ b/source/blender/draw/engines/eevee_next/eevee_light.hh @@ -157,6 +157,8 @@ class LightModule { PassSimple culling_ps_ = {"LightCulling"}; /** Total number of words the tile buffer needs to contain for the render resolution. */ uint total_word_count_ = 0; + /** Flipped state of the view being processed. True for planar probe views. */ + bool view_is_flipped_ = false; /** Update light on the GPU after culling. Ran for each sample. */ PassSimple update_ps_ = {"LightUpdate"}; diff --git a/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh b/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh index 15ad1a072fc..a29b277522e 100644 --- a/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh +++ b/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh @@ -795,6 +795,11 @@ struct LightCullingData { uint tile_y_len; /** Number of word per tile. Depends on the maximum number of lights. */ uint tile_word_len; + /** Is the view being processed by light culling flipped (true for light probe planes). */ + bool32_t view_is_flipped; + uint _pad0; + uint _pad1; + uint _pad2; }; BLI_STATIC_ASSERT_ALIGN(LightCullingData, 16) diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_light_culling_tile_comp.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_light_culling_tile_comp.glsl index 949b4a48274..d08f567b8b9 100644 --- a/source/blender/draw/engines/eevee_next/shaders/eevee_light_culling_tile_comp.glsl +++ b/source/blender/draw/engines/eevee_next/shaders/eevee_light_culling_tile_comp.glsl @@ -76,7 +76,7 @@ CullingTile tile_culling_get(uvec2 tile_co) for (int i = 0; i < 8; i++) { /* Culling in view space for precision. */ - corners[i] = project_point(ProjectionMatrixInverse, corners[i]); + corners[i] = project_point(drw_view.wininv, corners[i]); } bool is_persp = ProjectionMatrix[3][3] == 0.0; @@ -154,6 +154,10 @@ void main() vec3 v_back = drw_normal_world_to_view(light_z_axis(light)); float radius = light_local_data_get(light).influence_radius_max; + if (light_cull_buf.view_is_flipped) { + v_right = -v_right; + } + Sphere sphere = shape_sphere(vP, radius); bool intersect_tile = intersect(tile, sphere); From 5dfc1972629a78ba86e410247c61c07d107c80f0 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 13 Jun 2024 20:45:27 +0200 Subject: [PATCH 3/3] IDProp: BPY: Support assigning large int values to float properties. Allow assigning integer values beyond int32 range to float/double IDProperties. Extract the py object value into a temporary int64 value in these cases. --- .../blender/python/generic/idprop_py_api.cc | 40 +++++++++++++------ tests/python/bl_pyapi_idprop.py | 3 ++ 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/source/blender/python/generic/idprop_py_api.cc b/source/blender/python/generic/idprop_py_api.cc index 2ba8e0f8e77..f9f26bea315 100644 --- a/source/blender/python/generic/idprop_py_api.cc +++ b/source/blender/python/generic/idprop_py_api.cc @@ -509,16 +509,20 @@ static IDProperty *idp_from_PyLong(IDProperty *prop_exist, const bool can_create) { IDProperty *prop = nullptr; - const int value = PyC_Long_AsI32(ob); - if (value == -1 && PyErr_Occurred()) { - return prop; - } if (prop_exist) { if (prop_exist->type == IDP_INT) { + const int value = PyC_Long_AsI32(ob); + if (value == -1 && PyErr_Occurred()) { + return prop; + } IDP_Int(prop_exist) = value; prop = prop_exist; } else if (do_conversion) { + const int64_t value = PyC_Long_AsI64(ob); + if (value == -1 && PyErr_Occurred()) { + return prop; + } switch (prop_exist->type) { case IDP_FLOAT: IDP_Float(prop_exist) = float(value); @@ -540,6 +544,10 @@ static IDProperty *idp_from_PyLong(IDProperty *prop_exist, } } if (!prop && can_create) { + const int value = PyC_Long_AsI32(ob); + if (value == -1 && PyErr_Occurred()) { + return prop; + } prop = blender::bke::idprop::create(name, value).release(); } return prop; @@ -756,17 +764,23 @@ static IDProperty *idp_from_PySequence_Fast(IDProperty *prop_exist, void *prop_data = IDP_Array(prop); for (i = 0; i < val.array.len; i++) { item = ob_seq_fast_items[i]; - const int value = PyC_Long_AsI32(item); - if ((value == -1) && PyErr_Occurred()) { - continue; - } - if (to_float) { - static_cast(prop_data)[i] = float(value); - } - else if (to_double) { - static_cast(prop_data)[i] = double(value); + if (to_float || to_double) { + const int64_t value = PyC_Long_AsI64(item); + if ((value == -1) && PyErr_Occurred()) { + continue; + } + if (to_float) { + static_cast(prop_data)[i] = float(value); + } + else { /* if (to_double) */ + static_cast(prop_data)[i] = double(value); + } } else { + const int value = PyC_Long_AsI32(item); + if ((value == -1) && PyErr_Occurred()) { + continue; + } static_cast(prop_data)[i] = value; } } diff --git a/tests/python/bl_pyapi_idprop.py b/tests/python/bl_pyapi_idprop.py index 6cdd6983ec8..2fea9204b6b 100644 --- a/tests/python/bl_pyapi_idprop.py +++ b/tests/python/bl_pyapi_idprop.py @@ -325,6 +325,9 @@ class TestIdPropertyDynamicRNA(TestHelper, unittest.TestCase): self.assertEqual(list(self.id['dynrna_prop']['float_array_prop']), mixed_array) self.assertEqual(list(self.id.dynrna_prop.float_array_prop), list(self.id['dynrna_prop']['float_array_prop'])) self.assertTrue(all((type(i) is float for i in self.id['dynrna_prop']['float_array_prop']))) + # Assign out-of int32 range value to a float property. + self.id['dynrna_prop']['float_array_prop'] = [1000000000000, 5, 6] + print(self.id['dynrna_prop']['float_array_prop'][:]) with self.assertRaises(TypeError): self.id['dynrna_prop']['float_array_prop'] = 2.5 with self.assertRaises(TypeError):