1 | // Copyright (C) 2024 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #include "qopenxrhelpers_p.h" |
5 | #include <QDebug> |
6 | |
7 | QT_BEGIN_NAMESPACE |
8 | |
9 | QString OpenXRHelpers::getXrResultAsString(XrResult result, XrInstance instance) |
10 | { |
11 | QByteArray errorString(XR_MAX_RESULT_STRING_SIZE, 0); |
12 | xrResultToString(instance, value: result, buffer: errorString.data()); |
13 | errorString.resize(size: qstrlen(str: errorString.constData())); |
14 | return QString::fromUtf8(ba: errorString).trimmed(); |
15 | } |
16 | |
17 | bool OpenXRHelpers::checkXrResult(XrResult result, XrInstance instance) |
18 | { |
19 | if (result != XrResult::XR_SUCCESS) { |
20 | qWarning().noquote().nospace() << "OpenXR call failed ("<< result << "): "<< getXrResultAsString(result, instance); |
21 | return false; |
22 | } |
23 | return true; |
24 | } |
25 | |
26 | QT_END_NAMESPACE |
27 |