0
\$\begingroup\$

Most objects in DirectX 12 have natural analogues in Vulkan, e.g.

  • VkInstance = IDXGIFactory
  • VkPhysicalDevice = IDXGIAdapter
  • VkDevice = ID3D12Device
  • VkQueue = ID3D12CommandQueue
  • VkCommandBuffer = ID3D12CommandList

However, when it comes to the swap chain, it's not clear how the entries in VkSwapchainCreateInfoKHR correspond to entries in DXGI_SWAP_CHAIN_DESC1.

Clearly, there is not always a 1-1 correspondence, but I would really like to know how I can implement a unified interface for both.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

The whole point of APIs like DirectX 12 and Vulkan is to minimize CPU overhead, and therefore they have extremely thin API abstractions. As such, wrapping them in a low-level API basically defeats their whole purpose.

Furthermore, both DirectX 12 and Vulkan expose more of the underlying hardware behavior, so again by design the application needs to have a lot more context about the overall API usage than older graphics API designs.

As such, if you want to implement both a DirectX 12 and Vulkan version of the same application or engine, then you want to create higher-level abstractions. Not "a function to create a swap chain" but "code module to manage the display/output window/system message loop".

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .