From 7b797988cc76047374c9dc4bfa4423e3b5ac5c76 Mon Sep 17 00:00:00 2001 From: LuoZhihao Date: Fri, 21 Feb 2025 21:08:35 +0800 Subject: [PATCH] Document the rids that will be freed automatically when free their deps Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> --- doc/classes/RenderingDevice.xml | 10 ++++++++++ doc/classes/RenderingServer.xml | 2 ++ 2 files changed, 12 insertions(+) diff --git a/doc/classes/RenderingDevice.xml b/doc/classes/RenderingDevice.xml index df54f172cb..12958fe24b 100644 --- a/doc/classes/RenderingDevice.xml +++ b/doc/classes/RenderingDevice.xml @@ -198,6 +198,7 @@ Creates a new compute pipeline. It can be accessed with the RID that is returned. Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. + This will be freed automatically when the [param shader] is freed. @@ -416,6 +417,7 @@ Creates a new framebuffer. It can be accessed with the RID that is returned. Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. + This will be freed automatically when any of the [param textures] is freed. @@ -437,6 +439,7 @@ Creates a new multipass framebuffer. It can be accessed with the RID that is returned. Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. + This will be freed automatically when any of the [param textures] is freed. @@ -695,6 +698,7 @@ Creates a new index array. It can be accessed with the RID that is returned. Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. + This will be freed automatically when the [param index_buffer] is freed. @@ -733,6 +737,7 @@ Creates a new render pipeline. It can be accessed with the RID that is returned. Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. + This will be freed automatically when the [param shader] is freed. @@ -944,6 +949,7 @@ Creates a shared texture using the specified [param view] and the texture information from [param with_texture]. + This will be freed automatically when the [param with_texture] is freed. @@ -958,6 +964,7 @@ Creates a shared texture using the specified [param view] and the texture information from [param with_texture]'s [param layer] and [param mipmap]. The number of included mipmaps from the original texture can be controlled using the [param mipmaps] parameter. Only relevant for textures with multiple layers, such as 3D textures, texture arrays and cubemaps. For single-layer textures, use [method texture_create_shared]. For 2D textures (which only have one layer), [param layer] must be [code]0[/code]. [b]Note:[/b] Layer slicing is only supported for 2D texture arrays, not 3D textures or cubemaps. + This will be freed automatically when the [param with_texture] is freed. @@ -1089,6 +1096,7 @@ Creates a new uniform set. It can be accessed with the RID that is returned. Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. + This will be freed automatically when the [param shader] or any of the RIDs in the [param uniforms] is freed. @@ -1106,6 +1114,8 @@ Creates a vertex array based on the specified buffers. Optionally, [param offsets] (in bytes) may be defined for each buffer. + Once finished with your RID, you will want to free the RID using the RenderingDevice's [method free_rid] method. + This will be freed automatically when any of the [param src_buffers] is freed. diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml index 5d00eca29e..e1f7a53302 100644 --- a/doc/classes/RenderingServer.xml +++ b/doc/classes/RenderingServer.xml @@ -3849,6 +3849,8 @@ Creates a new texture object based on a texture created directly on the [RenderingDevice]. If the texture contains layers, [param layer_type] is used to define the layer type. + Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] method. + [b]Note:[/b] The RenderingServer's [method free_rid] won't free the underlying [param rd_texture], you will want to free the [param rd_texture] using [method RenderingDevice.free_rid].