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
Add ANGLE rendering in Wrench #2529
Merged
+761
−33
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.
Loading status checks…
Add ANGLE rendering in Wrench
The `--angle` command-line parameter enables it on Windows, when `--headless` is not also used. It panics on non-Windows.
- Loading branch information
commit 06c43ede8605de886b7bb584c9b3e59be4027dd4
Some generated files are not rendered by default. Learn more.
Oops, something went wrong.
| @@ -0,0 +1,72 @@ | ||
| /* This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
|
||
| use glutin; | ||
| use glutin::{WindowBuilder, ContextBuilder, EventsLoop, Window, CreationError}; | ||
|
|
||
| #[cfg(not(windows))] | ||
| pub enum Context {} | ||
|
|
||
| #[cfg(windows)] | ||
| pub use ::egl::Context; | ||
|
|
||
| impl Context { | ||
| #[cfg(not(windows))] | ||
| pub fn with_window( | ||
| _: WindowBuilder, | ||
| _: ContextBuilder, | ||
| _: &EventsLoop, | ||
| ) -> Result<(Window, Self), CreationError> { | ||
| Err(CreationError::PlatformSpecific("ANGLE rendering is only supported on Windows".into())) | ||
| } | ||
|
|
||
| #[cfg(windows)] | ||
| pub fn with_window( | ||
| window_builder: WindowBuilder, | ||
| context_builder: ContextBuilder, | ||
| events_loop: &EventsLoop, | ||
| ) -> Result<(Window, Self), CreationError> { | ||
| use glutin::os::windows::WindowExt; | ||
|
|
||
| // FIXME: &context_builder.pf_reqs https://github.com/tomaka/glutin/pull/1002 | ||
| let pf_reqs = &glutin::PixelFormatRequirements::default(); | ||
|
||
| let gl_attr = &context_builder.gl_attr.map_sharing(|_| unimplemented!()); | ||
| let window = window_builder.build(events_loop)?; | ||
| Self::new(pf_reqs, gl_attr) | ||
| .and_then(|p| p.finish(window.get_hwnd() as _)) | ||
| .map(|context| (window, context)) | ||
| } | ||
| } | ||
|
|
||
| #[cfg(not(windows))] | ||
| impl glutin::GlContext for Context { | ||
| unsafe fn make_current(&self) -> Result<(), glutin::ContextError> { | ||
| match *self {} | ||
| } | ||
|
|
||
| fn is_current(&self) -> bool { | ||
| match *self {} | ||
| } | ||
|
|
||
| fn get_proc_address(&self, _: &str) -> *const () { | ||
| match *self {} | ||
| } | ||
|
|
||
| fn swap_buffers(&self) -> Result<(), glutin::ContextError> { | ||
| match *self {} | ||
| } | ||
|
|
||
| fn get_api(&self) -> glutin::Api { | ||
| match *self {} | ||
| } | ||
|
|
||
| fn get_pixel_format(&self) -> glutin::PixelFormat { | ||
| match *self {} | ||
| } | ||
|
|
||
| fn resize(&self, _: u32, _: u32) { | ||
| match *self {} | ||
| } | ||
| } | ||
|
|
||
Oops, something went wrong.
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
At the moment Wrench does not call any
ContextBuildermethod that touches the pixel format requirements, so usingdefault()doesn’t make a difference.