Expose ArrayMesh surface RD buffer RIDs to GDExtensions

Adds Mesh equivalents of `multimesh_get_buffer_rd_rid` so GPU-driven mesh
workflows in a GDExtension can write directly into a surface's vertex,
attribute, skin, or index buffer from a compute pipeline, avoiding the
CPU round-trip through `mesh_surface_update_*_region`.

A new `ARRAY_FLAG_USE_STORAGE_BUFFER` surface format flag opts the backing
buffers into storage-buffer usage so they can be bound in compute shaders.

Vulkan/D3D12/Metal only, OpenGL returns an invalid RID.
This commit is contained in:
Kotob M
2026-04-26 15:34:54 +03:00
parent 6d6e822c68
commit 7cbebab1d0
13 changed files with 126 additions and 4 deletions
+7
View File
@@ -2386,6 +2386,11 @@ void RenderingServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("mesh_surface_update_skin_region", "mesh", "surface", "offset", "data"), &RenderingServer::mesh_surface_update_skin_region);
ClassDB::bind_method(D_METHOD("mesh_surface_update_index_region", "mesh", "surface", "offset", "data"), &RenderingServer::mesh_surface_update_index_region);
ClassDB::bind_method(D_METHOD("mesh_surface_get_vertex_buffer_rd_rid", "mesh", "surface"), &RenderingServer::mesh_surface_get_vertex_buffer_rd_rid);
ClassDB::bind_method(D_METHOD("mesh_surface_get_attribute_buffer_rd_rid", "mesh", "surface"), &RenderingServer::mesh_surface_get_attribute_buffer_rd_rid);
ClassDB::bind_method(D_METHOD("mesh_surface_get_skin_buffer_rd_rid", "mesh", "surface"), &RenderingServer::mesh_surface_get_skin_buffer_rd_rid);
ClassDB::bind_method(D_METHOD("mesh_surface_get_index_buffer_rd_rid", "mesh", "surface"), &RenderingServer::mesh_surface_get_index_buffer_rd_rid);
ClassDB::bind_method(D_METHOD("mesh_set_shadow_mesh", "mesh", "shadow_mesh"), &RenderingServer::mesh_set_shadow_mesh);
BIND_ENUM_CONSTANT(RSE::ARRAY_VERTEX);
@@ -2448,6 +2453,8 @@ void RenderingServer::_bind_methods() {
BIND_BITFIELD_FLAG(RSE::ARRAY_FLAG_COMPRESS_ATTRIBUTES);
BIND_BITFIELD_FLAG(RSE::ARRAY_FLAG_USE_STORAGE_BUFFER);
BIND_BITFIELD_FLAG(RSE::ARRAY_FLAG_FORMAT_VERSION_BASE);
BIND_BITFIELD_FLAG(RSE::ARRAY_FLAG_FORMAT_VERSION_SHIFT);
BIND_BITFIELD_FLAG(RSE::ARRAY_FLAG_FORMAT_VERSION_1);