-
Notifications
You must be signed in to change notification settings - Fork 498
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
chore: Support multiple render backends #2359
chore: Support multiple render backends #2359
Conversation
31deb86
to
038b995
Compare
70fc54a
to
110ea99
Compare
use crate::profiling::{opengl::create_opengl_gpu_context, GpuCtx}; | ||
|
||
pub struct OpenGLSkiaRenderer { | ||
// NOTE: The destruction order is important, so don't re-arrange |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a SAFETY
instead of NOTE
could fit better in order to convey that a critical invariant is upheld here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll keep the NOTE:
the syntax highlighter highligts it, but not SAFETY:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost no nits code-wise, typical noisy GL setup. Haven't tested yet.
NonZeroU32::new(size.width).unwrap(), | ||
NonZeroU32::new(size.height).unwrap(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those unwraps might very well blow up if starting in e.g. an initially minimized state, need to try that out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is just moved, so it has been the same before. clamp_render_buffer_size
should ensure that it's not zero.
|
||
let interface = skia_safe::gpu::gl::Interface::new_load_with(|name| { | ||
if name == "eglGetCurrentDisplay" { | ||
return std::ptr::null(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is eglGetCurrentDisplay
filtered out? Can't we let get_proc_address
also find eglGetCurrentDisplay
? (possibly this is a peculiarity of EGL, I've never used EGL)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea, it was introduced here
After some discussion here
- OpenGL Renderer #491 (comment)
- [Investigation] Loading eglGetCurrentDisplay function pointer causes segfault #661
I found no issues in the glutin repository.
src/renderer/vsync/mod.rs
Outdated
#[cfg(target_os = "linux")] | ||
use std::env; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fwiw due to the moved detection logic, this import is actually unused and yields a warning
warning: unused import: `std::env`
--> src/renderer/vsync/mod.rs:17:5
|
17 | use std::env;
| ^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is now fixed. I was doing most of my testing on Windows, and that was part of one late change that never got properly tested on Linux.
Test results:
|
After retrying a few times between main and this branch on Xwayland, I can't seem to reproduce what I found initially, and found no meaningful differences. Ignore that then. |
I'm not sure about the XWayland freeze, I can't think of any changes that could cause it, except this one 110ea99, but that should not affect x11 or xwayland at all. The rest of the code should have stayed functionally the same. |
110ea99
to
8c2e80c
Compare
8c2e80c
to
dda3c83
Compare
But currently only OpenGL is supported.
It does not work with Windows swap chains, and might cause problems on Wayland as well.
dda3c83
to
4dabee7
Compare
What kind of change does this PR introduce?
This is mostly a refactoring in order to support multiple render backends, like D3D, and makes the actual PR that implements the D3D backend much smaller.
SkiaRenderer
, which can have different implementations depending on the platformopengl
implementationVSyncWin
has been renamed toVSyncWinDwm
to allow a swapchain implementation for D3D.Did this PR introduce a breaking change?