documentation on Vulkan/WebGPU

371 views
Skip to first unread message

Rik Cabanier

unread,
Jan 2, 2024, 1:01:05 PMJan 2
to Graphics-dev
All,

is there any documentation on the differences between the Vulkan and OpenGL backends in Chromium? Maybe there are blinkon talks?
Also, how is WebGPU implemented? I assume it requires Vulkan?

I work on the Quest browser and as an experiment, I enabled Vulkan and WebGPU. This is working as expected, but surprisingly, our OpenGL WebXR implementation also still works. How is this possible?

Brandon Jones

unread,
Jan 2, 2024, 1:42:31 PMJan 2
to Rik Cabanier, Graphics-dev
There is a Vulkan backend for ANGLE which could power WebGL, but my understanding is that it's not enabled by default yet (though your combination of flags may have done so?).

Assuming that your build is not using WebGL-via-Vulkan, however, Skia can still use a Vulkan backend independently and in that case there's some interop that is already set up between WebGL's surfaces and Skia's compositor. I don't know the details but it's probably done via EGLImage -> AHardwareBuffer -> VK_ANDROID_external_memory_android_hardware_buffer.

--Brandon

--
To unsubscribe from this group and stop receiving emails from it, send an email to graphics-dev...@chromium.org.

Rik Cabanier

unread,
Jan 2, 2024, 2:01:26 PMJan 2
to Graphics-dev, baj...@google.com, Graphics-dev, Rik Cabanier
On Tuesday, January 2, 2024 at 10:42:31 AM UTC-8 baj...@google.com wrote:
There is a Vulkan backend for ANGLE which could power WebGL, but my understanding is that it's not enabled by default yet (though your combination of flags may have done so?).

Correct. I have been experimenting with that as well. If I go that route, I have to update the OpenXR code to Vulkan.
The fact that I don't need to do this, tells me that everything is still going through OpenGL in the GPU process.
 
Assuming that your build is not using WebGL-via-Vulkan, however, Skia can still use a Vulkan backend independently and in that case there's some interop that is already set up between WebGL's surfaces and Skia's compositor. I don't know the details but it's probably done via EGLImage -> AHardwareBuffer -> VK_ANDROID_external_memory_android_hardware_buffer.

Ah. So if the vulkan backend is turned on (and WebGPU as well?), there's a bypass to draw vulkan into a buffer that's backed by OpenGL? If so, that would be very cool :-)

Brandon Jones

unread,
Jan 2, 2024, 2:11:55 PMJan 2
to Rik Cabanier, Graphics-dev
On Tue, Jan 2, 2024 at 11:01 AM Rik Cabanier <caba...@gmail.com> wrote:

Ah. So if the vulkan backend is turned on (and WebGPU as well?), there's a bypass to draw vulkan into a buffer that's backed by OpenGL? If so, that would be very cool :-)

Actually, I was describing the other way around, where an image rendered by OpenGL is exported into Vulkan for compositing with Skia. But yeah, there should be facilities for it to go either way.

And it's not necessarily tied to WebGPU. I *think* Skia-on-Vulkan is what you're enabling when you "Enable Vulkan" on Android.

--Brandon

Rik Cabanier

unread,
Jan 2, 2024, 2:32:27 PMJan 2
to Graphics-dev, baj...@google.com, Graphics-dev, Rik Cabanier
On Tuesday, January 2, 2024 at 11:11:55 AM UTC-8 baj...@google.com wrote:
On Tue, Jan 2, 2024 at 11:01 AM Rik Cabanier <caba...@gmail.com> wrote:

Ah. So if the vulkan backend is turned on (and WebGPU as well?), there's a bypass to draw vulkan into a buffer that's backed by OpenGL? If so, that would be very cool :-)

Actually, I was describing the other way around, where an image rendered by OpenGL is exported into Vulkan for compositing with Skia. But yeah, there should be facilities for it to go either way.

I see. Is this how WebGL works then? Not by putting Angle in front of it but by transforming a Vulkan texture to OpenGL?
 
And it's not necessarily tied to WebGPU. I *think* Skia-on-Vulkan is what you're enabling when you "Enable Vulkan" on Android.

Do you know where this is documented? 

Rik Cabanier

unread,
Jan 3, 2024, 7:07:39 PMJan 3
to Graphics-dev, baj...@google.com, Graphics-dev, Rik Cabanier
I found a diagram here: https://chromium.googlesource.com/chromium/src/+/main/docs/security/research/graphics/overview.md
but it doesn't make it clear how this is working. Is the pinkish block at the bottom where the opengl texture is transferred to Vulkan?

When I enable WebGPU, chrome://gpu states that it is using Vulkan as the backend for Dawn. 

On Tuesday, January 2, 2024 at 11:11:55 AM UTC-8 baj...@google.com wrote:
Reply all
Reply to author
Forward
0 new messages