Merge branch 'blender-v5.0-release'

This commit is contained in:
Brecht Van Lommel
2025-10-17 16:42:22 +02:00
9 changed files with 50 additions and 18 deletions

View File

@@ -1624,9 +1624,8 @@ class CyclesPreferences(bpy.types.AddonPreferences):
) )
use_hiprt: BoolProperty( use_hiprt: BoolProperty(
name="HIP RT (Unstable)", name="HIP RT",
description="HIP RT enables AMD hardware ray tracing on RDNA2 and above. This currently has known stability " description="HIP RT enables AMD hardware ray tracing on RDNA2 and above",
"issues, that are expected to be solved before the next release.",
default=False, default=False,
) )

View File

@@ -30,12 +30,10 @@ BVHHIPRT::BVHHIPRT(const BVHParams &params,
BVHHIPRT::~BVHHIPRT() BVHHIPRT::~BVHHIPRT()
{ {
HIPRTDevice *hiprt_device = static_cast<HIPRTDevice *>(device);
hiprtContext hiprt_context = hiprt_device->get_hiprt_context();
custom_primitive_bound.free(); custom_primitive_bound.free();
triangle_index.free(); triangle_index.free();
vertex_data.free(); vertex_data.free();
hiprtDestroyGeometry(hiprt_context, hiprt_geom); device->release_bvh(this);
} }
CCL_NAMESPACE_END CCL_NAMESPACE_END

View File

@@ -114,6 +114,7 @@ HIPRTDevice::HIPRTDevice(const DeviceInfo &info,
HIPRTDevice::~HIPRTDevice() HIPRTDevice::~HIPRTDevice()
{ {
HIPContextScope scope(this); HIPContextScope scope(this);
free_bvh_memory_delayed();
user_instance_id.free(); user_instance_id.free();
prim_visibility.free(); prim_visibility.free();
hiprt_blas_ptr.free(); hiprt_blas_ptr.free();
@@ -1150,12 +1151,33 @@ hiprtScene HIPRTDevice::build_tlas(BVHHIPRT *bvh,
return scene; return scene;
} }
void HIPRTDevice::free_bvh_memory_delayed()
{
thread_scoped_lock lock(hiprt_mutex);
if (stale_bvh.size()) {
for (int bvh_index = 0; bvh_index < stale_bvh.size(); bvh_index++) {
hiprtGeometry hiprt_geom = stale_bvh[bvh_index];
hiprtDestroyGeometry(hiprt_context, hiprt_geom);
hiprt_geom = nullptr;
}
stale_bvh.clear();
}
}
void HIPRTDevice::release_bvh(BVH *bvh)
{
BVHHIPRT *current_bvh = static_cast<BVHHIPRT *>(bvh);
thread_scoped_lock lock(hiprt_mutex);
/* Tracks BLAS pointers whose BVH destructors have been called. */
stale_bvh.push_back(current_bvh->hiprt_geom);
}
void HIPRTDevice::build_bvh(BVH *bvh, Progress &progress, bool refit) void HIPRTDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
{ {
if (have_error()) { if (have_error()) {
return; return;
} }
free_bvh_memory_delayed();
progress.set_substatus("Building HIPRT acceleration structure"); progress.set_substatus("Building HIPRT acceleration structure");
hiprtBuildOptions options; hiprtBuildOptions options;
@@ -1173,6 +1195,7 @@ void HIPRTDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
if (scene) { if (scene) {
hiprtDestroyScene(hiprt_context, scene); hiprtDestroyScene(hiprt_context, scene);
scene = nullptr;
} }
scene = build_tlas(bvh_rt, bvh_rt->objects, options, refit); scene = build_tlas(bvh_rt, bvh_rt->objects, options, refit);
} }

View File

@@ -46,6 +46,8 @@ class HIPRTDevice : public HIPDevice {
void build_bvh(BVH *bvh, Progress &progress, bool refit) override; void build_bvh(BVH *bvh, Progress &progress, bool refit) override;
void release_bvh(BVH *bvh) override;
hiprtContext get_hiprt_context() hiprtContext get_hiprt_context()
{ {
return hiprt_context; return hiprt_context;
@@ -65,7 +67,7 @@ class HIPRTDevice : public HIPDevice {
const vector<Object *> &objects, const vector<Object *> &objects,
hiprtBuildOptions options, hiprtBuildOptions options,
bool refit); bool refit);
void free_bvh_memory_delayed();
hiprtContext hiprt_context; hiprtContext hiprt_context;
hiprtScene scene; hiprtScene scene;
hiprtFuncTable functions_table; hiprtFuncTable functions_table;
@@ -74,6 +76,13 @@ class HIPRTDevice : public HIPDevice {
size_t scratch_buffer_size; size_t scratch_buffer_size;
device_vector<char> scratch_buffer; device_vector<char> scratch_buffer;
/* This vector tracks the hiprt_geom members of BVHRT so that device memory
* can be managed/released in HIPRTDevice.
* Even if synchronization occurs before memory release, a GPU job may still
* launch between synchronization and release, potentially causing the GPU
* to access unmapped memory. */
vector<hiprtGeometry> stale_bvh;
/* Is this scene using motion blur? Note there might exist motion data even if /* Is this scene using motion blur? Note there might exist motion data even if
* motion blur is disabled, for render passes. */ * motion blur is disabled, for render passes. */
bool use_motion_blur = false; bool use_motion_blur = false;

View File

@@ -107,7 +107,7 @@ class ActionSlot(PropertyGroup, ActionSlotBase):
return str(action_slot.handle) return str(action_slot.handle)
action_slot_ui: StringProperty( action_slot_ui: StringProperty(
name="Acion Slot", name="Action Slot",
description="Slot of the Action to use for the Action Constraints", description="Slot of the Action to use for the Action Constraints",
# These callbacks let us store the action slot's `handle` property # These callbacks let us store the action slot's `handle` property
# under the hood (which is unique and never changes), while acting # under the hood (which is unique and never changes), while acting

View File

@@ -669,12 +669,12 @@ class NODE_OT_add_zone(NodeAddZoneOperator, Operator):
input_node_type: StringProperty( input_node_type: StringProperty(
name="Input Node", name="Input Node",
description="Specifies the input node used the created zone", description="Specifies the input node used by the created zone",
) )
output_node_type: StringProperty( output_node_type: StringProperty(
name="Output Node", name="Output Node",
description="Specifies the output node used the created zone", description="Specifies the output node used by the created zone",
) )
add_default_geometry_link: BoolProperty( add_default_geometry_link: BoolProperty(
@@ -691,12 +691,12 @@ class NODE_OT_swap_zone(ZoneOperator, NodeSwapOperator, Operator):
input_node_type: StringProperty( input_node_type: StringProperty(
name="Input Node", name="Input Node",
description="Specifies the input node used the created zone", description="Specifies the input node used by the created zone",
) )
output_node_type: StringProperty( output_node_type: StringProperty(
name="Output Node", name="Output Node",
description="Specifies the output node used the created zone", description="Specifies the output node used by the created zone",
) )
add_default_geometry_link: BoolProperty( add_default_geometry_link: BoolProperty(

View File

@@ -1342,7 +1342,7 @@ class WM_OT_doc_view_manual(Operator):
self.report( self.report(
{'WARNING'}, {'WARNING'},
rpt_("No reference available {!r}, " rpt_("No reference available {!r}, "
"Update info in '_rna_manual_reference.py' " "update info in '_rna_manual_reference.py' "
"or callback to bpy.utils.manual_map()").format(self.doc_id) "or callback to bpy.utils.manual_map()").format(self.doc_id)
) )
return {'CANCELLED'} return {'CANCELLED'}

View File

@@ -294,9 +294,6 @@ def draw_shape_key_properties(context, layout):
row.active = enable_edit_value row.active = enable_edit_value
row.prop(key, "eval_time") row.prop(key, "eval_time")
if ob.type == 'MESH':
layout.prop(ob, "add_rest_position_attribute")
class DATA_PT_shape_keys(MeshButtonsPanel, Panel): class DATA_PT_shape_keys(MeshButtonsPanel, Panel):
bl_label = "Shape Keys" bl_label = "Shape Keys"
@@ -338,6 +335,12 @@ class DATA_PT_shape_keys(MeshButtonsPanel, Panel):
col.menu("MESH_MT_shape_key_context_menu", icon='DOWNARROW_HLT', text="") col.menu("MESH_MT_shape_key_context_menu", icon='DOWNARROW_HLT', text="")
if ob.type == 'MESH':
row = layout.row(align=True)
row.use_property_split = False
row.alignment = 'LEFT'
row.prop(ob, "add_rest_position_attribute")
if kb: if kb:
col.separator() col.separator()

View File

@@ -81,7 +81,7 @@ static void rna_FileBrowser_deselect_all(SpaceFile *sfile, ReportList *reports)
if (sfile->files == nullptr) { if (sfile->files == nullptr) {
/* Likely to happen in background mode. /* Likely to happen in background mode.
* We could look into initializing this on demand, see: #141547. */ * We could look into initializing this on demand, see: #141547. */
BKE_report(reports, RPT_ERROR, "uninitialized file-list"); BKE_report(reports, RPT_ERROR, "Uninitialized file-list");
return; return;
} }
ED_fileselect_deselect_all(sfile); ED_fileselect_deselect_all(sfile);