1
0
Fork 0

Merge pull request #109344 from Calinou/doc-os-get-video-adapter-driver-info-thread

Document `OS.get_video_adapter_driver_info()` being slow to call the first time
This commit is contained in:
Thaddeus Crews 2025-08-06 12:01:06 -05:00
commit 253043dccc
No known key found for this signature in database
GPG Key ID: 8C6E5FEB5FC03CCC
1 changed files with 19 additions and 0 deletions

View File

@ -611,6 +611,25 @@
The first element holds the driver name, such as [code]nvidia[/code], [code]amdgpu[/code], etc.
The second element holds the driver version. For example, on the [code]nvidia[/code] driver on a Linux/BSD platform, the version is in the format [code]510.85.02[/code]. For Windows, the driver's format is [code]31.0.15.1659[/code].
[b]Note:[/b] This method is only supported on Linux/BSD and Windows when not running in headless mode. On other platforms, it returns an empty array.
[b]Note:[/b] This method will run slowly the first time it is called in a session; it can take several seconds depending on the operating system and hardware. It is blocking if called on the main thread, so it's recommended to call it on a separate thread using [Thread]. This allows the engine to keep running while the information is being retrieved. However, [method get_video_adapter_driver_info] is [i]not[/i] thread-safe, so it should not be called from multiple threads at the same time.
[codeblocks]
[gdscript]
var thread = Thread.new()
func _ready():
thread.start(
func():
var driver_info = OS.get_video_adapter_driver_info()
if not driver_info.is_empty():
print("Driver: %s %s" % [driver_info[0], driver_info[1]])
else:
print("Driver: (unknown)")
)
func _exit_tree():
thread.wait_to_finish()
[/gdscript]
[/codeblocks]
</description>
</method>
<method name="has_environment" qualifiers="const">