From 0cad90efcd6242d0dbec2c528dc79ec40b5cecb4 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Thu, 13 Aug 2020 14:02:38 +0300 Subject: [PATCH] Tidy and log vr pose --- components/renderers/cpp/src/CUDARender.cpp | 17 -------------- .../streams/src/renderers/openvr_render.cpp | 22 +------------------ 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/components/renderers/cpp/src/CUDARender.cpp b/components/renderers/cpp/src/CUDARender.cpp index bf0edd27f..1ed37cca6 100644 --- a/components/renderers/cpp/src/CUDARender.cpp +++ b/components/renderers/cpp/src/CUDARender.cpp @@ -273,7 +273,6 @@ void CUDARender::_mesh(ftl::rgbd::Frame &out, const Eigen::Matrix4d &t, cudaStre // Calculate and save virtual view screen position of each source pixel if (f.hasChannel(Channel::Depth)) { - LOG(INFO) << "DEPTH SCREEN COORD"; ftl::cuda::screen_coord( f.createTexture<float>(Channel::Depth), depthbuffer, @@ -288,7 +287,6 @@ void CUDARender::_mesh(ftl::rgbd::Frame &out, const Eigen::Matrix4d &t, cudaStre params_, transform, f.getLeftCamera(), stream ); } else { - LOG(INFO) << "NON-DEPTH SCREEN COORD"; // Constant depth version ftl::cuda::screen_coord( depthbuffer, @@ -304,12 +302,6 @@ void CUDARender::_mesh(ftl::rgbd::Frame &out, const Eigen::Matrix4d &t, cudaStre depth_out_.to_gpumat().setTo(cv::Scalar(1000.0f), cvstream); - LOG(INFO) << "MESH BEFORE TRIANGLES"; - cudaSafeCall(cudaStreamSynchronize(stream_)); - - LOG(INFO) << "TEMP SIZE = " << temp_.get<cv::cuda::GpuMat>((do_blend) ? Channel::Depth : Channel::Depth2).size(); - LOG(INFO) << "Depth Buffer Size = " << depthbuffer.width() << "," << depthbuffer.height(); - // Decide on and render triangles around each point ftl::cuda::triangle_render1( depthbuffer, @@ -321,9 +313,6 @@ void CUDARender::_mesh(ftl::rgbd::Frame &out, const Eigen::Matrix4d &t, cudaStre // TODO: Reproject here // And merge based upon weight adjusted distances - LOG(INFO) << "MESH BLENDER"; - cudaSafeCall(cudaStreamSynchronize(stream_)); - if (do_blend) { // Blend this sources mesh with previous meshes ftl::cuda::mesh_blender( @@ -343,9 +332,6 @@ void CUDARender::_mesh(ftl::rgbd::Frame &out, const Eigen::Matrix4d &t, cudaStre if (valid_count == 0) return; - LOG(INFO) << "MESH PART 1"; - cudaSafeCall(cudaStreamSynchronize(stream_)); - // Convert from int depth to float depth //temp_.get<GpuMat>(Channel::Depth2).convertTo(out.get<GpuMat>(Channel::Depth), CV_32F, 1.0f / 100000.0f, cvstream); @@ -668,10 +654,7 @@ bool CUDARender::submit(ftl::data::FrameSet *in, Channels<0> chans, const Eigen: bool success = true; try { - LOG(INFO) << "START RENDERPASS 1"; _renderPass1(t); - cudaSafeCall(cudaStreamSynchronize(stream_)); - LOG(INFO) << "END RENDERPASS 1"; } catch (const ftl::exception &e) { LOG(ERROR) << "Exception in render: " << e.what(); success = false; diff --git a/components/streams/src/renderers/openvr_render.cpp b/components/streams/src/renderers/openvr_render.cpp index a1b802edb..9aa104b95 100644 --- a/components/streams/src/renderers/openvr_render.cpp +++ b/components/streams/src/renderers/openvr_render.cpp @@ -261,9 +261,7 @@ bool OpenVRRender::retrieve(ftl::data::Frame &frame_out) { int width = rgbdframe.getLeft().width; int height = rgbdframe.getLeft().height; - LOG(INFO) << "WAIT GET POSE"; auto vrerr = vr::VRCompositor()->WaitGetPoses(rTrackedDevicePose_, vr::k_unMaxTrackedDeviceCount, NULL, 0 ); - LOG(INFO) << "GOT POSE"; if (vrerr != vr::VRCompositorError_None) { frame_out.message(ftl::data::Message::Error_OPENVR, "Could not get VR pose"); @@ -342,6 +340,7 @@ bool OpenVRRender::retrieve(ftl::data::Frame &frame_out) { } rgbdframe.setPose() = initial_pose_*viewPose; + LOG(INFO) << "VR POSE = " << rgbdframe.getPose(); } else { LOG(ERROR) << "No VR Pose"; @@ -351,8 +350,6 @@ bool OpenVRRender::retrieve(ftl::data::Frame &frame_out) { // TODO: Get controller data if available... - LOG(INFO) << "MAKE OPENGL TEXTURES"; - texture1_.make(width, height, ftl::utility::GLTexture::Type::BGRA); texture2_.make(width, height, ftl::utility::GLTexture::Type::BGRA); @@ -373,8 +370,6 @@ bool OpenVRRender::retrieve(ftl::data::Frame &frame_out) { ftl::operators::Poser::get(origin_name, origin); }*/ - LOG(INFO) << "START RENDER"; - try { renderer_->begin(rgbdframe, ftl::codecs::Channel::Left); renderer2_->begin(rgbdframe, Channel::Colour2); @@ -443,7 +438,6 @@ bool OpenVRRender::retrieve(ftl::data::Frame &frame_out) { } } - LOG(INFO) << "START MIX"; mixer_.mix(); // Write mixed audio to frame. @@ -454,7 +448,6 @@ bool OpenVRRender::retrieve(ftl::data::Frame &frame_out) { int fcount = mixer_.frames(); mixer_.read(list.emplace_front().data(), fcount); } - LOG(INFO) << "END MIX"; // TODO: Blend option @@ -467,8 +460,6 @@ bool OpenVRRender::retrieve(ftl::data::Frame &frame_out) { frame_out.message(ftl::data::Message::Error_RENDER, e.what()); } - LOG(INFO) << "END RENDER"; - if (!post_pipe_) { post_pipe_ = ftl::config::create<ftl::operators::Graph>(host(), "post_filters"); post_pipe_->append<ftl::operators::Poser>("poser"); @@ -478,36 +469,25 @@ bool OpenVRRender::retrieve(ftl::data::Frame &frame_out) { post_pipe_->apply(rgbdframe, rgbdframe, 0); - LOG(INFO) << "END PIPELINE"; - if (host_->value("enable_touch", false)) { ftl::render::collision2touch(rgbdframe, renderer_->getCollisions(), sets, my_id_, host_->value("touch_min", 0.01f), host_->value("touch_max", 0.05f)); } - LOG(INFO) << "FINISHED TOUCH DATA"; - // FIXME: Use a stream ftl::cuda::flip<uchar4>(rgbdframe.set<cv::cuda::GpuMat>(Channel::Colour), 0); ftl::cuda::flip<uchar4>(rgbdframe.set<cv::cuda::GpuMat>(Channel::Colour2), 0); - LOG(INFO) << "DONE FLIP"; - texture1_.unmap(renderer_->getCUDAStream()); texture2_.unmap(renderer2_->getCUDAStream()); //return true; - LOG(INFO) << "UNMAP AND SEND TO VR"; - // Send left and right textures to VR headset vr::Texture_t leftEyeTexture = {(void*)(uintptr_t)texture1_.texture(), vr::TextureType_OpenGL, vr::ColorSpace_Gamma }; vr::VRCompositor()->Submit(vr::Eye_Left, &leftEyeTexture ); vr::Texture_t rightEyeTexture = {(void*)(uintptr_t)texture2_.texture(), vr::TextureType_OpenGL, vr::ColorSpace_Gamma }; vr::VRCompositor()->Submit(vr::Eye_Right, &rightEyeTexture ); - LOG(INFO) << "ABOUT TO FLUSH"; glFlush(); - LOG(INFO) << "FINISH VR FRAME"; - } return true; -- GitLab