Skip to content

Commit

Permalink
IGL : Adding support to use Composition layer quad for reprojection i…
Browse files Browse the repository at this point in the history
…n desktop XrApp.

Summary: Adding support to reproject xr render output to a quad in XrApp.

Reviewed By: EricGriffith

Differential Revision: D49377639

fbshipit-source-id: 9b1d903600ae6a0fc9803ee4d1dc9c4f373af7cf
  • Loading branch information
trivedivivek authored and facebook-github-bot committed Sep 20, 2023
1 parent 61e8a8d commit 8b4c965
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion shell/openxr/desktop/XrApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,18 @@ void XrApp::render() {
}

void XrApp::endFrame(XrFrameState frameState) {
#ifdef USE_COMPOSITION_LAYER_QUAD
XrCompositionLayerQuad layer{};
layer.next = nullptr;
layer.type = XR_TYPE_COMPOSITION_LAYER_QUAD;
layer.layerFlags = XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT;
layer.space = stageSpace_;
layer.eyeVisibility = XR_EYE_VISIBILITY_BOTH;
memset(&layer.subImage, 0, sizeof(XrSwapchainSubImage));
layer.pose = {{0.f, 0.f, 0.f, 1.f}, {0.f, 0.f, 0.f}};
layer.size = {1.f, 1.f};
#endif

std::array<XrCompositionLayerProjectionView, kNumViews> projectionViews;
std::array<XrCompositionLayerDepthInfoKHR, kNumViews> depthInfos;

Expand Down Expand Up @@ -561,10 +573,18 @@ void XrApp::endFrame(XrFrameState frameState) {
depthInfos[i].maxDepth = appParams.depthParams.maxDepth;
depthInfos[i].nearZ = appParams.depthParams.nearZ;
depthInfos[i].farZ = appParams.depthParams.farZ;
#ifdef USE_COMPOSITION_LAYER_QUAD
layer.subImage = projectionViews[0].subImage;
#endif
}

const XrCompositionLayerBaseHeader* const layers[] = {
(const XrCompositionLayerBaseHeader*)&projection};
#ifdef USE_COMPOSITION_LAYER_QUAD
(const XrCompositionLayerBaseHeader*)&layer
#else
(const XrCompositionLayerBaseHeader*)&projection
#endif
};

XrFrameEndInfo endFrameInfo = {
XR_TYPE_FRAME_END_INFO,
Expand Down

0 comments on commit 8b4c965

Please sign in to comment.