12:39 MrCooper: DemiMarie: one big difference between OpenGL and Vulkan: with OpenGL, it's the driver's responsibility not to program the HW improperly, even if the application doesn't use the GL API correctly; whereas with Vulkan, things like GPU hangs can be the expected result if the application "holds it wrong"
12:49 Company: that's not quite true
12:49 Company: OpenGL allows shooting oneself in the foot, too
12:50 Company: but Vulkan comes with footgun included and requires you to use it
12:55 bluetail: is Vulkan the "Rust" of C ?
12:55 Ermine: the what
12:55 bluetail: The holy grail for OpenGL
12:56 bluetail: instead of OpenGL, to use... no matter the technical difference of nature
12:56 Ermine: the opposite comparison is more true I'd say
12:57 bluetail: I remember some Vulkan promos where it just outperformed most of the time... Well I guess here goes another half-truth
12:57 bluetail: I know it inherently uses OpenGL
12:57 bluetail: But I guess it can't do magic
12:58 Ermine: It doesn't inherently use OpenGL
13:02 bluetail: Interesting
13:04 MrCooper: Vulkan is lower level than OpenGL
13:12 K900: If you want a programming language comparison, Vulkan is to OpenGL what C is to Python
13:12 K900: (very, very roughly)
13:14 kisak: There's about 25 years separating when a group of devs sat down to design OpenGL and Vulkan. In those decades, how the video acceleration hardware works in today's generation isn't particularly close to how we thought it would become decades ago and Vulkan closer matches how hardware is designed today.
13:15 bluetail: I love those replies. Thanks a lot!
13:15 kisak: Of course, OpenGL got polish over the years, but there's some core design choices from yesteryear that have realtime performance costs.
13:19 bluetail: when I enforce java to use Vulkan and not its old legacy OpenGL interface, it gets slower in this case. I think it was some variable with zinc or something.
13:20 bluetail: I did do that because I wanted that fancy fps overlay called mangohud
13:21 Ermine: zinc implements opengl on top of vulkan. If your program uses vulkan, zinc is not used
13:21 bluetail: it was an old java game, using lwjgl 2.8.5
13:21 kisak: Mangohud can also be used with OpenGL.
13:22 bluetail: mangohud absolutely did not show up until I used zinc
13:22 K900: And I don't think old Java games generally do Vulkan
13:22 K900: And that usually means you were holding mangohud wrong
13:22 K900: It's harder to set up with OpenGL games
13:22 bluetail: I see
13:23 bluetail: I do not want to solve it. This was sorta rant
13:23 Company: Vulkan is faster than OpenGL if the developers know what they're doing
13:24 Company: if they don't, usually OpenGL will be faster - because it's more forgiving
13:36 DemiMarie: Company: I don't know what I am doing, so that means I will use OpenGL.
13:36 Company: I would very much suggest that, yes
13:39 Company: the good reasons to use Vulkan IMO are (1) you want to learn how GPUs work and have time, (2) you care about the future more than the present, (3) you absolutely need the performance and control Vulkan gives you
13:40 Company: and the good reason to not use Vulkan is (1) You need it to work.
13:43 DemiMarie: Should I fear OpenGL losing support in the future?
13:44 K900: Not really
13:44 Ermine: No
13:44 Ermine: Vulkan is not for everybody, so opengl is going to stay
13:45 DemiMarie: Is Vulkan mostly for middleware libraries that expose a higher-level API?
13:45 Ermine: depends on the case I think?
13:45 K900: It's also for doing really high performance stuff which generally means videogames
13:46 DemiMarie: I thought OpenGL could not do color management.
13:46 Ermine: or GPGPU stuff
13:46 K900: But there's also compatibility layers for pretty much every high level render API in existence now that are built on top of Vulkan
13:46 K900: Zink for OpenGL, DXVK/VKD3D for Direct3D
13:47 K900: OpenGL can do color management kinda
13:47 DemiMarie: Kinda?
13:48 K900: Kinda as in it's an extension and not all drivers implement it
13:48 K900: But I guess that's not really any worse than the Vulkan situation
14:00 Company: DemiMarie: color management is outside the scope of GL/Vulkan really
14:01 Company: it needs to be done in the platform layer - which in GL is really different, ie EGL for Wayland or WGL for Windows
14:01 DemiMarie:wishes that she could copy to CPU buffers in the guest, since those are super simple.
14:01 Company: in Vulkan it's done via extensions that are part of the spec-with-extensions
14:02 Company: but that stuff isn't really what either GL or Vulkan are about
14:06 DemiMarie: Does OpenGL provide enough control for a compositor to not be stalled forever by a client that keeps rendering to the same buffer over and over?
14:08 Company: that depends what you mean by "stalled"
14:08 Company: but most likely the answer is "that's not a GL/Vulkan problem"
14:11 DemiMarie: It's a compositor problem, and OpenGL and Vulkan are the tools it has to work with.
14:11 Company: Vulkan/GL are C API definitions for an interface that can be used to draw stuff
14:12 Company: if you want to control hardware, you talk to the kernel
14:13 K900: It's not really a Vulkan/GL problem, it's kind of a DRM sync problem, and things are generally moving in the direction of external sync everywhere
14:13 K900: So on recent enough kernels/drivers you should be able to not have that problem ever
14:13 Ermine: A.k.a explicit sync? Or is this something else?
14:14 K900: Yes
14:14 DemiMarie: Company: And only OpenGL and Vulkan implementations know how to talk to the kernel.
14:15 Ermine: you can use libdrm directly...
14:15 DemiMarie: Does OpenGL support explicit sync?
14:16 DemiMarie: Ermine: yes, but I have no idea what parameters to fill in for things like GPU instructions.
14:16 K900: libdrm doesn't do GPU instructions really
14:16 DemiMarie: Exactly!
14:16 K900: Are you actually writing a compositor?
14:16 DemiMarie: Sort of
14:16 DemiMarie: I'm writing a pair of proxies
14:16 K900: If you are, you might want to use something like wlroots that handles most of this for you
14:17 DemiMarie: wlroots has too much attack surface
14:18 K900: wlroots might also be the wrong tool
14:18 K900: What are you actually trying to build?
14:20 Company: DemiMarie: every compositor talks to the kernel
14:21 DemiMarie: K900: In the guest, there will be a compositor that composites subsurfaces and speaks a subset of Wayland to the host over cross-domain virtio-GPU.
14:22 DemiMarie: That will use wlroots because it is not a security boundary and wlroots knows how to do the job well.
14:23 DemiMarie: On the host, I have something that sanitizes the inputs from the guest and passes it to the real host compositor.
14:24 DemiMarie: Ideally, I would just sanitize guest buffers, but I was not able to figure out a way to validate guest dmabuf parameters without actually importing the buffer.
14:25 DemiMarie: Also, I'm not sure if I want the Mesa user-mode driver to be in the guest-exposed attack surface.
14:26 Company: have you looked at how browsers handle WebGL?
14:26 DemiMarie: These problems can be solved by having the host compositor do a blit to buffers that it allocates.
14:27 Company: because that seems like a similar problem
14:27 DemiMarie: No, it is not.
14:27 DemiMarie: For one, the attack surface of WebGL is far too high.
14:28 DemiMarie: Secondly, I operate at a far lower level than WebGL.
14:29 Company: we were talking about rendering APIs more or less
14:29 Company: and WebGL is a much simpler one than Vulkan/GL
14:30 DemiMarie: Is there a WebGL implementation that allows importing dmabufs?
14:31 K900: Company: No you're not?
14:32 DemiMarie: On further thought, I think I can trust wlroots in the guest to not try to stall the host proxy forever, because the consequences of such a stall are limited to in-guest denial of service. Other guests won’t be affected.
14:33 DemiMarie: So the guest would only be hurting itself, which is allowed.
14:33 Company: I would expect every WebGL implementation to import dmabufs
14:33 DemiMarie: Company: where?
14:33 Company: I know that in epiphany the sandboxed we process sends dmabufs to the UI process
14:34 DemiMarie: Company: interesting!
14:34 Company: I mean, the web process needs to create a backbuffer for the webpage using WebGL
14:35 Company: and it needs to get that backbuffer to the screen somehow
14:35 DemiMarie: In Firefox and Chrome there is a separate GPU process, but it is global, which is worse.
14:35 Company: which ultimately means it's gonna travel as a dmabuf over Wayland
14:35 DemiMarie: That's export only, or did I make a mistake?
14:36 Company: somebody is gonna import it
14:36 DemiMarie: Compositor
14:36 Company: right
14:36 Company: so that's worse than your idea
14:37 DemiMarie: Is there a database of how to validate dmabuf params, like there is for shm buffers? Or is it the thousands of lines of code in Mesa?
14:38 Company: there is no database that I know of
14:39 DemiMarie: 😞
14:39 Company: I treat dmabufs as a black box and hand all the fds and the attributes from one side to the other
14:39 Company: and just hope it works
14:40 DemiMarie: That works so long as one trusts Mesa to properly validate parameters.
14:41 Company: if it doesn't, I can just file a bug and wait for it to get fixed
14:42 Company: because my code is not a security boundary :)
14:45 DemiMarie: The parts dealing with sandboxed WebKitGTK+ renderers are, if you do that.
14:50 Company: that's the job of webkit-gtk, not mine
14:51 DemiMarie: Fair
14:52 DemiMarie: Is it okay for me to enable desktop OpenGL instead of OpenGL ES?
14:53 Company: GTK uses GLES beccause it (a) has some extensions that GL proper doesn't have and (b) has less undefined behavior
14:53 DemiMarie: Does it have weaker or stronger guarantees around robust access.
14:53 DemiMarie: ?
14:54 Company: no idea, I've not looked at that
14:55 Company: mainly, GLES is better at defining how operations are performed, which ones have to be supported and which ones are optional and stuff like that
14:55 DemiMarie: Do you use robust access?
14:56 DemiMarie: Anyway this is getting offtopic.
14:56 Company: I don't think we enable it, but I'd have to check
14:58 DemiMarie: Conclusion: I will use OpenGL (probably ES) on the host, and whatever wlroots does in the guest.
15:00 Company: i'd try to write code against GLES, usually that makes it portable to GL proper
15:00 Company: not necessarily the other way
15:00 Company: or said differently: it's way easier to port from GLES to GL than from GL to GLES
18:18 Lynne: my third favorite aspect of the vulkan spec is how each function has reverse endianess so you cannot simply search for it in the spec
18:19 Lynne: vkGetDescriptorSetLayoutSize vs vkDescriptorSetLayoutSizeGet