diff --git a/doc/classes/RenderingDevice.xml b/doc/classes/RenderingDevice.xml index 2e92eac2a51..e19bb440ec7 100644 --- a/doc/classes/RenderingDevice.xml +++ b/doc/classes/RenderingDevice.xml @@ -752,6 +752,14 @@ [b]Note:[/b] [param texture] requires the [constant TEXTURE_USAGE_CAN_COPY_FROM_BIT] to be retrieved. Otherwise, an error is printed and a empty [PackedByteArray] is returned. + + + + + Returns the internal graphics handle for this texture object. For use when communicating with third-party APIs mostly with GDExtension. + [b]Note:[/b] This function returns a [code]uint64_t[/code] which internally maps to a [code]GLuint[/code] (OpenGL) or [code]VkImage[/code] (Vulkan). + + diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml index 840a594ec4e..6b65302a7dd 100644 --- a/doc/classes/RenderingServer.xml +++ b/doc/classes/RenderingServer.xml @@ -3286,8 +3286,8 @@ - Returns the internal graphics handle for this texture object. For use when communicating with 3rd party APIs mostly with GDExternal. - [b]Note:[/b] This functions returns a [code]uint64_t[/code] which internally maps to a [code]GLuint[/code] (OpenGL) or [code]VkImage[/code] (Vulkan). + Returns the internal graphics handle for this texture object. For use when communicating with third-party APIs mostly with GDExtension. + [b]Note:[/b] This function returns a [code]uint64_t[/code] which internally maps to a [code]GLuint[/code] (OpenGL) or [code]VkImage[/code] (Vulkan). diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index 4e43c144769..0832a07f51d 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -2882,7 +2882,7 @@ Size2i RenderingDeviceVulkan::texture_size(RID p_texture) { return Size2i(tex->width, tex->height); } -uint64_t RenderingDeviceVulkan::texture_native_handle(RID p_texture) { +uint64_t RenderingDeviceVulkan::texture_get_native_handle(RID p_texture) { _THREAD_SAFE_METHOD_ Texture *tex = texture_owner.get_or_null(p_texture); diff --git a/drivers/vulkan/rendering_device_vulkan.h b/drivers/vulkan/rendering_device_vulkan.h index 6e61ee890dc..9c621c1d441 100644 --- a/drivers/vulkan/rendering_device_vulkan.h +++ b/drivers/vulkan/rendering_device_vulkan.h @@ -1083,7 +1083,7 @@ public: virtual bool texture_is_shared(RID p_texture); virtual bool texture_is_valid(RID p_texture); virtual Size2i texture_size(RID p_texture); - virtual uint64_t texture_native_handle(RID p_texture); + virtual uint64_t texture_get_native_handle(RID p_texture); virtual Error texture_copy(RID p_from_texture, RID p_to_texture, const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_size, uint32_t p_src_mipmap, uint32_t p_dst_mipmap, uint32_t p_src_layer, uint32_t p_dst_layer, BitField p_post_barrier = BARRIER_MASK_ALL_BARRIERS); virtual Error texture_clear(RID p_texture, const Color &p_color, uint32_t p_base_mipmap, uint32_t p_mipmaps, uint32_t p_base_layer, uint32_t p_layers, BitField p_post_barrier = BARRIER_MASK_ALL_BARRIERS); diff --git a/servers/rendering/renderer_geometry_instance.h b/servers/rendering/renderer_geometry_instance.h index 600c5263964..e4c8cb375fc 100644 --- a/servers/rendering/renderer_geometry_instance.h +++ b/servers/rendering/renderer_geometry_instance.h @@ -37,7 +37,7 @@ #include "core/templates/rid.h" #include "storage/utilities.h" -// API definition for our RenderGeometryInstance class so we can expose this through GDExternal in the near future +// API definition for our RenderGeometryInstance class so we can expose this through GDExtension in the near future class RenderGeometryInstance { public: virtual ~RenderGeometryInstance() {} diff --git a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp index 8390782de37..3c4e792b372 100644 --- a/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/texture_storage.cpp @@ -1447,9 +1447,9 @@ uint64_t TextureStorage::texture_get_native_handle(RID p_texture, bool p_srgb) c ERR_FAIL_COND_V(!tex, 0); if (p_srgb && tex->rd_texture_srgb.is_valid()) { - return RD::get_singleton()->texture_native_handle(tex->rd_texture_srgb); + return RD::get_singleton()->texture_get_native_handle(tex->rd_texture_srgb); } else { - return RD::get_singleton()->texture_native_handle(tex->rd_texture); + return RD::get_singleton()->texture_get_native_handle(tex->rd_texture); } } diff --git a/servers/rendering/rendering_device.cpp b/servers/rendering/rendering_device.cpp index 0227f01f6f1..d87c09a8572 100644 --- a/servers/rendering/rendering_device.cpp +++ b/servers/rendering/rendering_device.cpp @@ -720,6 +720,8 @@ void RenderingDevice::_bind_methods() { ClassDB::bind_method(D_METHOD("texture_clear", "texture", "color", "base_mipmap", "mipmap_count", "base_layer", "layer_count", "post_barrier"), &RenderingDevice::texture_clear, DEFVAL(BARRIER_MASK_ALL_BARRIERS)); ClassDB::bind_method(D_METHOD("texture_resolve_multisample", "from_texture", "to_texture", "post_barrier"), &RenderingDevice::texture_resolve_multisample, DEFVAL(BARRIER_MASK_ALL_BARRIERS)); + ClassDB::bind_method(D_METHOD("texture_get_native_handle", "texture"), &RenderingDevice::texture_get_native_handle); + ClassDB::bind_method(D_METHOD("framebuffer_format_create", "attachments", "view_count"), &RenderingDevice::_framebuffer_format_create, DEFVAL(1)); ClassDB::bind_method(D_METHOD("framebuffer_format_create_multipass", "attachments", "passes", "view_count"), &RenderingDevice::_framebuffer_format_create_multipass, DEFVAL(1)); ClassDB::bind_method(D_METHOD("framebuffer_format_create_empty", "samples"), &RenderingDevice::framebuffer_format_create_empty, DEFVAL(TEXTURE_SAMPLES_1)); diff --git a/servers/rendering/rendering_device.h b/servers/rendering/rendering_device.h index ae7de2b8f25..dd2f8d55aa5 100644 --- a/servers/rendering/rendering_device.h +++ b/servers/rendering/rendering_device.h @@ -539,7 +539,7 @@ public: virtual bool texture_is_shared(RID p_texture) = 0; virtual bool texture_is_valid(RID p_texture) = 0; virtual Size2i texture_size(RID p_texture) = 0; - virtual uint64_t texture_native_handle(RID p_texture) = 0; + virtual uint64_t texture_get_native_handle(RID p_texture) = 0; virtual Error texture_copy(RID p_from_texture, RID p_to_texture, const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_size, uint32_t p_src_mipmap, uint32_t p_dst_mipmap, uint32_t p_src_layer, uint32_t p_dst_layer, BitField p_post_barrier = BARRIER_MASK_ALL_BARRIERS) = 0; virtual Error texture_clear(RID p_texture, const Color &p_color, uint32_t p_base_mipmap, uint32_t p_mipmaps, uint32_t p_base_layer, uint32_t p_layers, BitField p_post_barrier = BARRIER_MASK_ALL_BARRIERS) = 0;