Skip to content

Conversation

@nical
Copy link
Contributor

@nical nical commented Jan 23, 2017

First step towards proper error handing in WebRender. This patch focuses on making the initialization of the Renderer fallible. This is important in order to let Gecko be able to catch potential errors and fallback to a different rendering backend.

r? @kvark


This change is Reviewable

@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #750) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nical ! The change looks good, but I'd like a few things to be addressed.

return Err(ShaderError::Link(error_log));
}

Ok(())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly with shader compiling, we should still print out warnings on the successful builds too

match (vs_id, fs_id) {
(Some(vs_id), None) => {
(Ok(vs_id), Err(e)) => {
println!("FAILED to load fs - falling back to previous!");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think failing back to a previous shader is a good idea, especially if we get in a partial state where, for example, the FS is new and the VS is old.
It would be much nicer to do this idiomatically, as in - let vs_id = try!(Device::compile_shader(..)); without the need to do this match afterwards.

Thread(std::io::Error),
}

impl std::convert::From<ShaderError> for InitError {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need the full path here: std::convert::From should be in prelude already

let (data, marker, shader) = match &batch.data {
&PrimitiveBatchData::CacheImage(ref data) => {
let shader = self.ps_cache_image.get(&mut self.device, transform_kind);
let shader = self.ps_cache_image.get(&mut self.device, transform_kind).unwrap();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could get away without uwnrap-ping in each match arm by doing it after the match

@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #765) made this pull request unmergeable. Please resolve the merge conflicts.

@glennw
Copy link
Member

glennw commented Jan 30, 2017

Needs rebasing.

@glennw
Copy link
Member

glennw commented Feb 2, 2017

@bors-servo r=kvark

@bors-servo
Copy link
Contributor

📌 Commit 82ca8ba has been approved by kvark

@bors-servo
Copy link
Contributor

⌛ Testing commit 82ca8ba with merge 87278a1...

bors-servo pushed a commit that referenced this pull request Feb 2, 2017
Propagate errors when initializing WebRender instead of panicking

First step towards proper error handing in WebRender. This patch focuses on making the initialization of the Renderer fallible. This is important in order to let Gecko be able to catch potential errors and fallback to a different rendering backend.

r? @kvark

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/768)
<!-- Reviewable:end -->
@glennw
Copy link
Member

glennw commented Feb 2, 2017

Merging manually, as bors seems stuck, but travis / appveyor have passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants