Skip to content
Snippets Groups Projects
Commit a42dd819 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Merge branch 'bug/368/rendererror' into 'master'

Resolves #368 with render cancel on error

Closes #368

See merge request nicolas.pope/ftl!325
parents 146d0cdd 015fed3c
No related branches found
No related tags found
1 merge request!325Resolves #368 with render cancel on error
Pipeline #28776 passed
......@@ -33,6 +33,8 @@ class CUDARender : public ftl::render::FSRenderer {
void blend(ftl::codecs::Channel) override;
void cancel() override;
/**
* Returns all inter-frameset collisions in camera coordinates.
*/
......
......@@ -47,6 +47,8 @@ class Renderer : public ftl::Configurable {
virtual void blend(ftl::codecs::Channel)=0;
virtual void cancel()=0;
protected:
Stage stage_;
};
......
......@@ -498,6 +498,13 @@ void CUDARender::_renderPass2(Channels<0> chans, const Eigen::Matrix4d &t) {
}
}
void CUDARender::cancel() {
out_ = nullptr;
scene_ = nullptr;
stage_ = Stage::Finished;
cudaSafeCall(cudaStreamSynchronize(stream_));
}
void CUDARender::begin(ftl::rgbd::Frame &out, ftl::codecs::Channel chan) {
if (stage_ != Stage::Finished) {
throw FTL_Error("Already rendering");
......
......@@ -448,6 +448,9 @@ bool OpenVRRender::retrieve(ftl::data::Frame &frame_out) {
renderer2_->end();
} catch (const ftl::exception &e) {
LOG(ERROR) << "Render exception: " << e.what();
renderer_->cancel();
renderer2_->cancel();
frame_out.message(ftl::data::Message::Error_RENDER, e.what());
}
if (!post_pipe_) {
......
......@@ -206,6 +206,8 @@ bool ScreenRender::retrieve(ftl::data::Frame &frame_out) {
if (!data_only) renderer_->end();
} catch (const ftl::exception &e) {
LOG(ERROR) << "Render exception: " << e.what();
renderer_->cancel();
frame_out.message(ftl::data::Message::Error_RENDER, e.what());
}
if (!data_only) {
......
......@@ -13,6 +13,7 @@ enum class Message : int {
Error_FRAME_GRAB,
Error_BAD_FORMAT,
Error_OPENVR,
Error_RENDER,
Warning_UNKNOWN = 1024,
Warning_FRAME_DROP,
Warning_PIPELINE_DROP,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment