Commit ebd395f9 authored by Lachlan Ford's avatar Lachlan Ford Committed by Commit Bot

Cleaned up RETURN_IF_XR_FAILED to not require an existing local variable

The RETURN_IF_XR_FAILED macro previously required a local variable to
already exist for it to function correctly. This change removes that
requirement.

Change-Id: Ib0ebb5855abfe8788f906235d2bec95b13eb6655
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1934394
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: default avatarAlexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721069}
parent 1ffc37e9
...@@ -159,8 +159,6 @@ XrResult OpenXrApiWrapper::InitializeSystem() { ...@@ -159,8 +159,6 @@ XrResult OpenXrApiWrapper::InitializeSystem() {
DCHECK(HasInstance()); DCHECK(HasInstance());
DCHECK(!HasSystem()); DCHECK(!HasSystem());
XrResult xr_result;
XrSystemId system; XrSystemId system;
RETURN_IF_XR_FAILED(GetSystem(instance_, &system)); RETURN_IF_XR_FAILED(GetSystem(instance_, &system));
...@@ -187,7 +185,7 @@ XrResult OpenXrApiWrapper::InitializeSystem() { ...@@ -187,7 +185,7 @@ XrResult OpenXrApiWrapper::InitializeSystem() {
system_ = system; system_ = system;
view_configs_ = std::move(view_configs); view_configs_ = std::move(view_configs);
return xr_result; return XR_SUCCESS;
} }
XrResult OpenXrApiWrapper::PickEnvironmentBlendMode(XrSystemId system) { XrResult OpenXrApiWrapper::PickEnvironmentBlendMode(XrSystemId system) {
...@@ -196,7 +194,6 @@ XrResult OpenXrApiWrapper::PickEnvironmentBlendMode(XrSystemId system) { ...@@ -196,7 +194,6 @@ XrResult OpenXrApiWrapper::PickEnvironmentBlendMode(XrSystemId system) {
XR_ENVIRONMENT_BLEND_MODE_OPAQUE, XR_ENVIRONMENT_BLEND_MODE_OPAQUE,
}; };
DCHECK(HasInstance()); DCHECK(HasInstance());
XrResult xr_result;
uint32_t blend_mode_count; uint32_t blend_mode_count;
RETURN_IF_XR_FAILED(xrEnumerateEnvironmentBlendModes( RETURN_IF_XR_FAILED(xrEnumerateEnvironmentBlendModes(
...@@ -216,7 +213,7 @@ XrResult OpenXrApiWrapper::PickEnvironmentBlendMode(XrSystemId system) { ...@@ -216,7 +213,7 @@ XrResult OpenXrApiWrapper::PickEnvironmentBlendMode(XrSystemId system) {
} }
blend_mode_ = *blend_mode_it; blend_mode_ = *blend_mode_it;
return xr_result; return XR_SUCCESS;
} }
// Callers of this function must check the XrResult return value and destroy // Callers of this function must check the XrResult return value and destroy
...@@ -228,8 +225,6 @@ XrResult OpenXrApiWrapper::InitSession( ...@@ -228,8 +225,6 @@ XrResult OpenXrApiWrapper::InitSession(
DCHECK(d3d_device.Get()); DCHECK(d3d_device.Get());
DCHECK(IsInitialized()); DCHECK(IsInitialized());
XrResult xr_result;
RETURN_IF_XR_FAILED(CreateSession(d3d_device)); RETURN_IF_XR_FAILED(CreateSession(d3d_device));
RETURN_IF_XR_FAILED(CreateSwapchain()); RETURN_IF_XR_FAILED(CreateSwapchain());
RETURN_IF_XR_FAILED( RETURN_IF_XR_FAILED(
...@@ -256,7 +251,7 @@ XrResult OpenXrApiWrapper::InitSession( ...@@ -256,7 +251,7 @@ XrResult OpenXrApiWrapper::InitSession(
DCHECK(HasSpace(XR_REFERENCE_SPACE_TYPE_VIEW)); DCHECK(HasSpace(XR_REFERENCE_SPACE_TYPE_VIEW));
DCHECK(input_helper); DCHECK(input_helper);
return xr_result; return XR_SUCCESS;
} }
XrResult OpenXrApiWrapper::CreateSession( XrResult OpenXrApiWrapper::CreateSession(
...@@ -281,8 +276,6 @@ XrResult OpenXrApiWrapper::CreateSwapchain() { ...@@ -281,8 +276,6 @@ XrResult OpenXrApiWrapper::CreateSwapchain() {
DCHECK(HasSession()); DCHECK(HasSession());
DCHECK(!HasColorSwapChain()); DCHECK(!HasColorSwapChain());
XrResult xr_result;
gfx::Size view_size = GetViewSize(); gfx::Size view_size = GetViewSize();
XrSwapchainCreateInfo swapchain_create_info = {XR_TYPE_SWAPCHAIN_CREATE_INFO}; XrSwapchainCreateInfo swapchain_create_info = {XR_TYPE_SWAPCHAIN_CREATE_INFO};
...@@ -318,7 +311,7 @@ XrResult OpenXrApiWrapper::CreateSwapchain() { ...@@ -318,7 +311,7 @@ XrResult OpenXrApiWrapper::CreateSwapchain() {
color_swapchain_ = color_swapchain; color_swapchain_ = color_swapchain;
color_swapchain_images_ = std::move(color_swapchain_images); color_swapchain_images_ = std::move(color_swapchain_images);
return xr_result; return XR_SUCCESS;
} }
XrResult OpenXrApiWrapper::CreateSpace(XrReferenceSpaceType type, XrResult OpenXrApiWrapper::CreateSpace(XrReferenceSpaceType type,
...@@ -357,8 +350,6 @@ XrResult OpenXrApiWrapper::BeginFrame( ...@@ -357,8 +350,6 @@ XrResult OpenXrApiWrapper::BeginFrame(
DCHECK(HasSession()); DCHECK(HasSession());
DCHECK(HasColorSwapChain()); DCHECK(HasColorSwapChain());
XrResult xr_result;
RETURN_IF_XR_FAILED(ProcessEvents()); RETURN_IF_XR_FAILED(ProcessEvents());
XrFrameWaitInfo wait_frame_info = {XR_TYPE_FRAME_WAIT_INFO}; XrFrameWaitInfo wait_frame_info = {XR_TYPE_FRAME_WAIT_INFO};
...@@ -383,7 +374,7 @@ XrResult OpenXrApiWrapper::BeginFrame( ...@@ -383,7 +374,7 @@ XrResult OpenXrApiWrapper::BeginFrame(
*texture = color_swapchain_images_[color_swapchain_image_index].texture; *texture = color_swapchain_images_[color_swapchain_image_index].texture;
return xr_result; return XR_SUCCESS;
} }
XrResult OpenXrApiWrapper::EndFrame() { XrResult OpenXrApiWrapper::EndFrame() {
...@@ -393,8 +384,6 @@ XrResult OpenXrApiWrapper::EndFrame() { ...@@ -393,8 +384,6 @@ XrResult OpenXrApiWrapper::EndFrame() {
DCHECK(HasSpace(XR_REFERENCE_SPACE_TYPE_LOCAL)); DCHECK(HasSpace(XR_REFERENCE_SPACE_TYPE_LOCAL));
DCHECK(HasFrameState()); DCHECK(HasFrameState());
XrResult xr_result;
XrSwapchainImageReleaseInfo release_info = { XrSwapchainImageReleaseInfo release_info = {
XR_TYPE_SWAPCHAIN_IMAGE_RELEASE_INFO}; XR_TYPE_SWAPCHAIN_IMAGE_RELEASE_INFO};
RETURN_IF_XR_FAILED(xrReleaseSwapchainImage(color_swapchain_, &release_info)); RETURN_IF_XR_FAILED(xrReleaseSwapchainImage(color_swapchain_, &release_info));
...@@ -417,12 +406,10 @@ XrResult OpenXrApiWrapper::EndFrame() { ...@@ -417,12 +406,10 @@ XrResult OpenXrApiWrapper::EndFrame() {
RETURN_IF_XR_FAILED(xrEndFrame(session_, &end_frame_info)); RETURN_IF_XR_FAILED(xrEndFrame(session_, &end_frame_info));
return xr_result; return XR_SUCCESS;
} }
XrResult OpenXrApiWrapper::UpdateProjectionLayers() { XrResult OpenXrApiWrapper::UpdateProjectionLayers() {
XrResult xr_result;
RETURN_IF_XR_FAILED( RETURN_IF_XR_FAILED(
LocateViews(XR_REFERENCE_SPACE_TYPE_LOCAL, &origin_from_eye_views_)); LocateViews(XR_REFERENCE_SPACE_TYPE_LOCAL, &origin_from_eye_views_));
RETURN_IF_XR_FAILED( RETURN_IF_XR_FAILED(
...@@ -451,15 +438,13 @@ XrResult OpenXrApiWrapper::UpdateProjectionLayers() { ...@@ -451,15 +438,13 @@ XrResult OpenXrApiWrapper::UpdateProjectionLayers() {
layer_projection_view.subImage.imageRect.offset.y = 0; layer_projection_view.subImage.imageRect.offset.y = 0;
} }
return xr_result; return XR_SUCCESS;
} }
XrResult OpenXrApiWrapper::LocateViews(XrReferenceSpaceType type, XrResult OpenXrApiWrapper::LocateViews(XrReferenceSpaceType type,
std::vector<XrView>* views) const { std::vector<XrView>* views) const {
DCHECK(HasSession()); DCHECK(HasSession());
XrResult xr_result;
XrViewState view_state = {XR_TYPE_VIEW_STATE}; XrViewState view_state = {XR_TYPE_VIEW_STATE};
XrViewLocateInfo view_locate_info = {XR_TYPE_VIEW_LOCATE_INFO}; XrViewLocateInfo view_locate_info = {XR_TYPE_VIEW_LOCATE_INFO};
view_locate_info.viewConfigurationType = kSupportedViewConfiguration; view_locate_info.viewConfigurationType = kSupportedViewConfiguration;
...@@ -494,7 +479,7 @@ XrResult OpenXrApiWrapper::LocateViews(XrReferenceSpaceType type, ...@@ -494,7 +479,7 @@ XrResult OpenXrApiWrapper::LocateViews(XrReferenceSpaceType type,
*views = std::move(new_views); *views = std::move(new_views);
} }
return xr_result; return XR_SUCCESS;
} }
// Returns the next predicted display time in nanoseconds. // Returns the next predicted display time in nanoseconds.
...@@ -512,8 +497,6 @@ XrResult OpenXrApiWrapper::GetHeadPose( ...@@ -512,8 +497,6 @@ XrResult OpenXrApiWrapper::GetHeadPose(
DCHECK(HasSpace(XR_REFERENCE_SPACE_TYPE_LOCAL)); DCHECK(HasSpace(XR_REFERENCE_SPACE_TYPE_LOCAL));
DCHECK(HasSpace(XR_REFERENCE_SPACE_TYPE_VIEW)); DCHECK(HasSpace(XR_REFERENCE_SPACE_TYPE_VIEW));
XrResult xr_result;
XrSpaceLocation view_from_local = {XR_TYPE_SPACE_LOCATION}; XrSpaceLocation view_from_local = {XR_TYPE_SPACE_LOCATION};
RETURN_IF_XR_FAILED(xrLocateSpace(view_space_, local_space_, RETURN_IF_XR_FAILED(xrLocateSpace(view_space_, local_space_,
frame_state_.predictedDisplayTime, frame_state_.predictedDisplayTime,
...@@ -548,7 +531,7 @@ XrResult OpenXrApiWrapper::GetHeadPose( ...@@ -548,7 +531,7 @@ XrResult OpenXrApiWrapper::GetHeadPose(
*emulated_position = false; *emulated_position = false;
} }
return xr_result; return XR_SUCCESS;
} }
void OpenXrApiWrapper::GetHeadFromEyes(XrView* left, XrView* right) const { void OpenXrApiWrapper::GetHeadFromEyes(XrView* left, XrView* right) const {
...@@ -561,8 +544,6 @@ void OpenXrApiWrapper::GetHeadFromEyes(XrView* left, XrView* right) const { ...@@ -561,8 +544,6 @@ void OpenXrApiWrapper::GetHeadFromEyes(XrView* left, XrView* right) const {
XrResult OpenXrApiWrapper::GetLuid(LUID* luid) const { XrResult OpenXrApiWrapper::GetLuid(LUID* luid) const {
DCHECK(IsInitialized()); DCHECK(IsInitialized());
XrResult xr_result;
XrGraphicsRequirementsD3D11KHR graphics_requirements = { XrGraphicsRequirementsD3D11KHR graphics_requirements = {
XR_TYPE_GRAPHICS_REQUIREMENTS_D3D11_KHR}; XR_TYPE_GRAPHICS_REQUIREMENTS_D3D11_KHR};
RETURN_IF_XR_FAILED(xrGetD3D11GraphicsRequirementsKHR( RETURN_IF_XR_FAILED(xrGetD3D11GraphicsRequirementsKHR(
...@@ -571,7 +552,7 @@ XrResult OpenXrApiWrapper::GetLuid(LUID* luid) const { ...@@ -571,7 +552,7 @@ XrResult OpenXrApiWrapper::GetLuid(LUID* luid) const {
luid->LowPart = graphics_requirements.adapterLuid.LowPart; luid->LowPart = graphics_requirements.adapterLuid.LowPart;
luid->HighPart = graphics_requirements.adapterLuid.HighPart; luid->HighPart = graphics_requirements.adapterLuid.HighPart;
return xr_result; return XR_SUCCESS;
} }
XrResult OpenXrApiWrapper::ProcessEvents() { XrResult OpenXrApiWrapper::ProcessEvents() {
...@@ -668,8 +649,7 @@ uint32_t OpenXrApiWrapper::GetRecommendedSwapchainSampleCount() const { ...@@ -668,8 +649,7 @@ uint32_t OpenXrApiWrapper::GetRecommendedSwapchainSampleCount() const {
// XrEventDataReferenceSpaceChangePending // XrEventDataReferenceSpaceChangePending
XrResult OpenXrApiWrapper::UpdateStageBounds() { XrResult OpenXrApiWrapper::UpdateStageBounds() {
DCHECK(HasSession()); DCHECK(HasSession());
XrResult xr_result; XrResult xr_result = xrGetReferenceSpaceBoundsRect(
xr_result = xrGetReferenceSpaceBoundsRect(
session_, XR_REFERENCE_SPACE_TYPE_STAGE, &stage_bounds_); session_, XR_REFERENCE_SPACE_TYPE_STAGE, &stage_bounds_);
if (XR_FAILED(xr_result)) { if (XR_FAILED(xr_result)) {
stage_bounds_.height = 0; stage_bounds_.height = 0;
......
...@@ -85,8 +85,6 @@ XrResult OpenXrController::Initialize( ...@@ -85,8 +85,6 @@ XrResult OpenXrController::Initialize(
action_set_name.c_str()); action_set_name.c_str());
DCHECK(!error); DCHECK(!error);
XrResult xr_result;
RETURN_IF_XR_FAILED( RETURN_IF_XR_FAILED(
xrCreateActionSet(instance_, &action_set_create_info, &action_set_)); xrCreateActionSet(instance_, &action_set_create_info, &action_set_));
...@@ -95,14 +93,12 @@ XrResult OpenXrController::Initialize( ...@@ -95,14 +93,12 @@ XrResult OpenXrController::Initialize(
RETURN_IF_XR_FAILED(InitializeMicrosoftMotionControllerSpaces()); RETURN_IF_XR_FAILED(InitializeMicrosoftMotionControllerSpaces());
return xr_result; return XR_SUCCESS;
} }
XrResult OpenXrController::InitializeMicrosoftMotionControllerActions( XrResult OpenXrController::InitializeMicrosoftMotionControllerActions(
const std::string& type_string, const std::string& type_string,
std::map<XrPath, std::vector<XrActionSuggestedBinding>>* bindings) { std::map<XrPath, std::vector<XrActionSuggestedBinding>>* bindings) {
XrResult xr_result;
const std::string binding_prefix = top_level_user_path_string_ + "/input/"; const std::string binding_prefix = top_level_user_path_string_ + "/input/";
const std::string name_prefix = type_string + "_controller_"; const std::string name_prefix = type_string + "_controller_";
...@@ -170,18 +166,16 @@ XrResult OpenXrController::InitializeMicrosoftMotionControllerActions( ...@@ -170,18 +166,16 @@ XrResult OpenXrController::InitializeMicrosoftMotionControllerActions(
binding_prefix + "aim", name_prefix + "aim_pose", &pointer_pose_action_, binding_prefix + "aim", name_prefix + "aim_pose", &pointer_pose_action_,
bindings)); bindings));
return xr_result; return XR_SUCCESS;
} }
XrResult OpenXrController::InitializeMicrosoftMotionControllerSpaces() { XrResult OpenXrController::InitializeMicrosoftMotionControllerSpaces() {
XrResult xr_result;
RETURN_IF_XR_FAILED(CreateActionSpace(grip_pose_action_, &grip_pose_space_)); RETURN_IF_XR_FAILED(CreateActionSpace(grip_pose_action_, &grip_pose_space_));
RETURN_IF_XR_FAILED( RETURN_IF_XR_FAILED(
CreateActionSpace(pointer_pose_action_, &pointer_pose_space_)); CreateActionSpace(pointer_pose_action_, &pointer_pose_space_));
return xr_result; return XR_SUCCESS;
} }
uint32_t OpenXrController::GetId() const { uint32_t OpenXrController::GetId() const {
...@@ -275,8 +269,6 @@ std::vector<double> OpenXrController::GetAxis(OpenXrAxisType type) const { ...@@ -275,8 +269,6 @@ std::vector<double> OpenXrController::GetAxis(OpenXrAxisType type) const {
} }
XrResult OpenXrController::UpdateInteractionProfile() { XrResult OpenXrController::UpdateInteractionProfile() {
XrResult xr_result;
XrPath top_level_user_path; XrPath top_level_user_path;
RETURN_IF_XR_FAILED(xrStringToPath( RETURN_IF_XR_FAILED(xrStringToPath(
instance_, top_level_user_path_string_.c_str(), &top_level_user_path)); instance_, top_level_user_path_string_.c_str(), &top_level_user_path));
...@@ -297,7 +289,7 @@ XrResult OpenXrController::UpdateInteractionProfile() { ...@@ -297,7 +289,7 @@ XrResult OpenXrController::UpdateInteractionProfile() {
output_size, &output_size, out_string)); output_size, &output_size, out_string));
interaction_profile_ = out_string; interaction_profile_ = out_string;
return xr_result; return XR_SUCCESS;
} }
base::Optional<gfx::Transform> OpenXrController::GetMojoFromGripTransform( base::Optional<gfx::Transform> OpenXrController::GetMojoFromGripTransform(
...@@ -371,8 +363,6 @@ XrResult OpenXrController::CreateAction( ...@@ -371,8 +363,6 @@ XrResult OpenXrController::CreateAction(
const std::string& action_name, const std::string& action_name,
XrAction* action, XrAction* action,
std::map<XrPath, std::vector<XrActionSuggestedBinding>>* bindings) { std::map<XrPath, std::vector<XrActionSuggestedBinding>>* bindings) {
XrResult xr_result;
XrActionCreateInfo action_create_info = {XR_TYPE_ACTION_CREATE_INFO}; XrActionCreateInfo action_create_info = {XR_TYPE_ACTION_CREATE_INFO};
action_create_info.actionType = type; action_create_info.actionType = type;
...@@ -394,7 +384,7 @@ XrResult OpenXrController::CreateAction( ...@@ -394,7 +384,7 @@ XrResult OpenXrController::CreateAction(
xrStringToPath(instance_, binding_string.c_str(), &action_path)); xrStringToPath(instance_, binding_string.c_str(), &action_path));
(*bindings)[profile_path].push_back({*action, action_path}); (*bindings)[profile_path].push_back({*action, action_path});
return xr_result; return XR_SUCCESS;
} }
XrResult OpenXrController::CreateActionSpace(XrAction action, XrSpace* space) { XrResult OpenXrController::CreateActionSpace(XrAction action, XrSpace* space) {
......
...@@ -43,8 +43,6 @@ XrResult OpenXRInputHelper::CreateOpenXRInputHelper( ...@@ -43,8 +43,6 @@ XrResult OpenXRInputHelper::CreateOpenXRInputHelper(
XrSession session, XrSession session,
XrSpace local_space, XrSpace local_space,
std::unique_ptr<OpenXRInputHelper>* helper) { std::unique_ptr<OpenXRInputHelper>* helper) {
XrResult xr_result;
std::unique_ptr<OpenXRInputHelper> new_helper = std::unique_ptr<OpenXRInputHelper> new_helper =
std::make_unique<OpenXRInputHelper>(session, local_space); std::make_unique<OpenXRInputHelper>(session, local_space);
...@@ -83,7 +81,7 @@ XrResult OpenXRInputHelper::CreateOpenXRInputHelper( ...@@ -83,7 +81,7 @@ XrResult OpenXRInputHelper::CreateOpenXRInputHelper(
RETURN_IF_XR_FAILED(xrAttachSessionActionSets(session, &attach_info)); RETURN_IF_XR_FAILED(xrAttachSessionActionSets(session, &attach_info));
*helper = std::move(new_helper); *helper = std::move(new_helper);
return xr_result; return XR_SUCCESS;
} }
OpenXRInputHelper::OpenXRInputHelper(XrSession session, XrSpace local_space) OpenXRInputHelper::OpenXRInputHelper(XrSession session, XrSpace local_space)
......
...@@ -13,13 +13,14 @@ namespace device { ...@@ -13,13 +13,14 @@ namespace device {
// all OpenXR helper macros here so they can be kept track of. This file // all OpenXR helper macros here so they can be kept track of. This file
// should not be included outside of device/vr/openxr. // should not be included outside of device/vr/openxr.
// The caller must have a variable of type XrResult named xr_result defined in #define RETURN_IF_XR_FAILED(xrcode) \
// their scope. This macro sets xr_result to |xrcode|. do { \
#define RETURN_IF_XR_FAILED(xrcode) \ XrResult return_if_xr_failed_xr_result = (xrcode); \
do { \ if (XR_FAILED(return_if_xr_failed_xr_result)) { \
xr_result = (xrcode); \ DLOG(ERROR) << __func__ \
if (XR_FAILED(xr_result)) \ << " Failed with: " << return_if_xr_failed_xr_result; \
return xr_result; \ return return_if_xr_failed_xr_result; \
} \
} while (false) } while (false)
#define RETURN_IF_FALSE(condition, error_code, msg) \ #define RETURN_IF_FALSE(condition, error_code, msg) \
......
...@@ -25,8 +25,6 @@ XrResult xrAcquireSwapchainImage( ...@@ -25,8 +25,6 @@ XrResult xrAcquireSwapchainImage(
const XrSwapchainImageAcquireInfo* acquire_info, const XrSwapchainImageAcquireInfo* acquire_info,
uint32_t* index) { uint32_t* index) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSwapchain(swapchain)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSwapchain(swapchain));
RETURN_IF(acquire_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(acquire_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrSwapchainImageAcquireInfo is nullptr"); "XrSwapchainImageAcquireInfo is nullptr");
...@@ -47,8 +45,6 @@ XrResult xrAttachSessionActionSets( ...@@ -47,8 +45,6 @@ XrResult xrAttachSessionActionSets(
XrSession session, XrSession session,
const XrSessionActionSetsAttachInfo* attach_info) { const XrSessionActionSetsAttachInfo* attach_info) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session));
RETURN_IF(attach_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(attach_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrSessionActionSetsAttachInfo is nullptr"); "XrSessionActionSetsAttachInfo is nullptr");
...@@ -60,8 +56,6 @@ XrResult xrAttachSessionActionSets( ...@@ -60,8 +56,6 @@ XrResult xrAttachSessionActionSets(
XrResult xrBeginFrame(XrSession session, XrResult xrBeginFrame(XrSession session,
const XrFrameBeginInfo* frame_begin_info) { const XrFrameBeginInfo* frame_begin_info) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session));
RETURN_IF(frame_begin_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(frame_begin_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrFrameBeginInfo is nullptr"); "XrFrameBeginInfo is nullptr");
...@@ -75,8 +69,6 @@ XrResult xrBeginFrame(XrSession session, ...@@ -75,8 +69,6 @@ XrResult xrBeginFrame(XrSession session,
XrResult xrBeginSession(XrSession session, XrResult xrBeginSession(XrSession session,
const XrSessionBeginInfo* begin_info) { const XrSessionBeginInfo* begin_info) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session));
RETURN_IF(begin_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(begin_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrSessionBeginInfo is nullptr"); "XrSessionBeginInfo is nullptr");
...@@ -98,8 +90,6 @@ XrResult xrCreateAction(XrActionSet action_set, ...@@ -98,8 +90,6 @@ XrResult xrCreateAction(XrActionSet action_set,
const XrActionCreateInfo* create_info, const XrActionCreateInfo* create_info,
XrAction* action) { XrAction* action) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF(create_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(create_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrActionCreateInfo is nullptr"); "XrActionCreateInfo is nullptr");
RETURN_IF_XR_FAILED( RETURN_IF_XR_FAILED(
...@@ -112,8 +102,6 @@ XrResult xrCreateActionSet(XrInstance instance, ...@@ -112,8 +102,6 @@ XrResult xrCreateActionSet(XrInstance instance,
const XrActionSetCreateInfo* create_info, const XrActionSetCreateInfo* create_info,
XrActionSet* action_set) { XrActionSet* action_set) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance)); RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance));
RETURN_IF(create_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(create_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrActionSetCreateInfo is nullptr"); "XrActionSetCreateInfo is nullptr");
...@@ -129,8 +117,6 @@ XrResult xrCreateActionSpace(XrSession session, ...@@ -129,8 +117,6 @@ XrResult xrCreateActionSpace(XrSession session,
const XrActionSpaceCreateInfo* create_info, const XrActionSpaceCreateInfo* create_info,
XrSpace* space) { XrSpace* space) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session));
RETURN_IF(create_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(create_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrActionSpaceCreateInfo is nullptr"); "XrActionSpaceCreateInfo is nullptr");
...@@ -194,8 +180,6 @@ XrResult xrCreateReferenceSpace(XrSession session, ...@@ -194,8 +180,6 @@ XrResult xrCreateReferenceSpace(XrSession session,
const XrReferenceSpaceCreateInfo* create_info, const XrReferenceSpaceCreateInfo* create_info,
XrSpace* space) { XrSpace* space) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session));
RETURN_IF(create_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(create_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrReferenceSpaceCreateInfo is nullptr"); "XrReferenceSpaceCreateInfo is nullptr");
...@@ -223,8 +207,6 @@ XrResult xrCreateSession(XrInstance instance, ...@@ -223,8 +207,6 @@ XrResult xrCreateSession(XrInstance instance,
const XrSessionCreateInfo* create_info, const XrSessionCreateInfo* create_info,
XrSession* session) { XrSession* session) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance)); RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance));
RETURN_IF(create_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(create_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrSessionCreateInfo is nullptr"); "XrSessionCreateInfo is nullptr");
...@@ -256,8 +238,6 @@ XrResult xrCreateSwapchain(XrSession session, ...@@ -256,8 +238,6 @@ XrResult xrCreateSwapchain(XrSession session,
const XrSwapchainCreateInfo* create_info, const XrSwapchainCreateInfo* create_info,
XrSwapchain* swapchain) { XrSwapchain* swapchain) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session));
RETURN_IF(create_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(create_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrSwapchainCreateInfo is nullptr"); "XrSwapchainCreateInfo is nullptr");
...@@ -299,16 +279,12 @@ XrResult xrCreateSwapchain(XrSession session, ...@@ -299,16 +279,12 @@ XrResult xrCreateSwapchain(XrSession session,
XrResult xrDestroyActionSet(XrActionSet action_set) { XrResult xrDestroyActionSet(XrActionSet action_set) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateActionSet(action_set)); RETURN_IF_XR_FAILED(g_test_helper.ValidateActionSet(action_set));
return XR_SUCCESS; return XR_SUCCESS;
} }
XrResult xrDestroyInstance(XrInstance instance) { XrResult xrDestroyInstance(XrInstance instance) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance)); RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance));
g_test_helper.Reset(); g_test_helper.Reset();
return XR_SUCCESS; return XR_SUCCESS;
...@@ -316,8 +292,6 @@ XrResult xrDestroyInstance(XrInstance instance) { ...@@ -316,8 +292,6 @@ XrResult xrDestroyInstance(XrInstance instance) {
XrResult xrDestroySpace(XrSpace space) { XrResult xrDestroySpace(XrSpace space) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSpace(space)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSpace(space));
return XR_SUCCESS; return XR_SUCCESS;
...@@ -325,8 +299,6 @@ XrResult xrDestroySpace(XrSpace space) { ...@@ -325,8 +299,6 @@ XrResult xrDestroySpace(XrSpace space) {
XrResult xrEndFrame(XrSession session, const XrFrameEndInfo* frame_end_info) { XrResult xrEndFrame(XrSession session, const XrFrameEndInfo* frame_end_info) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session));
RETURN_IF(frame_end_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(frame_end_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrFrameEndInfo is nullptr"); "XrFrameEndInfo is nullptr");
...@@ -360,8 +332,6 @@ XrResult xrEndFrame(XrSession session, const XrFrameEndInfo* frame_end_info) { ...@@ -360,8 +332,6 @@ XrResult xrEndFrame(XrSession session, const XrFrameEndInfo* frame_end_info) {
XrResult xrEndSession(XrSession session) { XrResult xrEndSession(XrSession session) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session));
RETURN_IF_XR_FAILED(g_test_helper.EndSession()); RETURN_IF_XR_FAILED(g_test_helper.EndSession());
...@@ -376,8 +346,6 @@ XrResult xrEnumerateEnvironmentBlendModes( ...@@ -376,8 +346,6 @@ XrResult xrEnumerateEnvironmentBlendModes(
uint32_t* environment_blend_mode_count_output, uint32_t* environment_blend_mode_count_output,
XrEnvironmentBlendMode* environment_blend_modes) { XrEnvironmentBlendMode* environment_blend_modes) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance)); RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance));
RETURN_IF_XR_FAILED(g_test_helper.ValidateSystemId(system_id)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSystemId(system_id));
RETURN_IF(view_configuration_type != OpenXrTestHelper::kViewConfigurationType, RETURN_IF(view_configuration_type != OpenXrTestHelper::kViewConfigurationType,
...@@ -450,8 +418,6 @@ XrResult xrEnumerateViewConfigurationViews( ...@@ -450,8 +418,6 @@ XrResult xrEnumerateViewConfigurationViews(
uint32_t* view_count_output, uint32_t* view_count_output,
XrViewConfigurationView* views) { XrViewConfigurationView* views) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance)); RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance));
RETURN_IF_XR_FAILED(g_test_helper.ValidateSystemId(system_id)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSystemId(system_id));
RETURN_IF(view_configuration_type != OpenXrTestHelper::kViewConfigurationType, RETURN_IF(view_configuration_type != OpenXrTestHelper::kViewConfigurationType,
...@@ -480,8 +446,6 @@ XrResult xrEnumerateSwapchainImages(XrSwapchain swapchain, ...@@ -480,8 +446,6 @@ XrResult xrEnumerateSwapchainImages(XrSwapchain swapchain,
uint32_t* image_count_output, uint32_t* image_count_output,
XrSwapchainImageBaseHeader* images) { XrSwapchainImageBaseHeader* images) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSwapchain(swapchain)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSwapchain(swapchain));
RETURN_IF(image_capacity_input != OpenXrTestHelper::kMinSwapchainBuffering && RETURN_IF(image_capacity_input != OpenXrTestHelper::kMinSwapchainBuffering &&
image_capacity_input != 0, image_capacity_input != 0,
...@@ -526,8 +490,6 @@ XrResult xrGetD3D11GraphicsRequirementsKHR( ...@@ -526,8 +490,6 @@ XrResult xrGetD3D11GraphicsRequirementsKHR(
XrSystemId system_id, XrSystemId system_id,
XrGraphicsRequirementsD3D11KHR* graphics_requirements) { XrGraphicsRequirementsD3D11KHR* graphics_requirements) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance)); RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance));
RETURN_IF_XR_FAILED(g_test_helper.ValidateSystemId(system_id)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSystemId(system_id));
RETURN_IF(graphics_requirements == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(graphics_requirements == nullptr, XR_ERROR_VALIDATION_FAILURE,
...@@ -562,7 +524,6 @@ XrResult xrGetActionStateFloat(XrSession session, ...@@ -562,7 +524,6 @@ XrResult xrGetActionStateFloat(XrSession session,
const XrActionStateGetInfo* get_info, const XrActionStateGetInfo* get_info,
XrActionStateFloat* state) { XrActionStateFloat* state) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session));
RETURN_IF(get_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(get_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrActionStateGetInfo is nullptr"); "XrActionStateGetInfo is nullptr");
...@@ -586,8 +547,6 @@ XrResult xrGetActionStateBoolean(XrSession session, ...@@ -586,8 +547,6 @@ XrResult xrGetActionStateBoolean(XrSession session,
const XrActionStateGetInfo* get_info, const XrActionStateGetInfo* get_info,
XrActionStateBoolean* state) { XrActionStateBoolean* state) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session));
RETURN_IF(get_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(get_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrActionStateGetInfo is nullptr"); "XrActionStateGetInfo is nullptr");
...@@ -611,8 +570,6 @@ XrResult xrGetActionStateVector2f(XrSession session, ...@@ -611,8 +570,6 @@ XrResult xrGetActionStateVector2f(XrSession session,
const XrActionStateGetInfo* get_info, const XrActionStateGetInfo* get_info,
XrActionStateVector2f* state) { XrActionStateVector2f* state) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session));
RETURN_IF(get_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(get_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrActionStateGetInfo is nullptr"); "XrActionStateGetInfo is nullptr");
...@@ -636,8 +593,6 @@ XrResult xrGetActionStatePose(XrSession session, ...@@ -636,8 +593,6 @@ XrResult xrGetActionStatePose(XrSession session,
const XrActionStateGetInfo* get_info, const XrActionStateGetInfo* get_info,
XrActionStatePose* state) { XrActionStatePose* state) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session));
RETURN_IF(get_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(get_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrActionStateGetInfo is nullptr"); "XrActionStateGetInfo is nullptr");
...@@ -662,8 +617,6 @@ XrResult xrGetCurrentInteractionProfile( ...@@ -662,8 +617,6 @@ XrResult xrGetCurrentInteractionProfile(
XrPath top_level_user_path, XrPath top_level_user_path,
XrInteractionProfileState* interaction_profile) { XrInteractionProfileState* interaction_profile) {
DVLOG(1) << __FUNCTION__; DVLOG(1) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session));
RETURN_IF( RETURN_IF(
g_test_helper.AttachedActionSetsSize() == 0, g_test_helper.AttachedActionSetsSize() == 0,
...@@ -689,8 +642,6 @@ XrResult xrGetReferenceSpaceBoundsRect( ...@@ -689,8 +642,6 @@ XrResult xrGetReferenceSpaceBoundsRect(
XrReferenceSpaceType refernece_space_type, XrReferenceSpaceType refernece_space_type,
XrExtent2Df* bounds) { XrExtent2Df* bounds) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session));
RETURN_IF(refernece_space_type != XR_REFERENCE_SPACE_TYPE_STAGE, RETURN_IF(refernece_space_type != XR_REFERENCE_SPACE_TYPE_STAGE,
XR_ERROR_REFERENCE_SPACE_UNSUPPORTED, XR_ERROR_REFERENCE_SPACE_UNSUPPORTED,
...@@ -706,8 +657,6 @@ XrResult xrGetSystem(XrInstance instance, ...@@ -706,8 +657,6 @@ XrResult xrGetSystem(XrInstance instance,
const XrSystemGetInfo* get_info, const XrSystemGetInfo* get_info,
XrSystemId* system_id) { XrSystemId* system_id) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance)); RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance));
RETURN_IF(get_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(get_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrSystemGetInfo is nullptr"); "XrSystemGetInfo is nullptr");
...@@ -730,8 +679,6 @@ XrResult xrLocateSpace(XrSpace space, ...@@ -730,8 +679,6 @@ XrResult xrLocateSpace(XrSpace space,
XrTime time, XrTime time,
XrSpaceLocation* location) { XrSpaceLocation* location) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSpace(space)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSpace(space));
RETURN_IF_XR_FAILED(g_test_helper.ValidateSpace(base_space)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSpace(base_space));
RETURN_IF_XR_FAILED(g_test_helper.ValidatePredictedDisplayTime(time)); RETURN_IF_XR_FAILED(g_test_helper.ValidatePredictedDisplayTime(time));
...@@ -755,8 +702,6 @@ XrResult xrLocateViews(XrSession session, ...@@ -755,8 +702,6 @@ XrResult xrLocateViews(XrSession session,
uint32_t* view_count_output, uint32_t* view_count_output,
XrView* views) { XrView* views) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session));
RETURN_IF(view_locate_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(view_locate_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrViewLocateInfo is nullptr"); "XrViewLocateInfo is nullptr");
...@@ -796,8 +741,6 @@ XrResult xrLocateViews(XrSession session, ...@@ -796,8 +741,6 @@ XrResult xrLocateViews(XrSession session,
XrResult xrPollEvent(XrInstance instance, XrEventDataBuffer* event_data) { XrResult xrPollEvent(XrInstance instance, XrEventDataBuffer* event_data) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance)); RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance));
return g_test_helper.PollEvent(event_data); return g_test_helper.PollEvent(event_data);
...@@ -807,8 +750,6 @@ XrResult xrReleaseSwapchainImage( ...@@ -807,8 +750,6 @@ XrResult xrReleaseSwapchainImage(
XrSwapchain swapchain, XrSwapchain swapchain,
const XrSwapchainImageReleaseInfo* release_info) { const XrSwapchainImageReleaseInfo* release_info) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSwapchain(swapchain)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSwapchain(swapchain));
RETURN_IF(release_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(release_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrSwapchainImageReleaseInfo is nullptr"); "XrSwapchainImageReleaseInfo is nullptr");
...@@ -825,8 +766,6 @@ XrResult xrSuggestInteractionProfileBindings( ...@@ -825,8 +766,6 @@ XrResult xrSuggestInteractionProfileBindings(
XrInstance instance, XrInstance instance,
const XrInteractionProfileSuggestedBinding* suggested_bindings) { const XrInteractionProfileSuggestedBinding* suggested_bindings) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance)); RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance));
RETURN_IF(suggested_bindings == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(suggested_bindings == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrInteractionProfileSuggestedBinding is nullptr"); "XrInteractionProfileSuggestedBinding is nullptr");
...@@ -866,8 +805,6 @@ XrResult xrStringToPath(XrInstance instance, ...@@ -866,8 +805,6 @@ XrResult xrStringToPath(XrInstance instance,
const char* path_string, const char* path_string,
XrPath* path) { XrPath* path) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance)); RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance));
RETURN_IF(path == nullptr, XR_ERROR_VALIDATION_FAILURE, "path is nullptr"); RETURN_IF(path == nullptr, XR_ERROR_VALIDATION_FAILURE, "path is nullptr");
*path = g_test_helper.GetPath(path_string); *path = g_test_helper.GetPath(path_string);
...@@ -881,8 +818,6 @@ XrResult xrPathToString(XrInstance instance, ...@@ -881,8 +818,6 @@ XrResult xrPathToString(XrInstance instance,
uint32_t* buffer_count_output, uint32_t* buffer_count_output,
char* buffer) { char* buffer) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance)); RETURN_IF_XR_FAILED(g_test_helper.ValidateInstance(instance));
RETURN_IF_XR_FAILED(g_test_helper.ValidatePath(path)); RETURN_IF_XR_FAILED(g_test_helper.ValidatePath(path));
...@@ -906,8 +841,6 @@ XrResult xrPathToString(XrInstance instance, ...@@ -906,8 +841,6 @@ XrResult xrPathToString(XrInstance instance,
XrResult xrSyncActions(XrSession session, const XrActionsSyncInfo* sync_info) { XrResult xrSyncActions(XrSession session, const XrActionsSyncInfo* sync_info) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session));
RETURN_IF_FALSE(g_test_helper.UpdateData(), XR_ERROR_VALIDATION_FAILURE, RETURN_IF_FALSE(g_test_helper.UpdateData(), XR_ERROR_VALIDATION_FAILURE,
"xrSyncActionData can't receive data from test"); "xrSyncActionData can't receive data from test");
...@@ -936,8 +869,6 @@ XrResult xrWaitFrame(XrSession session, ...@@ -936,8 +869,6 @@ XrResult xrWaitFrame(XrSession session,
const XrFrameWaitInfo* frame_wait_info, const XrFrameWaitInfo* frame_wait_info,
XrFrameState* frame_state) { XrFrameState* frame_state) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSession(session));
RETURN_IF(frame_wait_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(frame_wait_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrFrameWaitInfo is nullptr"); "XrFrameWaitInfo is nullptr");
...@@ -958,8 +889,6 @@ XrResult xrWaitFrame(XrSession session, ...@@ -958,8 +889,6 @@ XrResult xrWaitFrame(XrSession session,
XrResult xrWaitSwapchainImage(XrSwapchain swapchain, XrResult xrWaitSwapchainImage(XrSwapchain swapchain,
const XrSwapchainImageWaitInfo* wait_info) { const XrSwapchainImageWaitInfo* wait_info) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
XrResult xr_result;
RETURN_IF_XR_FAILED(g_test_helper.ValidateSwapchain(swapchain)); RETURN_IF_XR_FAILED(g_test_helper.ValidateSwapchain(swapchain));
RETURN_IF(wait_info == nullptr, XR_ERROR_VALIDATION_FAILURE, RETURN_IF(wait_info == nullptr, XR_ERROR_VALIDATION_FAILURE,
"XrSwapchainImageWaitInfo is nullptr"); "XrSwapchainImageWaitInfo is nullptr");
......
...@@ -187,7 +187,6 @@ XrInstance OpenXrTestHelper::CreateInstance() { ...@@ -187,7 +187,6 @@ XrInstance OpenXrTestHelper::CreateInstance() {
XrResult OpenXrTestHelper::GetActionStateFloat(XrAction action, XrResult OpenXrTestHelper::GetActionStateFloat(XrAction action,
XrActionStateFloat* data) const { XrActionStateFloat* data) const {
XrResult xr_result;
RETURN_IF_XR_FAILED(ValidateAction(action)); RETURN_IF_XR_FAILED(ValidateAction(action));
const ActionProperties& cur_action_properties = actions_.at(action); const ActionProperties& cur_action_properties = actions_.at(action);
...@@ -202,7 +201,6 @@ XrResult OpenXrTestHelper::GetActionStateFloat(XrAction action, ...@@ -202,7 +201,6 @@ XrResult OpenXrTestHelper::GetActionStateFloat(XrAction action,
XrResult OpenXrTestHelper::GetActionStateBoolean( XrResult OpenXrTestHelper::GetActionStateBoolean(
XrAction action, XrAction action,
XrActionStateBoolean* data) const { XrActionStateBoolean* data) const {
XrResult xr_result;
RETURN_IF_XR_FAILED(ValidateAction(action)); RETURN_IF_XR_FAILED(ValidateAction(action));
const ActionProperties& cur_action_properties = actions_.at(action); const ActionProperties& cur_action_properties = actions_.at(action);
...@@ -218,7 +216,6 @@ XrResult OpenXrTestHelper::GetActionStateBoolean( ...@@ -218,7 +216,6 @@ XrResult OpenXrTestHelper::GetActionStateBoolean(
XrResult OpenXrTestHelper::GetActionStateVector2f( XrResult OpenXrTestHelper::GetActionStateVector2f(
XrAction action, XrAction action,
XrActionStateVector2f* data) const { XrActionStateVector2f* data) const {
XrResult xr_result;
RETURN_IF_XR_FAILED(ValidateAction(action)); RETURN_IF_XR_FAILED(ValidateAction(action));
const ActionProperties& cur_action_properties = actions_.at(action); const ActionProperties& cur_action_properties = actions_.at(action);
...@@ -233,7 +230,6 @@ XrResult OpenXrTestHelper::GetActionStateVector2f( ...@@ -233,7 +230,6 @@ XrResult OpenXrTestHelper::GetActionStateVector2f(
XrResult OpenXrTestHelper::GetActionStatePose(XrAction action, XrResult OpenXrTestHelper::GetActionStatePose(XrAction action,
XrActionStatePose* data) const { XrActionStatePose* data) const {
XrResult xr_result;
RETURN_IF_XR_FAILED(ValidateAction(action)); RETURN_IF_XR_FAILED(ValidateAction(action));
const ActionProperties& cur_action_properties = actions_.at(action); const ActionProperties& cur_action_properties = actions_.at(action);
...@@ -267,8 +263,6 @@ XrSpace OpenXrTestHelper::CreateReferenceSpace(XrReferenceSpaceType type) { ...@@ -267,8 +263,6 @@ XrSpace OpenXrTestHelper::CreateReferenceSpace(XrReferenceSpaceType type) {
XrResult OpenXrTestHelper::CreateAction(XrActionSet action_set, XrResult OpenXrTestHelper::CreateAction(XrActionSet action_set,
const XrActionCreateInfo& create_info, const XrActionCreateInfo& create_info,
XrAction* action) { XrAction* action) {
XrResult xr_result;
RETURN_IF_XR_FAILED(ValidateActionSet(action_set)); RETURN_IF_XR_FAILED(ValidateActionSet(action_set));
RETURN_IF_XR_FAILED(ValidateActionSetNotAttached(action_set)); RETURN_IF_XR_FAILED(ValidateActionSetNotAttached(action_set));
RETURN_IF_XR_FAILED(ValidateActionCreateInfo(create_info)); RETURN_IF_XR_FAILED(ValidateActionCreateInfo(create_info));
...@@ -324,7 +318,6 @@ XrActionSet OpenXrTestHelper::CreateActionSet( ...@@ -324,7 +318,6 @@ XrActionSet OpenXrTestHelper::CreateActionSet(
XrResult OpenXrTestHelper::CreateActionSpace( XrResult OpenXrTestHelper::CreateActionSpace(
const XrActionSpaceCreateInfo& action_space_create_info, const XrActionSpaceCreateInfo& action_space_create_info,
XrSpace* space) { XrSpace* space) {
XrResult xr_result;
RETURN_IF_XR_FAILED(ValidateActionSpaceCreateInfo(action_space_create_info)); RETURN_IF_XR_FAILED(ValidateActionSpaceCreateInfo(action_space_create_info));
*space = TreatIntegerAsHandle<XrSpace>(++next_space_); *space = TreatIntegerAsHandle<XrSpace>(++next_space_);
action_spaces_[*space] = action_space_create_info.action; action_spaces_[*space] = action_space_create_info.action;
...@@ -428,8 +421,6 @@ void OpenXrTestHelper::SetD3DDevice(ID3D11Device* d3d_device) { ...@@ -428,8 +421,6 @@ void OpenXrTestHelper::SetD3DDevice(ID3D11Device* d3d_device) {
XrResult OpenXrTestHelper::AttachActionSets( XrResult OpenXrTestHelper::AttachActionSets(
const XrSessionActionSetsAttachInfo& attach_info) { const XrSessionActionSetsAttachInfo& attach_info) {
XrResult xr_result;
RETURN_IF(attach_info.type != XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO, RETURN_IF(attach_info.type != XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO,
XR_ERROR_VALIDATION_FAILURE, XR_ERROR_VALIDATION_FAILURE,
"XrSessionActionSetsAttachInfo type invalid"); "XrSessionActionSetsAttachInfo type invalid");
...@@ -453,7 +444,6 @@ uint32_t OpenXrTestHelper::AttachedActionSetsSize() const { ...@@ -453,7 +444,6 @@ uint32_t OpenXrTestHelper::AttachedActionSetsSize() const {
} }
XrResult OpenXrTestHelper::SyncActionData(XrActionSet action_set) { XrResult OpenXrTestHelper::SyncActionData(XrActionSet action_set) {
XrResult xr_result;
RETURN_IF_XR_FAILED(ValidateActionSet(action_set)); RETURN_IF_XR_FAILED(ValidateActionSet(action_set));
RETURN_IF(ValidateActionSetNotAttached(action_set) != RETURN_IF(ValidateActionSetNotAttached(action_set) !=
...@@ -468,7 +458,6 @@ XrResult OpenXrTestHelper::SyncActionData(XrActionSet action_set) { ...@@ -468,7 +458,6 @@ XrResult OpenXrTestHelper::SyncActionData(XrActionSet action_set) {
} }
XrResult OpenXrTestHelper::UpdateAction(XrAction action) { XrResult OpenXrTestHelper::UpdateAction(XrAction action) {
XrResult xr_result;
RETURN_IF_XR_FAILED(ValidateAction(action)); RETURN_IF_XR_FAILED(ValidateAction(action));
const ActionProperties& cur_action_properties = actions_[action]; const ActionProperties& cur_action_properties = actions_[action];
std::string path_string = PathToString(cur_action_properties.binding); std::string path_string = PathToString(cur_action_properties.binding);
...@@ -814,7 +803,6 @@ XrResult OpenXrTestHelper::ValidateActionSetNotAttached( ...@@ -814,7 +803,6 @@ XrResult OpenXrTestHelper::ValidateActionSetNotAttached(
XrResult OpenXrTestHelper::ValidateActionSpaceCreateInfo( XrResult OpenXrTestHelper::ValidateActionSpaceCreateInfo(
const XrActionSpaceCreateInfo& create_info) const { const XrActionSpaceCreateInfo& create_info) const {
XrResult xr_result;
RETURN_IF(create_info.type != XR_TYPE_ACTION_SPACE_CREATE_INFO, RETURN_IF(create_info.type != XR_TYPE_ACTION_SPACE_CREATE_INFO,
XR_ERROR_VALIDATION_FAILURE, XR_ERROR_VALIDATION_FAILURE,
"ValidateActionSpaceCreateInfo type invalid"); "ValidateActionSpaceCreateInfo type invalid");
...@@ -895,8 +883,6 @@ XrResult OpenXrTestHelper::ValidatePredictedDisplayTime(XrTime time) const { ...@@ -895,8 +883,6 @@ XrResult OpenXrTestHelper::ValidatePredictedDisplayTime(XrTime time) const {
XrResult OpenXrTestHelper::ValidateXrCompositionLayerProjection( XrResult OpenXrTestHelper::ValidateXrCompositionLayerProjection(
const XrCompositionLayerProjection& projection_layer) const { const XrCompositionLayerProjection& projection_layer) const {
XrResult xr_result;
RETURN_IF(projection_layer.type != XR_TYPE_COMPOSITION_LAYER_PROJECTION, RETURN_IF(projection_layer.type != XR_TYPE_COMPOSITION_LAYER_PROJECTION,
XR_ERROR_LAYER_INVALID, XR_ERROR_LAYER_INVALID,
"XrCompositionLayerProjection type invalid"); "XrCompositionLayerProjection type invalid");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment