The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

c/main: Record pose used in compositor

authored by

Patrick Nicolas and committed by
Jakob Bornecrantz
559e1459 7a0d87db

+27 -12
+22 -12
src/xrt/compositor/main/comp_renderer.c
··· 700 700 { 701 701 COMP_TRACE_MARKER(); 702 702 703 - struct xrt_space_relation head_relation = XRT_SPACE_RELATION_ZERO; 704 - struct xrt_fov fovs[2] = {0}; 705 - struct xrt_pose poses[2] = {0}; 706 - 707 703 struct xrt_vec3 default_eye_relation = { 708 704 0.063000f, /*! @todo get actual ipd_meters */ 709 705 0.0f, 710 706 0.0f, 711 707 }; 712 708 709 + struct xrt_space_relation head_relation = XRT_SPACE_RELATION_ZERO; 710 + struct xrt_pose poses[2] = {0}; 711 + 713 712 xrt_device_get_view_poses( // 714 713 r->c->xdev, // 715 714 &default_eye_relation, // 716 715 r->c->frame.rendering.predicted_display_time_ns, // 717 716 2, // 718 717 &head_relation, // 719 - fovs, // 718 + r->c->base.slot.fovs, // 720 719 poses); // 721 720 722 721 struct xrt_pose base_space_pose = XRT_POSE_IDENTITY; 723 722 724 723 for (uint32_t i = 0; i < 2; i++) { 725 - const struct xrt_fov fov = fovs[i]; 724 + const struct xrt_fov fov = r->c->base.slot.fovs[i]; 726 725 const struct xrt_pose eye_pose = poses[i]; 727 726 728 727 comp_layer_renderer_set_fov(r->lr, &fov, i); ··· 734 733 m_relation_chain_push_pose_if_not_identity(&xrc, &base_space_pose); 735 734 m_relation_chain_resolve(&xrc, &result); 736 735 736 + r->c->base.slot.poses[i] = result.pose; 737 737 comp_layer_renderer_set_pose(r->lr, &eye_pose, &result.pose, i); 738 738 } 739 739 } ··· 943 943 const struct xrt_layer_projection_view_data *lvd = &stereo->l; 944 944 const struct xrt_layer_projection_view_data *rvd = &stereo->r; 945 945 946 + c->base.slot.poses[0] = lvd->pose; 947 + c->base.slot.poses[1] = rvd->pose; 948 + c->base.slot.fovs[0] = lvd->fov; 949 + c->base.slot.fovs[1] = rvd->fov; 950 + 946 951 do_gfx_mesh_and_proj(r, rr, rtr, layer, lvd, rvd); 947 952 948 953 renderer_submit_queue(r, rr->r->cmd, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT); ··· 955 960 const struct xrt_layer_stereo_projection_depth_data *stereo = &layer->data.stereo_depth; 956 961 const struct xrt_layer_projection_view_data *lvd = &stereo->l; 957 962 const struct xrt_layer_projection_view_data *rvd = &stereo->r; 963 + 964 + c->base.slot.poses[0] = lvd->pose; 965 + c->base.slot.poses[1] = rvd->pose; 966 + c->base.slot.fovs[0] = lvd->fov; 967 + c->base.slot.fovs[1] = rvd->fov; 958 968 959 969 do_gfx_mesh_and_proj(r, rr, rtr, layer, lvd, rvd); 960 970 ··· 980 990 { 981 991 COMP_TRACE_MARKER(); 982 992 983 - struct xrt_space_relation head_relation = XRT_SPACE_RELATION_ZERO; 984 - struct xrt_fov fovs[2] = {0}; 985 - struct xrt_pose poses[2] = {0}; 986 - 987 993 struct xrt_vec3 default_eye_relation = { 988 994 0.063000f, /*! @todo get actual ipd_meters */ 989 995 0.0f, 990 996 0.0f, 991 997 }; 998 + 999 + struct xrt_space_relation head_relation = XRT_SPACE_RELATION_ZERO; 1000 + struct xrt_pose poses[2] = {0}; 992 1001 993 1002 xrt_device_get_view_poses( // 994 1003 r->c->xdev, // ··· 996 1005 r->c->frame.rendering.predicted_display_time_ns, // 997 1006 2, // 998 1007 &head_relation, // 999 - fovs, // 1008 + r->c->base.slot.fovs, // 1000 1009 poses); // 1001 1010 1002 1011 for (uint32_t i = 0; i < 2; i++) { 1003 - const struct xrt_fov fov = fovs[i]; 1012 + const struct xrt_fov fov = r->c->base.slot.fovs[i]; 1004 1013 const struct xrt_pose eye_pose = poses[i]; 1005 1014 1006 1015 comp_layer_renderer_set_fov(r->lr, &fov, i); ··· 1013 1022 1014 1023 out_eye[i] = eye_pose; 1015 1024 out_world[i] = result.pose; 1025 + r->c->base.slot.poses[i] = result.pose; 1016 1026 } 1017 1027 } 1018 1028
+5
src/xrt/compositor/util/comp_base.h
··· 60 60 61 61 //! Special case one layer projection/projection-depth fast-path. 62 62 bool one_projection_layer_fast_path; 63 + 64 + //! fov as reported by device for the current submit. 65 + struct xrt_fov fovs[2]; 66 + //! absolute pose as reported by device for the current submit. 67 + struct xrt_pose poses[2]; 63 68 }; 64 69 65 70 /*!