1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Merge pull request #110948 from aaronfranke/const-ref-param-openxr

Use const ref parameters in the OpenXR module
This commit is contained in:
Thaddeus Crews
2025-09-30 11:19:11 -05:00
36 changed files with 183 additions and 185 deletions

View File

@@ -519,7 +519,7 @@ bool OpenXRAPI::interaction_profile_supports_io_path(const String &p_ip_path, co
return true;
}
void OpenXRAPI::copy_string_to_char_buffer(const String p_string, char *p_buffer, int p_buffer_len) {
void OpenXRAPI::copy_string_to_char_buffer(const String &p_string, char *p_buffer, int p_buffer_len) {
CharString char_string = p_string.utf8();
int len = char_string.length();
if (len < p_buffer_len - 1) {
@@ -1233,7 +1233,7 @@ bool OpenXRAPI::obtain_swapchain_formats() {
return true;
}
bool OpenXRAPI::create_main_swapchains(Size2i p_size) {
bool OpenXRAPI::create_main_swapchains(const Size2i &p_size) {
ERR_NOT_ON_RENDER_THREAD_V(false);
ERR_FAIL_NULL_V(graphics_extension, false);
ERR_FAIL_COND_V(session == XR_NULL_HANDLE, false);
@@ -2915,15 +2915,15 @@ void OpenXRAPI::parse_velocities(const XrSpaceVelocity &p_velocity, Vector3 &r_l
}
}
bool OpenXRAPI::xr_result(XrResult result, const char *format, Array args) const {
if (XR_SUCCEEDED(result)) {
bool OpenXRAPI::xr_result(XrResult p_result, const char *p_format, const Array &p_args) const {
if (XR_SUCCEEDED(p_result)) {
return true;
}
char resultString[XR_MAX_RESULT_STRING_SIZE];
xrResultToString(instance, result, resultString);
xrResultToString(instance, p_result, resultString);
print_error(String("OpenXR ") + String(format).format(args) + String(" [") + String(resultString) + String("]"));
print_error(String("OpenXR ") + String(p_format).format(p_args) + String(" [") + String(resultString) + String("]"));
return false;
}
@@ -2983,7 +2983,7 @@ RID OpenXRAPI::find_tracker(const String &p_name) {
return RID();
}
RID OpenXRAPI::tracker_create(const String p_name) {
RID OpenXRAPI::tracker_create(const String &p_name) {
ERR_FAIL_COND_V(instance == XR_NULL_HANDLE, RID());
Tracker new_tracker;
@@ -3053,7 +3053,7 @@ void OpenXRAPI::tracker_free(RID p_tracker) {
tracker_owner.free(p_tracker);
}
RID OpenXRAPI::action_set_create(const String p_name, const String p_localized_name, const int p_priority) {
RID OpenXRAPI::action_set_create(const String &p_name, const String &p_localized_name, const int p_priority) {
ERR_FAIL_COND_V(instance == XR_NULL_HANDLE, RID());
ActionSet action_set;
@@ -3083,7 +3083,7 @@ RID OpenXRAPI::action_set_create(const String p_name, const String p_localized_n
return action_set_owner.make_rid(action_set);
}
RID OpenXRAPI::find_action_set(const String p_name) {
RID OpenXRAPI::find_action_set(const String &p_name) {
for (const RID &action_set_rid : action_set_owner.get_owned_list()) {
ActionSet *action_set = action_set_owner.get_or_null(action_set_rid);
if (action_set && action_set->name == p_name) {
@@ -3207,7 +3207,7 @@ RID OpenXRAPI::find_action(const String &p_name, const RID &p_action_set) {
return RID();
}
RID OpenXRAPI::action_create(RID p_action_set, const String p_name, const String p_localized_name, OpenXRAction::ActionType p_action_type, const Vector<RID> &p_trackers) {
RID OpenXRAPI::action_create(RID p_action_set, const String &p_name, const String &p_localized_name, OpenXRAction::ActionType p_action_type, const Vector<RID> &p_trackers) {
ERR_FAIL_COND_V(instance == XR_NULL_HANDLE, RID());
Action action;
@@ -3333,7 +3333,7 @@ XrPath OpenXRAPI::get_interaction_profile_path(RID p_interaction_profile) {
return ip->path;
}
RID OpenXRAPI::interaction_profile_create(const String p_name) {
RID OpenXRAPI::interaction_profile_create(const String &p_name) {
if (!is_interaction_profile_supported(p_name)) {
// The extension enabling this path must not be active, we will silently skip this interaction profile
return RID();
@@ -3374,7 +3374,7 @@ void OpenXRAPI::interaction_profile_clear_bindings(RID p_interaction_profile) {
ip->bindings.clear();
}
int OpenXRAPI::interaction_profile_add_binding(RID p_interaction_profile, RID p_action, const String p_path) {
int OpenXRAPI::interaction_profile_add_binding(RID p_interaction_profile, RID p_action, const String &p_path) {
InteractionProfile *ip = interaction_profile_owner.get_or_null(p_interaction_profile);
ERR_FAIL_NULL_V(ip, -1);
@@ -3482,7 +3482,7 @@ void OpenXRAPI::interaction_profile_free(RID p_interaction_profile) {
interaction_profile_owner.free(p_interaction_profile);
}
bool OpenXRAPI::sync_action_sets(const Vector<RID> p_active_sets) {
bool OpenXRAPI::sync_action_sets(const Vector<RID> &p_active_sets) {
ERR_FAIL_COND_V(session == XR_NULL_HANDLE, false);
if (!running) {