Commit b5a07976 authored by Kevin Qin's avatar Kevin Qin Committed by Commit Bot

Fix errors caused by incorrect XrCompositionLayerProjectionView type

Future OpenXR runtimes are more stringent on validating correct usage
of APIs. The structure type of XrCompositionLayerProjectionViewobjects passed into XrEndFrame
are not currently set. The current version of the WMR OpenXR runtime
from the Windows store does not do this validation, but future versions
will.

Bug: 1015223
Change-Id: I76c02cc5ad9443947f1a5480ebc4a4f5b1e29608
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1879864
Commit-Queue: Zheng Qin <zheqi@microsoft.com>
Reviewed-by: default avatarAlexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710045}
parent 6ac310e8
...@@ -436,7 +436,7 @@ XrResult OpenXrApiWrapper::UpdateProjectionLayers() { ...@@ -436,7 +436,7 @@ XrResult OpenXrApiWrapper::UpdateProjectionLayers() {
XrCompositionLayerProjectionView& layer_projection_view = XrCompositionLayerProjectionView& layer_projection_view =
layer_projection_views_[view_index]; layer_projection_views_[view_index];
layer_projection_view.type = XR_TYPE_COMPOSITION_LAYER_PROJECTION; layer_projection_view.type = XR_TYPE_COMPOSITION_LAYER_PROJECTION_VIEW;
layer_projection_view.pose = view.pose; layer_projection_view.pose = view.pose;
layer_projection_view.fov = view.fov; layer_projection_view.fov = view.fov;
layer_projection_view.subImage.swapchain = color_swapchain_; layer_projection_view.subImage.swapchain = color_swapchain_;
......
...@@ -279,6 +279,26 @@ XrResult xrEndFrame(XrSession session, const XrFrameEndInfo* frame_end_info) { ...@@ -279,6 +279,26 @@ XrResult xrEndFrame(XrSession session, const XrFrameEndInfo* frame_end_info) {
RETURN_IF_XR_FAILED( RETURN_IF_XR_FAILED(
g_test_helper.ValidatePredictedDisplayTime(frame_end_info->displayTime)); g_test_helper.ValidatePredictedDisplayTime(frame_end_info->displayTime));
for (uint32_t i = 0; i < frame_end_info->layerCount; i++) {
const XrCompositionLayerProjection* multi_projection_layer_ptr =
reinterpret_cast<const XrCompositionLayerProjection*>(
frame_end_info->layers[i]);
RETURN_IF(multi_projection_layer_ptr->type !=
XR_TYPE_COMPOSITION_LAYER_PROJECTION,
XR_ERROR_VALIDATION_FAILURE,
"XrCompositionLayerProjection type invalid");
RETURN_IF(
multi_projection_layer_ptr->viewCount != OpenXrTestHelper::kViewCount,
XR_ERROR_VALIDATION_FAILURE,
"XrCompositionLayerProjection viewCount invalid");
for (uint32_t j = 0; j < multi_projection_layer_ptr->viewCount; j++) {
RETURN_IF(multi_projection_layer_ptr->views[j].type !=
XR_TYPE_COMPOSITION_LAYER_PROJECTION_VIEW,
XR_ERROR_VALIDATION_FAILURE,
"XrCompositionLayerProjectionView type invalid");
}
}
g_test_helper.OnPresentedFrame(); g_test_helper.OnPresentedFrame();
return XR_SUCCESS; return XR_SUCCESS;
......
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