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

Allow to not depend on offscreen_gl_context. #773

Closed
wants to merge 2 commits into from

Conversation

@emilio
Copy link
Member

emilio commented Jan 24, 2017

This PR allows (via feature-gate) to compile out enough WebGL-related code in
order to not depend in offscreen_gl_context.

Fixes bug 1331546
Fixes servo/surfman#77

r? @glennw or @kvark
cc @sotaroikeda


This change is Reviewable

@kvark
kvark approved these changes Jan 24, 2017
Copy link
Member

kvark left a comment

Looks sensible to me. Just need to fix the CI and maybe answer my concern about the dead code.

@@ -186,6 +186,7 @@ pub struct ResourceCache {
cached_images: ResourceClassCache<ImageRequest, CachedImageInfo>,

// TODO(pcwalton): Figure out the lifecycle of these.
#[cfg_attr(not(feature = "webgl"), allow(dead_code))]

This comment has been minimized.

@kvark

kvark Jan 24, 2017

Member

why do we need to allow all these dead_code pieces instead of completely removing them?

This comment has been minimized.

@emilio

emilio Jan 24, 2017

Author Member

We can remove them indeed, but overall in big structs, I didn't think it is worth to duplicate all the constructors just to avoid that field. I can do it if you prefer it that way, I just thought adding fields would become a bit more annoying.

This PR allows (via feature-gate) to compile out enough WebGL-related code in
order to not depend in offscreen_gl_context.

Fixes bug 1331546
Fixes servo/surfman#77
@emilio emilio force-pushed the emilio:no-offscreen branch from 85b4602 to ce26bdd Jan 24, 2017
@emilio
Copy link
Member Author

emilio commented Jan 24, 2017

Let me know if you want me to do a followup removing those fields.

@bors-servo r=kvark

@bors-servo
Copy link
Contributor

bors-servo commented Jan 24, 2017

📌 Commit ce26bdd has been approved by kvark

@bors-servo
Copy link
Contributor

bors-servo commented Jan 24, 2017

Testing commit ce26bdd with merge f2c5aa2...

bors-servo added a commit that referenced this pull request Jan 24, 2017
Allow to not depend on offscreen_gl_context.

This PR allows (via feature-gate) to compile out enough WebGL-related code in
order to not depend in offscreen_gl_context.

Fixes bug 1331546
Fixes servo/surfman#77

r? @glennw or @kvark
cc @sotaroikeda

<!-- 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/773)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 25, 2017

💔 Test failed - status-travis

@emilio emilio force-pushed the emilio:no-offscreen branch from 80eb040 to d071670 Jan 25, 2017
@emilio
Copy link
Member Author

emilio commented Jan 25, 2017

Had to work around serde-rs/serde#720. Isn't ultra-pretty, but didn't think of a better way.

Mind reviewing the last commit @kvark?

@glennw
Copy link
Member

glennw commented Jan 25, 2017

@emilio This appears to have compile errors on CI.

@emilio
Copy link
Member Author

emilio commented Jan 25, 2017

Gah, of course, this builds fine with derive + WebGL (Servo's configuration), and codegen - WebGL (Gecko's), but none of those are the default.

@sotaroikeda, if this is not hi-priority, we could wait a few weeks until rust stable supports custom derive (it's on beta right now), are you fine with that?

@kvark
kvark approved these changes Jan 26, 2017
// Some stubs to work around https://github.com/serde-rs/serde/issues/720
#[cfg(not(feature = "webgl"))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GLContextAttributes([u8; 0]);

This comment has been minimized.

@kvark

kvark Jan 26, 2017

Member

just curious, what is the point of having [u8; 0] internally?

This comment has been minimized.

@emilio

emilio Jan 26, 2017

Author Member

Apparently it's the sound way of making opaque enums that can't be instantiated, see rust-lang/rfcs#1861 (comment)

@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

@emilio @sotaroikeda Have we decided to hold off on this until the rustc support lands?

@emilio
Copy link
Member Author

emilio commented Jan 30, 2017

Yes, I believe so, unless it's super-hi-pri for Gecko, it's going to be cleaner than adding a lots of workarounds and then removing them shortly after.

@emilio emilio closed this Jan 30, 2017
@sotaroikeda
Copy link
Contributor

sotaroikeda commented Mar 1, 2017

@emilio, can we do it cleaner with #941?

@emilio
Copy link
Member Author

emilio commented Mar 1, 2017

bors-servo added a commit that referenced this pull request Mar 28, 2017
Allow to not depend on offscreen_gl_context

It is created based on #773.

cc @emilio, @kvark, @glennw

<!-- 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/1009)
<!-- Reviewable:end -->
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

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