mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-28 18:46:18 +00:00
xrt: Some clang tidy fixes.
A few suppressions as well where clang-tidy did the wrong thing.
This commit is contained in:
parent
f1432789ee
commit
146218b346
|
@ -2,7 +2,7 @@
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
# SPDX-FileCopyrightText: 2018-2020 Collabora, Ltd. and the Monado contributors
|
# SPDX-FileCopyrightText: 2018-2020 Collabora, Ltd. and the Monado contributors
|
||||||
# Ideally we'd turn back on a few of these that are disabled near the end
|
# Ideally we'd turn back on a few of these that are disabled near the end
|
||||||
Checks: 'clang-diagnostic-*,clang-analyzer-*,performance-*,bugprone-*,cert-*,readability-*,misc-*,-modernize-*,-clang-analyzer-security.insecureAPI.strcpy,-bugprone-macro-parentheses,-readability-braces-around-statements,-misc-unused-parameters,-readability-implicit-bool-conversion,-clang-diagnostic-missing-field-initializers,-clang-diagnostic-missing-braces'
|
Checks: 'clang-diagnostic-*,clang-analyzer-*,performance-*,bugprone-*,cert-*,readability-*,misc-*,-modernize-*,-clang-analyzer-security.insecureAPI.strcpy,-bugprone-macro-parentheses,-readability-braces-around-statements,-misc-unused-parameters,-readability-implicit-bool-conversion,-clang-diagnostic-missing-field-initializers,-clang-diagnostic-missing-braces,-readability-uppercase-literal-suffix'
|
||||||
WarningsAsErrors: ''
|
WarningsAsErrors: ''
|
||||||
HeaderFilterRegex: 'src/xrt/.*'
|
HeaderFilterRegex: 'src/xrt/.*'
|
||||||
AnalyzeTemporaryDtors: false
|
AnalyzeTemporaryDtors: false
|
||||||
|
|
|
@ -126,11 +126,11 @@ gravity_correction(struct m_imu_3dof *f,
|
||||||
*/
|
*/
|
||||||
float correction_radians = 0.5 * gyro_length * max_radians;
|
float correction_radians = 0.5 * gyro_length * max_radians;
|
||||||
// Clamp to the range [min_radians, max_radians]
|
// Clamp to the range [min_radians, max_radians]
|
||||||
correction_radians = fmax(min_radians, correction_radians);
|
correction_radians = fmaxf(min_radians, correction_radians);
|
||||||
correction_radians = fmin(max_radians, correction_radians);
|
correction_radians = fminf(max_radians, correction_radians);
|
||||||
// Do not exceed the remaining error to correct for
|
// Do not exceed the remaining error to correct for
|
||||||
correction_radians =
|
correction_radians =
|
||||||
-fmin(correction_radians, f->grav.error_angle);
|
-fminf(correction_radians, f->grav.error_angle);
|
||||||
|
|
||||||
// Update how much is left.
|
// Update how much is left.
|
||||||
f->grav.error_angle += correction_radians;
|
f->grav.error_angle += correction_radians;
|
||||||
|
|
|
@ -453,7 +453,8 @@ gatt_iface_get_flag_notifiable(const DBusMessageIter *iface_elm, bool *out_bool)
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
// Error
|
// Error
|
||||||
return ret;
|
return ret;
|
||||||
} else if (ret > 0) {
|
}
|
||||||
|
if (ret > 0) {
|
||||||
// Found the notify field!
|
// Found the notify field!
|
||||||
*out_bool = true;
|
*out_bool = true;
|
||||||
}
|
}
|
||||||
|
@ -744,7 +745,8 @@ init_ble_notify(const char *dev_uuid,
|
||||||
dbus_address, sizeof(dbus_address));
|
dbus_address, sizeof(dbus_address));
|
||||||
if (written == 0) {
|
if (written == 0) {
|
||||||
return -1;
|
return -1;
|
||||||
} else if (written < 0) {
|
}
|
||||||
|
if (written < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -773,7 +775,8 @@ init_ble_notify(const char *dev_uuid,
|
||||||
int type = dbus_message_iter_get_arg_type(&args);
|
int type = dbus_message_iter_get_arg_type(&args);
|
||||||
if (type == DBUS_TYPE_INVALID) {
|
if (type == DBUS_TYPE_INVALID) {
|
||||||
break;
|
break;
|
||||||
} else if (type == DBUS_TYPE_STRING) {
|
}
|
||||||
|
if (type == DBUS_TYPE_STRING) {
|
||||||
dbus_message_iter_get_basic(&args, &response);
|
dbus_message_iter_get_basic(&args, &response);
|
||||||
printf("DBus call returned message: %s\n", response);
|
printf("DBus call returned message: %s\n", response);
|
||||||
} else if (type == DBUS_TYPE_UNIX_FD) {
|
} else if (type == DBUS_TYPE_UNIX_FD) {
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include <opencv2/opencv.hpp>
|
#include <opencv2/opencv.hpp>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
DEBUG_GET_ONCE_BOOL_OPTION(hsv_filter, "T_DEBUG_HSV_FILTER", false)
|
DEBUG_GET_ONCE_BOOL_OPTION(hsv_filter, "T_DEBUG_HSV_FILTER", false)
|
||||||
|
@ -1380,7 +1381,7 @@ populateCacheMats(cv::Size size,
|
||||||
}
|
}
|
||||||
|
|
||||||
NormalizedCoordsCache::NormalizedCoordsCache(
|
NormalizedCoordsCache::NormalizedCoordsCache(
|
||||||
cv::Size size,
|
cv::Size size, // NOLINT // small, pass by value
|
||||||
const cv::Matx33d &intrinsics,
|
const cv::Matx33d &intrinsics,
|
||||||
const cv::Matx<double, 5, 1> &distortion)
|
const cv::Matx<double, 5, 1> &distortion)
|
||||||
{
|
{
|
||||||
|
@ -1394,7 +1395,7 @@ NormalizedCoordsCache::NormalizedCoordsCache(
|
||||||
populateCacheMats(size, inputCoords, outputCoords, cacheX_, cacheY_);
|
populateCacheMats(size, inputCoords, outputCoords, cacheX_, cacheY_);
|
||||||
}
|
}
|
||||||
NormalizedCoordsCache::NormalizedCoordsCache(
|
NormalizedCoordsCache::NormalizedCoordsCache(
|
||||||
cv::Size size,
|
cv::Size size, // NOLINT // small, pass by value
|
||||||
const cv::Matx33d &intrinsics,
|
const cv::Matx33d &intrinsics,
|
||||||
const cv::Matx<double, 5, 1> &distortion,
|
const cv::Matx<double, 5, 1> &distortion,
|
||||||
const cv::Matx33d &rectification,
|
const cv::Matx33d &rectification,
|
||||||
|
@ -1412,7 +1413,7 @@ NormalizedCoordsCache::NormalizedCoordsCache(
|
||||||
}
|
}
|
||||||
|
|
||||||
NormalizedCoordsCache::NormalizedCoordsCache(
|
NormalizedCoordsCache::NormalizedCoordsCache(
|
||||||
cv::Size size,
|
cv::Size size, // NOLINT // small, pass by value
|
||||||
const cv::Matx33d &intrinsics,
|
const cv::Matx33d &intrinsics,
|
||||||
const cv::Matx<double, 5, 1> &distortion,
|
const cv::Matx<double, 5, 1> &distortion,
|
||||||
const cv::Matx33d &rectification,
|
const cv::Matx33d &rectification,
|
||||||
|
@ -1428,9 +1429,10 @@ NormalizedCoordsCache::NormalizedCoordsCache(
|
||||||
|
|
||||||
populateCacheMats(size, inputCoords, outputCoords, cacheX_, cacheY_);
|
populateCacheMats(size, inputCoords, outputCoords, cacheX_, cacheY_);
|
||||||
}
|
}
|
||||||
NormalizedCoordsCache::NormalizedCoordsCache(cv::Size size,
|
NormalizedCoordsCache::NormalizedCoordsCache(
|
||||||
const cv::Mat &intrinsics,
|
cv::Size size, // NOLINT // small, pass by value
|
||||||
const cv::Mat &distortion)
|
const cv::Mat &intrinsics,
|
||||||
|
const cv::Mat &distortion)
|
||||||
{
|
{
|
||||||
std::vector<cv::Vec2f> outputCoords;
|
std::vector<cv::Vec2f> outputCoords;
|
||||||
std::vector<cv::Vec2f> inputCoords =
|
std::vector<cv::Vec2f> inputCoords =
|
||||||
|
@ -1443,7 +1445,9 @@ NormalizedCoordsCache::NormalizedCoordsCache(cv::Size size,
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::Vec2f
|
cv::Vec2f
|
||||||
NormalizedCoordsCache::getNormalizedImageCoords(cv::Point2f origCoords) const
|
NormalizedCoordsCache::getNormalizedImageCoords(
|
||||||
|
// NOLINTNEXTLINE // small, pass by value
|
||||||
|
cv::Point2f origCoords) const
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* getRectSubPix is more strict than the docs would imply:
|
* getRectSubPix is more strict than the docs would imply:
|
||||||
|
@ -1465,7 +1469,7 @@ cv::Vec3f
|
||||||
NormalizedCoordsCache::getNormalizedVector(cv::Point2f origCoords) const
|
NormalizedCoordsCache::getNormalizedVector(cv::Point2f origCoords) const
|
||||||
{
|
{
|
||||||
// cameras traditionally look along -z, so we want negative sqrt
|
// cameras traditionally look along -z, so we want negative sqrt
|
||||||
auto pt = getNormalizedImageCoords(origCoords);
|
auto pt = getNormalizedImageCoords(std::move(origCoords));
|
||||||
auto z = -std::sqrt(1.f - pt.dot(pt));
|
auto z = -std::sqrt(1.f - pt.dot(pt));
|
||||||
return {pt[0], pt[1], z};
|
return {pt[0], pt[1], z};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,18 +7,20 @@
|
||||||
* @author Pete Black <pete.black@collabora.com>
|
* @author Pete Black <pete.black@collabora.com>
|
||||||
* @ingroup aux_util
|
* @ingroup aux_util
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
|
||||||
#include "util/u_bitwise.h"
|
#include "util/u_bitwise.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
get_bit(unsigned char *b, int num)
|
get_bit(const unsigned char *b, int num)
|
||||||
{
|
{
|
||||||
int index = num / 8;
|
int index = num / CHAR_BIT;
|
||||||
return (b[index] >> (7 - (num % 8))) & 1;
|
return (b[index] >> ((CHAR_BIT - 1) - (num % CHAR_BIT))) & 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
get_bits(unsigned char *b, int start, int num)
|
get_bits(const unsigned char *b, int start, int num)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
for (int i = 0; i < num; i++) {
|
for (int i = 0; i < num; i++) {
|
||||||
|
@ -29,7 +31,10 @@ get_bits(unsigned char *b, int start, int num)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
sign_extend_13(unsigned int i)
|
sign_extend_13(uint32_t i)
|
||||||
{
|
{
|
||||||
return ((int)(i << 19)) >> 19;
|
static const size_t incoming_int_width = 13;
|
||||||
|
static const size_t adjustment =
|
||||||
|
(sizeof(i) * CHAR_BIT) - incoming_int_width;
|
||||||
|
return ((int)(i << adjustment)) >> adjustment;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,18 +10,24 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
get_bit(unsigned char *b, int num);
|
get_bit(const unsigned char *b, int num);
|
||||||
|
|
||||||
int
|
int
|
||||||
get_bits(unsigned char *b, int start, int num);
|
get_bits(const unsigned char *b, int start, int num);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Interpret the least-significant 13 bits as a signed 13-bit integer, and cast
|
||||||
|
* it to a signed int for normal usage.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
sign_extend_13(unsigned int i);
|
sign_extend_13(uint32_t i);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -55,12 +55,12 @@ u_file_get_config_dir(char *out_path, size_t out_path_size)
|
||||||
const char *home = getenv("HOME");
|
const char *home = getenv("HOME");
|
||||||
if (xgd_home != NULL) {
|
if (xgd_home != NULL) {
|
||||||
return snprintf(out_path, out_path_size, "%s/monado", xgd_home);
|
return snprintf(out_path, out_path_size, "%s/monado", xgd_home);
|
||||||
} else if (home != NULL) {
|
}
|
||||||
|
if (home != NULL) {
|
||||||
return snprintf(out_path, out_path_size, "%s/.config/monado",
|
return snprintf(out_path, out_path_size, "%s/.config/monado",
|
||||||
home);
|
home);
|
||||||
} else {
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
|
|
|
@ -76,7 +76,7 @@ u_format_block_width(enum xrt_format f)
|
||||||
case XRT_FORMAT_BITMAP_8X8:
|
case XRT_FORMAT_BITMAP_8X8:
|
||||||
case XRT_FORMAT_BITMAP_8X1:
|
case XRT_FORMAT_BITMAP_8X1:
|
||||||
// Eight pixels per block.
|
// Eight pixels per block.
|
||||||
return 8;
|
return 8; // NOLINT
|
||||||
default: assert(!"unsupported format"); return 0;
|
default: assert(!"unsupported format"); return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,13 +51,12 @@ u_json_get_string_into_array(const cJSON *json, char *out_str, size_t max_size)
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
U_LOG_E("Printing string failed: %d", ret);
|
U_LOG_E("Printing string failed: %d", ret);
|
||||||
return false;
|
return false;
|
||||||
} else if ((size_t)ret < max_size) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
U_LOG_E("String size %d is bigger than available %zu", ret,
|
|
||||||
max_size);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
if ((size_t)ret < max_size) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
U_LOG_E("String size %d is bigger than available %zu", ret, max_size);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -216,9 +216,8 @@ vk_ic_from_natives(struct vk_bundle *vk,
|
||||||
if (ret != VK_SUCCESS) {
|
if (ret != VK_SUCCESS) {
|
||||||
close(fd);
|
close(fd);
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
native_images[i].fd = fd;
|
|
||||||
}
|
}
|
||||||
|
native_images[i].fd = fd;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ compositor_wait_frame(struct xrt_compositor *xc,
|
||||||
int64_t render_time_ns =
|
int64_t render_time_ns =
|
||||||
c->expected_app_duration_ns + c->frame_overhead_ns;
|
c->expected_app_duration_ns + c->frame_overhead_ns;
|
||||||
int64_t swap_interval =
|
int64_t swap_interval =
|
||||||
ceil((float)render_time_ns / interval_ns);
|
ceilf((float)render_time_ns / interval_ns);
|
||||||
int64_t render_interval_ns = swap_interval * interval_ns;
|
int64_t render_interval_ns = swap_interval * interval_ns;
|
||||||
int64_t next_display_time =
|
int64_t next_display_time =
|
||||||
c->last_next_display_time + render_interval_ns;
|
c->last_next_display_time + render_interval_ns;
|
||||||
|
@ -475,6 +475,7 @@ compositor_poll_events(struct xrt_compositor *xc,
|
||||||
#define GET_DEV_PROC(c, name) \
|
#define GET_DEV_PROC(c, name) \
|
||||||
(PFN_##name) c->vk.vkGetDeviceProcAddr(c->vk.device, #name);
|
(PFN_##name) c->vk.vkGetDeviceProcAddr(c->vk.device, #name);
|
||||||
|
|
||||||
|
// NOLINTNEXTLINE // don't remove the forward decl.
|
||||||
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
|
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
|
||||||
vkGetInstanceProcAddr(VkInstance instance, const char *pName);
|
vkGetInstanceProcAddr(VkInstance instance, const char *pName);
|
||||||
|
|
||||||
|
|
|
@ -478,9 +478,8 @@ get_image_view(struct comp_swapchain_image *image,
|
||||||
{
|
{
|
||||||
if (flags & XRT_LAYER_COMPOSITION_BLEND_TEXTURE_SOURCE_ALPHA_BIT) {
|
if (flags & XRT_LAYER_COMPOSITION_BLEND_TEXTURE_SOURCE_ALPHA_BIT) {
|
||||||
return image->views.alpha[array_index];
|
return image->views.alpha[array_index];
|
||||||
} else {
|
|
||||||
return image->views.no_alpha[array_index];
|
|
||||||
}
|
}
|
||||||
|
return image->views.no_alpha[array_index];
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
comp_renderer_set_quad_layer(struct comp_renderer *r,
|
comp_renderer_set_quad_layer(struct comp_renderer *r,
|
||||||
|
|
|
@ -43,9 +43,8 @@ swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *out_index)
|
||||||
int res = u_index_fifo_pop(&sc->fifo, out_index);
|
int res = u_index_fifo_pop(&sc->fifo, out_index);
|
||||||
if (res >= 0) {
|
if (res >= 0) {
|
||||||
return XRT_SUCCESS;
|
return XRT_SUCCESS;
|
||||||
} else {
|
|
||||||
return XRT_ERROR_NO_IMAGE_AVAILABLE;
|
|
||||||
}
|
}
|
||||||
|
return XRT_ERROR_NO_IMAGE_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static xrt_result_t
|
static xrt_result_t
|
||||||
|
@ -70,10 +69,9 @@ swapchain_release_image(struct xrt_swapchain *xsc, uint32_t index)
|
||||||
|
|
||||||
if (res >= 0) {
|
if (res >= 0) {
|
||||||
return XRT_SUCCESS;
|
return XRT_SUCCESS;
|
||||||
} else {
|
|
||||||
// FIFO full
|
|
||||||
return XRT_ERROR_NO_IMAGE_AVAILABLE;
|
|
||||||
}
|
}
|
||||||
|
// FIFO full
|
||||||
|
return XRT_ERROR_NO_IMAGE_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ OpticalSystem::RegenerateMesh()
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2
|
Vector2
|
||||||
OpticalSystem::RenderUVToDisplayUV(Vector2 inputUV)
|
OpticalSystem::RenderUVToDisplayUV(const Vector2 &inputUV)
|
||||||
{
|
{
|
||||||
Vector3 rayDir;
|
Vector3 rayDir;
|
||||||
ViewportPointToRayDirection(inputUV, eyePosition, clipToWorld, rayDir);
|
ViewportPointToRayDirection(inputUV, eyePosition, clipToWorld, rayDir);
|
||||||
|
@ -118,7 +118,7 @@ OpticalSystem::RenderUVToDisplayUV(Vector2 inputUV)
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2
|
Vector2
|
||||||
OpticalSystem::RenderUVToDisplayUV(Vector3 inputUV)
|
OpticalSystem::RenderUVToDisplayUV(const Vector3 &inputUV)
|
||||||
{
|
{
|
||||||
|
|
||||||
Vector3 sphereSpaceRayOrigin =
|
Vector3 sphereSpaceRayOrigin =
|
||||||
|
@ -188,7 +188,7 @@ OpticalSystem::RenderUVToDisplayUV(Vector3 inputUV)
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2
|
Vector2
|
||||||
OpticalSystem::SolveDisplayUVToRenderUV(Vector2 inputUV,
|
OpticalSystem::SolveDisplayUVToRenderUV(const Vector2 &inputUV,
|
||||||
Vector2 initailGuess,
|
Vector2 initailGuess,
|
||||||
int iterations)
|
int iterations)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,13 +26,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2
|
Vector2
|
||||||
RenderUVToDisplayUV(Vector3 inputUV);
|
RenderUVToDisplayUV(const Vector3 &inputUV);
|
||||||
|
|
||||||
Vector2
|
Vector2
|
||||||
RenderUVToDisplayUV(Vector2 inputUV);
|
RenderUVToDisplayUV(const Vector2 &inputUV);
|
||||||
|
|
||||||
Vector2
|
Vector2
|
||||||
SolveDisplayUVToRenderUV(Vector2 inputUV,
|
SolveDisplayUVToRenderUV(const Vector2 &inputUV,
|
||||||
Vector2 initailGuess,
|
Vector2 initailGuess,
|
||||||
int iterations);
|
int iterations);
|
||||||
|
|
||||||
|
|
|
@ -183,8 +183,8 @@ ns_mesh(struct u_uv_generator *gen)
|
||||||
* @ingroup drv_ns
|
* @ingroup drv_ns
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ns_display_uv_to_render_uv(struct ns_uv display_uv,
|
ns_display_uv_to_render_uv(struct ns_uv in,
|
||||||
struct ns_uv *render_uv,
|
struct ns_uv *out,
|
||||||
struct ns_eye *eye);
|
struct ns_eye *eye);
|
||||||
|
|
||||||
struct ns_optical_system *
|
struct ns_optical_system *
|
||||||
|
|
|
@ -108,7 +108,8 @@ init_tracking_origins(struct ipc_server *s)
|
||||||
if (s->xtracks[index] == NULL) {
|
if (s->xtracks[index] == NULL) {
|
||||||
s->xtracks[index] = xtrack;
|
s->xtracks[index] = xtrack;
|
||||||
break;
|
break;
|
||||||
} else if (s->xtracks[index] == xtrack) {
|
}
|
||||||
|
if (s->xtracks[index] == xtrack) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -664,7 +665,8 @@ _overlay_sort_func(const void *a, const void *b)
|
||||||
struct _z_sort_data *ob = (struct _z_sort_data *)b;
|
struct _z_sort_data *ob = (struct _z_sort_data *)b;
|
||||||
if (oa->z_order < ob->z_order) {
|
if (oa->z_order < ob->z_order) {
|
||||||
return -1;
|
return -1;
|
||||||
} else if (oa->z_order > ob->z_order) {
|
}
|
||||||
|
if (oa->z_order > ob->z_order) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -960,7 +962,6 @@ update_server_state(struct ipc_server *s)
|
||||||
s->last_active_client_index = s->active_client_index;
|
s->last_active_client_index = s->active_client_index;
|
||||||
|
|
||||||
os_mutex_unlock(&s->global_state_lock);
|
os_mutex_unlock(&s->global_state_lock);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -292,6 +292,7 @@ oxr_xrGetVulkanDeviceExtensionsKHR(XrInstance instance,
|
||||||
namesCountOutput, namesString);
|
namesCountOutput, namesString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTNEXTLINE // don't remove the forward decl.
|
||||||
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
|
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
|
||||||
vkGetInstanceProcAddr(VkInstance instance, const char *pName);
|
vkGetInstanceProcAddr(VkInstance instance, const char *pName);
|
||||||
|
|
||||||
|
|
|
@ -125,9 +125,8 @@ interaction_profile_find_or_create(struct oxr_logger *log,
|
||||||
strlen(templ->path), &t_path);
|
strlen(templ->path), &t_path);
|
||||||
if (t_path == path) {
|
if (t_path == path) {
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
templ = NULL;
|
|
||||||
}
|
}
|
||||||
|
templ = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (templ == NULL) {
|
if (templ == NULL) {
|
||||||
|
|
|
@ -75,13 +75,6 @@ oxr_action_bind_inputs(struct oxr_logger *log,
|
||||||
struct oxr_interaction_profile *profile,
|
struct oxr_interaction_profile *profile,
|
||||||
enum oxr_sub_action_path sub_path);
|
enum oxr_sub_action_path sub_path);
|
||||||
|
|
||||||
static void
|
|
||||||
oxr_session_get_action_set_attachment(
|
|
||||||
struct oxr_session *sess,
|
|
||||||
XrActionSet actionSet,
|
|
||||||
struct oxr_action_set_attachment **act_set_attached,
|
|
||||||
struct oxr_action_set **act_set);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Action attachment functions
|
* Action attachment functions
|
||||||
|
@ -905,8 +898,8 @@ oxr_input_combine_input(struct oxr_session *sess,
|
||||||
break;
|
break;
|
||||||
case XRT_INPUT_TYPE_VEC1_MINUS_ONE_TO_ONE:
|
case XRT_INPUT_TYPE_VEC1_MINUS_ONE_TO_ONE:
|
||||||
case XRT_INPUT_TYPE_VEC1_ZERO_TO_ONE:
|
case XRT_INPUT_TYPE_VEC1_ZERO_TO_ONE:
|
||||||
if (fabs(transformed.value.vec1.x) >
|
if (fabsf(transformed.value.vec1.x) >
|
||||||
fabs(res.value.vec1.x)) {
|
fabsf(res.value.vec1.x)) {
|
||||||
res.value.vec1.x = transformed.value.vec1.x;
|
res.value.vec1.x = transformed.value.vec1.x;
|
||||||
res_timestamp = input->timestamp;
|
res_timestamp = input->timestamp;
|
||||||
}
|
}
|
||||||
|
@ -923,7 +916,9 @@ oxr_input_combine_input(struct oxr_session *sess,
|
||||||
res_timestamp = input->timestamp;
|
res_timestamp = input->timestamp;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case XRT_INPUT_TYPE_VEC3_MINUS_ONE_TO_ONE: break;
|
case XRT_INPUT_TYPE_VEC3_MINUS_ONE_TO_ONE:
|
||||||
|
// OpenXR has no vec3 right now.
|
||||||
|
break;
|
||||||
case XRT_INPUT_TYPE_POSE:
|
case XRT_INPUT_TYPE_POSE:
|
||||||
// shouldn't be possible to get here
|
// shouldn't be possible to get here
|
||||||
break;
|
break;
|
||||||
|
@ -1127,7 +1122,8 @@ oxr_action_attachment_update(struct oxr_logger *log,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case XR_ACTION_TYPE_FLOAT_INPUT: {
|
case XR_ACTION_TYPE_FLOAT_INPUT: {
|
||||||
float value = -2.0;
|
// Smaller than any possible real value
|
||||||
|
float value = -2.0f; // NOLINT
|
||||||
OXR_FOR_EACH_VALID_SUBACTION_PATH(VEC1_CHECK)
|
OXR_FOR_EACH_VALID_SUBACTION_PATH(VEC1_CHECK)
|
||||||
|
|
||||||
changed = last.value.vec1.x != value;
|
changed = last.value.vec1.x != value;
|
||||||
|
@ -1135,9 +1131,9 @@ oxr_action_attachment_update(struct oxr_logger *log,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case XR_ACTION_TYPE_VECTOR2F_INPUT: {
|
case XR_ACTION_TYPE_VECTOR2F_INPUT: {
|
||||||
float x = 0.0;
|
float x = 0.0f;
|
||||||
float y = 0.0;
|
float y = 0.0f;
|
||||||
float distance = -1.0;
|
float distance = -1.0f;
|
||||||
OXR_FOR_EACH_VALID_SUBACTION_PATH(VEC2_CHECK)
|
OXR_FOR_EACH_VALID_SUBACTION_PATH(VEC2_CHECK)
|
||||||
|
|
||||||
changed = (last.value.vec2.x != x) || (last.value.vec2.y != y);
|
changed = (last.value.vec2.x != x) || (last.value.vec2.y != y);
|
||||||
|
|
|
@ -221,7 +221,8 @@ oxr_space_ref_relation(struct oxr_logger *log,
|
||||||
out_relation->relation_flags =
|
out_relation->relation_flags =
|
||||||
XRT_SPACE_RELATION_BITMASK_NONE;
|
XRT_SPACE_RELATION_BITMASK_NONE;
|
||||||
return XR_SUCCESS;
|
return XR_SUCCESS;
|
||||||
} else if (space == XR_REFERENCE_SPACE_TYPE_STAGE) {
|
}
|
||||||
|
if (space == XR_REFERENCE_SPACE_TYPE_STAGE) {
|
||||||
// device poses are already in stage = "global" space
|
// device poses are already in stage = "global" space
|
||||||
} else if (space == XR_REFERENCE_SPACE_TYPE_LOCAL) {
|
} else if (space == XR_REFERENCE_SPACE_TYPE_LOCAL) {
|
||||||
global_to_local_space(sess, &out_relation->pose);
|
global_to_local_space(sess, &out_relation->pose);
|
||||||
|
|
|
@ -42,7 +42,8 @@ oxr_swapchain_acquire_image(struct oxr_logger *log,
|
||||||
if (res == XRT_ERROR_IPC_FAILURE) {
|
if (res == XRT_ERROR_IPC_FAILURE) {
|
||||||
return oxr_error(log, XR_ERROR_INSTANCE_LOST,
|
return oxr_error(log, XR_ERROR_INSTANCE_LOST,
|
||||||
"Call to xsc->acquire_image failed");
|
"Call to xsc->acquire_image failed");
|
||||||
} else if (res != XRT_SUCCESS) {
|
}
|
||||||
|
if (res != XRT_SUCCESS) {
|
||||||
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
|
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
|
||||||
"Call to xsc->acquire_image failed");
|
"Call to xsc->acquire_image failed");
|
||||||
}
|
}
|
||||||
|
@ -94,7 +95,8 @@ oxr_swapchain_wait_image(struct oxr_logger *log,
|
||||||
if (res == XRT_ERROR_IPC_FAILURE) {
|
if (res == XRT_ERROR_IPC_FAILURE) {
|
||||||
return oxr_error(log, XR_ERROR_INSTANCE_LOST,
|
return oxr_error(log, XR_ERROR_INSTANCE_LOST,
|
||||||
"Call to xsc->wait_image failed");
|
"Call to xsc->wait_image failed");
|
||||||
} else if (res != XRT_SUCCESS) {
|
}
|
||||||
|
if (res != XRT_SUCCESS) {
|
||||||
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
|
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
|
||||||
"Call to xsc->wait_image failed");
|
"Call to xsc->wait_image failed");
|
||||||
}
|
}
|
||||||
|
@ -125,7 +127,8 @@ oxr_swapchain_release_image(struct oxr_logger *log,
|
||||||
if (res == XRT_ERROR_IPC_FAILURE) {
|
if (res == XRT_ERROR_IPC_FAILURE) {
|
||||||
return oxr_error(log, XR_ERROR_INSTANCE_LOST,
|
return oxr_error(log, XR_ERROR_INSTANCE_LOST,
|
||||||
"Call to xsc->release_image failed");
|
"Call to xsc->release_image failed");
|
||||||
} else if (res != XRT_SUCCESS) {
|
}
|
||||||
|
if (res != XRT_SUCCESS) {
|
||||||
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
|
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
|
||||||
"Call to xsc->release_image failed");
|
"Call to xsc->release_image failed");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue