-
Notifications
You must be signed in to change notification settings - Fork 51
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
Decouple display and window handles #92
Comments
From what I understand, this would make sense for |
For something like android/macOS it would make sense to have plain So it'll work the same way it works right now, it just prevent me from creating |
Alright. I'm not familiar enough with |
To create EGLDisplay or GLXDisplay you need raw display handle, nothing more. This display allows you to create objects, such as EGLContext, EGLConfig, EGLSurface, etc. The RawWindowHandle is only required for EGLSurface, and not all the surfaces actually, since e.g. PBuffers don't need it at all. I'd assume the same applies to vulkan or e.g. softbuffer(not the current impl of softbuffer in particular). |
I don't recall there being any concept of a "Display" connection (needed) to do this. As long as you can enumerate a Vulkan device one can create/allocate a texture for "rendertarget" purposes. You'll need both to create a surface on a window though: https://github.com/ash-rs/ash/blob/master/ash-window/src/lib.rs Perhaps a "display" handle may be relevant for |
Well, don't you need a wl_display for Wayland platform with vulkan? I'd assume you'd need one. |
@kchibisov I don't think you need any of that to create a Vulkan device and do anything like compute or offscreen rendering. As linked to the |
That's interesting. Though for EGL you need wl_display to create EGLDisplay, and the wl_surface is required to for In general |
@kchibisov Yes that surprised me too, seems the EGL API builds on top of an active windowing system (but it should be possible to run it headless?) whereas Vulkan only looks at physical GPUs provided by the system and can access them without any. I do agree that it'd be nice to have/use it this way. |
This entire topic completely doesn't make sense to me as a Win32 programmer because with Win32 it's just the HWND and that's it. However, I'd like to say that I'm open to changes for other platforms if people that know about those platforms think it's appropriate. I'll add that the goal of the crate has always been for there to be some sort of common data/trait for talking about the OS handle so that [window lib] and [graphics api lib] can share info without ever directly depending on each other, but that doesn't necessarily mean we only have a single data value. It certainly might be appropriate for some platforms to have more than one "handle" that can be asked for. This is the part I don't know about, and where I'll leave it up to others who know about those APIs. |
Yeah, because you have only one possible display server? On macOS and android it's the same from what I can see, however Wayland, X11, and XCB do have their own stuff to connect to system display server, since you know, there're multiple of them (mesa should work with Xorg and Wayland at the same time, and it must differ them somehow). So something like |
@Lokathor Doesn't Windows have this for |
Ah, interesting comparison. Yes, there's an Each Each Just checking quickly, it looks like:
|
If a "display server" is something like "the system has multiple display servers available, and i get to pick what display server i want to make a window for", that doesn't really map to any windows API that I know about. Like kchibisov said, there's just the one windowing system on Windows, and you get what you get. |
@Lokathor Thanks for the detailed insight! So yes, if @kchibisov has a use-case for needing the display-server connection without having a surface/window yet - even if it's just for EGL - I think this is a good change to make. And Vulkan user may benefit when utilizing |
I am a fan of this, especially for cases where the display isn't easily clonable. My only concern: how would you stop, say, a Wayland display server from being used with, say, an XCB window? That feels like a larger surface that could possibly panic. |
Well the API can prevent it in a first place. And if you've got a Wayland display, you're unlikely to get an Xcb window, since you don't have xcb around? The Api is already unsafe to begin with, since you basically pass pointers around. In general applications can compare whether the right thing is passed. Like it's not a problem when we're doing low level stuff. The main issue I'm trying to solve here, is that I need a display before I even try to create a surface, like I don't have a window at all in glutin when I query for X11 visuals with glx for example. And later on I'll use that visual to create an X11 window :/ If you have an idea on how to make them safer to use, I'm all years, but take into account that I should have display without a window. |
I came to this crate after reading about the recent changes to [`glutin`][0]. At a glance I didn't understand the difference between `RawWindowHandle` and `RawDisplayHandle` (or even what a display was), and the enums looked mostly the same. After reading through this [issue][1] and digging through the structs, I have a better understanding of what each type represents, but I thought it would be useful to add a line clarifying the distinction between the two. I also added some examples of what external types may be represented for a few platforms. [0]: https://github.com/rust-windowing/glutin/releases/tag/v0.30.0 [1]: rust-windowing#92
I came to this crate after reading about the recent changes to [`glutin`][0]. At a glance I didn't understand the difference between `RawWindowHandle` and `RawDisplayHandle` (or even what a display was), and the enums looked mostly the same. After reading through this [issue][1] and digging through the structs, I have a better understanding of what each type represents, but I thought it would be useful to add a line clarifying the distinction between the two. I also added some examples of what external types may be represented for a few platforms. [0]: https://github.com/rust-windowing/glutin/releases/tag/v0.30.0 [1]: #92
When user wants to deal with platform specific code they most of the time need raw display, like e.g. wl_display. However RawWindowHandle provides with both of them.
I'd suggest to logically split them into
RawDisplayHandle
andRawWindowHandle
, whereRawDisplayHandle
would have only reference to display andRawWindowHandle
could have only window, likewl_surface
or be the way it is right now?The issue I'm having is that I want Display on every platform, but I don't want surface, since the surface isn't yet created.
For example winit could implement
raw_display_handle
on event loop, so I can pass to e.g. glutin.The text was updated successfully, but these errors were encountered: