| 827 | } |
| 828 | |
| 829 | bool XRInterface::beginRenderFrame() { |
| 830 | #if CC_USE_XR |
| 831 | if (IS_ENABLE_XR_LOG) CC_LOG_INFO("[XR] beginRenderFrame.%d", _committedFrame); |
| 832 | _isEnabledEyeRenderJsCallback = xr::XrEntry::getInstance()->getXRConfig(xr::XRConfigKey::EYE_RENDER_JS_CALLBACK).getBool(); |
| 833 | if (gfx::DeviceAgent::getInstance()) { |
| 834 | static uint64_t frameId = 0; |
| 835 | frameId++; |
| 836 | if (_committedFrame) { |
| 837 | gfx::DeviceAgent::getInstance()->presentWait(); |
| 838 | _committedFrame = false; |
| 839 | } |
| 840 | if (IS_ENABLE_XR_LOG) CC_LOG_INFO("[XR] beginRenderFrame waitFrame.%lld", frameId); |
| 841 | xr::XrEntry::getInstance()->waitFrame(); |
| 842 | ENQUEUE_MESSAGE_1(gfx::DeviceAgent::getInstance()->getMessageQueue(), |
| 843 | BeginRenderFrame, frameId, frameId, |
| 844 | { |
| 845 | if (IS_ENABLE_XR_LOG) CC_LOG_INFO("[XR] [RT] beginRenderFrame.%lld", frameId); |
| 846 | xr::XrEntry::getInstance()->frameStart(); |
| 847 | }) |
| 848 | #if CC_USE_XR_REMOTE_PREVIEW |
| 849 | if (_xrRemotePreviewManager) { |
| 850 | _xrRemotePreviewManager->tick(); |
| 851 | } |
| 852 | #endif |
| 853 | return true; |
| 854 | } |
| 855 | |
| 856 | #if CC_USE_XR_REMOTE_PREVIEW |
| 857 | if (_xrRemotePreviewManager) { |
| 858 | _xrRemotePreviewManager->tick(); |
| 859 | } |
| 860 | #endif |
| 861 | return xr::XrEntry::getInstance()->frameStart(); |
| 862 | #else |
| 863 | return false; |
| 864 | #endif |
| 865 | } |
| 866 | |
| 867 | bool XRInterface::isRenderAllowable() { |
| 868 | #if CC_USE_XR |
no test coverage detected