Skip to content

Commit

Permalink
[d3d9] Mockup device import API
Browse files Browse the repository at this point in the history
  • Loading branch information
AlpyneDreams committed Nov 29, 2024
1 parent 218b67d commit c417297
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions src/d3d9/d3d9_interfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@
#include "d3d9_include.h"
#include "../vulkan/vulkan_loader.h"

using D3D9VkExtQueueLockCallback = void(bool);

/**
* \brief Device import info
*/
struct D3D9VkExtDeviceImportInfo {
VkDevice device;
VkQueue graphicsQueue;
uint32_t graphicsQueueFamily;
VkQueue transferQueue;
uint32_t transferQueueFamily;
VkQueue sparseQueue;
uint32_t sparseQueueFamily;
uint32_t extensionCount;
const char** extensionNames;
const VkPhysicalDeviceFeatures2* features;
D3D9VkExtQueueLockCallback* queueLockCallback;
};


/**
* \brief D3D9 interface for Vulkan interop
*
Expand All @@ -28,6 +48,39 @@ ID3D9VkInteropInterface : public IUnknown {
virtual void STDMETHODCALLTYPE GetPhysicalDeviceHandle(
UINT Adapter,
VkPhysicalDevice* pPhysicalDevice) = 0;

/**
* \brief Gets the VkDeviceCreateInfo for a D3D9 adapter
*
* \param [in] Adapter Adapter ordinal
* \param [in] ... Arguments to IDirect3D9Ex::CreateDeviceEx
* \param [out] ppCreateInfo The Vulkan device create info
*/
virtual HRESULT GetDeviceCreateInfo(
UINT Adapter,
D3DDEVTYPE DeviceType,
HWND hFocusWindow,
DWORD BehaviorFlags,
D3DPRESENT_PARAMETERS* pPresentationParameters,
D3DDISPLAYMODEEX* pFullscreenDisplayMode,
VkDeviceCreateInfo** ppCreateInfo) = 0;

/**
* \brief Create a D3D9 device for an existing Vulkan device
*
* It is suggested to create the device with the
* VkDeviceCreateInfo returned by GetDeviceCreateInfo,
* which will specify everything the device needs for
* DXVK to function.
*
* \param [in] Adapter Adapter ordinal
* \param [in] pInfo Info about the created device
* \param [out] ppReturnedDevice The D3D9 device
*/
virtual HRESULT ImportDevice(
UINT Adapter,
D3D9VkExtDeviceImportInfo* pInfo,
IDirect3DDevice9Ex** ppReturnedDevice) = 0;
};

/**
Expand Down

0 comments on commit c417297

Please sign in to comment.