Merge branch 'blender-v4.2-release'

This commit is contained in:
Bastien Montagne 2024-06-13 20:48:17 +02:00
commit ddd366c5b2
7 changed files with 44 additions and 15 deletions

@ -1 +1 @@
Subproject commit 57ad26e0ccc9a69808ff44b9bb05a18278f4154b
Subproject commit 06a9cd56a271b0d44a600858aedc8e32d18229a9

@ -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);

@ -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"};

@ -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)

@ -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);

@ -509,16 +509,20 @@ static IDProperty *idp_from_PyLong(IDProperty *prop_exist,
const bool can_create)
{
IDProperty *prop = nullptr;
if (prop_exist) {
if (prop_exist->type == IDP_INT) {
const int value = PyC_Long_AsI32(ob);
if (value == -1 && PyErr_Occurred()) {
return prop;
}
if (prop_exist) {
if (prop_exist->type == IDP_INT) {
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 (to_float || to_double) {
const int64_t value = PyC_Long_AsI64(item);
if ((value == -1) && PyErr_Occurred()) {
continue;
}
if (to_float) {
static_cast<float *>(prop_data)[i] = float(value);
}
else if (to_double) {
else { /* if (to_double) */
static_cast<double *>(prop_data)[i] = double(value);
}
}
else {
const int value = PyC_Long_AsI32(item);
if ((value == -1) && PyErr_Occurred()) {
continue;
}
static_cast<int *>(prop_data)[i] = value;
}
}

@ -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):