Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

OpenXRAndroidThreadSettingsExtension

继承: OpenXRExtensionWrapper < Object

封装了 XR_KHR_android_thread_settings 扩展。

描述

为了让扩展现实(XR)体验更加舒适,应用程序必须快速且稳定地渲染画面。为了确保重要的应用程序线程能够获得足够的运行时间,必须将这些线程告知系统,系统会相应地调整它们的调度优先级。

方法

bool

set_application_thread_type(thread_type: ThreadType, thread_id: int = 0)


枚举

enum ThreadType: 🔗

ThreadType THREAD_TYPE_APPLICATION_MAIN = 0

给 XR 运行时的提示,表明该线程正在执行时间敏感的 CPU 任务。

ThreadType THREAD_TYPE_APPLICATION_WORKER = 1

给 XR 运行时的提示,表明该线程正在执行后台 CPU 任务。

ThreadType THREAD_TYPE_RENDERER_MAIN = 2

给 XR 运行时的提示,表明该线程正在执行时间敏感的图形设备任务。

ThreadType THREAD_TYPE_RENDERER_WORKER = 3

给 XR 运行时的提示,表明该线程正在执行后台图形设备任务。


方法说明

bool set_application_thread_type(thread_type: ThreadType, thread_id: int = 0) 🔗

设置给定线程的线程类型,以便 XR 运行时可以相应地调整其调度优先级。

thread_id 指的是操作系统线程 ID(例如,来自 gettid())。当 thread_id0 时,它将设置当前线程的线程类型。

注意:Thread.get_id() 返回的 ID 与 thread_id 不兼容。