Skip to content

mesa, gallium, d3d12: Support EXT_external_objects_win32

Jesse Natalie requested to merge jenatali/mesa:d3d12-external-objects into main

The goal of this MR is to have the d3d12 driver supporting EXT_external_objects_win32. Fortunately, zink paved the way a few months back. Unfortunately, it's not complete. Still missing from the core state tracker:

  • Import by name
  • Importing D3D11 and D3D12 objects explicitly instead of just opaque handles
  • Importing D3D12 fences, which have a value associated with them like Vulkan timeline semaphores
    • I implemented these under the name "timeline semaphore" with the expectation that Mesa can start to support the NV extension for using them natively in GL too

There's also the KMT handle importing... but I don't think any Mesa driver is ever going to support that, so I didn't plumb it yet.

I opportunistically plumbed name import for zink semaphores, but name importing for resources was harder due to the fact that memobj import is just a DuplicateHandle. I guess it could strcpy the name if there is one, but I'll leave that to someone else.

Then the d3d12 driver gets a bunch of patches to actually hook up memobj importing, which can support both arbitrary memory (aka "heaps" in D3D12 parlance) or dedicated resources, and to hook up semaphore/fence importing.

Tested with piglit!704 which ports all of the existing Vulkan/Fd piglits to add D3D12/Win32 versions, including tests for the fence value behavior and import by name for both memory and semaphore objects.

Edited by Jesse Natalie

Merge request reports