Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate errors when initializing WebRender instead of panicking #768

Merged
merged 1 commit into from Feb 2, 2017

Conversation

@nical
Copy link
Collaborator

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

bors-servo commented Jan 26, 2017

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

Copy link
Member

kvark left a comment

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

}

Ok(())

This comment has been minimized.

@kvark

kvark Jan 26, 2017

Member

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!");

This comment has been minimized.

@kvark

kvark Jan 26, 2017

Member

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 {

This comment has been minimized.

@kvark

kvark Jan 26, 2017

Member

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

@@ -1006,59 +1058,59 @@ impl Renderer {

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();

This comment has been minimized.

@kvark

kvark Jan 26, 2017

Member

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

@nical nical force-pushed the nical:error-handling branch from a72b8a5 to 164df00 Jan 27, 2017
@bors-servo
Copy link
Contributor

bors-servo commented Jan 30, 2017

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.

@nical nical force-pushed the nical:error-handling branch from 164df00 to 82ca8ba Jan 31, 2017
@kvark
kvark approved these changes Jan 31, 2017
@glennw
Copy link
Member

glennw commented Feb 2, 2017

@bors-servo r=kvark

@bors-servo
Copy link
Contributor

bors-servo commented Feb 2, 2017

📌 Commit 82ca8ba has been approved by kvark

@bors-servo
Copy link
Contributor

bors-servo commented Feb 2, 2017

Testing commit 82ca8ba with merge 87278a1...

bors-servo added 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.

@glennw glennw merged commit 456f870 into servo:master Feb 2, 2017
2 of 3 checks passed
2 of 3 checks passed
homu Testing commit 82ca8ba with merge 87278a1...
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.