2020-12-30 20:35:28 +01:00
|
|
|
#include "openxr_thunks.h"
|
|
|
|
|
|
|
|
#include "wine/list.h"
|
|
|
|
|
2024-01-19 19:57:23 +01:00
|
|
|
#define SESSION_TYPE_VULKAN 1
|
|
|
|
#define SESSION_TYPE_OPENGL 2
|
|
|
|
#define SESSION_TYPE_D3D11 3
|
|
|
|
#define SESSION_TYPE_D3D12 4
|
2020-12-30 20:35:28 +01:00
|
|
|
|
|
|
|
struct IDXGIVkInteropDevice2;
|
|
|
|
typedef struct IDXGIVkInteropDevice2 IDXGIVkInteropDevice2;
|
2024-05-09 23:35:09 +02:00
|
|
|
typedef struct ID3D12DXVKInteropDevice ID3D12DXVKInteropDevice;
|
|
|
|
|
|
|
|
#define VK_PROCS \
|
|
|
|
X(vkAllocateCommandBuffers) \
|
|
|
|
X(vkBeginCommandBuffer) \
|
|
|
|
X(vkEndCommandBuffer) \
|
|
|
|
X(vkQueueSubmit) \
|
|
|
|
X(vkQueueWaitIdle) \
|
|
|
|
X(vkFreeCommandBuffers) \
|
|
|
|
X(vkCmdPipelineBarrier) \
|
|
|
|
X(vkCreateCommandPool) \
|
|
|
|
X(vkDestroyCommandPool) \
|
|
|
|
X(vkDestroyFence) \
|
|
|
|
X(vkCreateFence) \
|
|
|
|
X(vkWaitForFences) \
|
|
|
|
X(vkResetFences)
|
2020-12-30 20:35:28 +01:00
|
|
|
|
|
|
|
typedef struct wine_XrInstance {
|
|
|
|
XrInstance instance;
|
|
|
|
struct openxr_instance_funcs funcs;
|
|
|
|
|
|
|
|
VkInstance vk_instance;
|
|
|
|
VkPhysicalDevice vk_phys_dev;
|
|
|
|
|
|
|
|
XrSystemId systemId;
|
|
|
|
|
|
|
|
IDXGIVkInteropDevice2 *dxvk_device;
|
2024-05-09 23:29:00 +02:00
|
|
|
ID3D12DXVKInteropDevice *d3d12_device;
|
|
|
|
ID3D12CommandQueue *d3d12_queue;
|
|
|
|
|
2024-05-09 23:35:09 +02:00
|
|
|
/* For layout transitions for vkd3d-proton */
|
|
|
|
#define X(proc) PFN_##proc p_##proc;
|
|
|
|
VK_PROCS
|
|
|
|
#undef X
|
2024-05-09 23:29:00 +02:00
|
|
|
VkDevice vk_device;
|
|
|
|
VkQueue vk_queue;
|
2024-05-09 23:35:09 +02:00
|
|
|
VkCommandPool vk_command_pool;
|
2020-12-30 20:35:28 +01:00
|
|
|
} wine_XrInstance;
|
|
|
|
|
|
|
|
union CompositionLayer;
|
|
|
|
typedef union CompositionLayer CompositionLayer;
|
|
|
|
|
2021-12-28 16:01:20 +01:00
|
|
|
typedef union
|
|
|
|
{
|
|
|
|
XrCompositionLayerDepthInfoKHR depth_info;
|
|
|
|
XrCompositionLayerSpaceWarpInfoFB space_warp_info;
|
|
|
|
} view_info;
|
|
|
|
|
2020-12-30 20:35:28 +01:00
|
|
|
typedef struct wine_XrSession {
|
|
|
|
XrSession session;
|
|
|
|
struct wine_XrInstance *wine_instance;
|
|
|
|
|
2024-01-19 19:57:23 +01:00
|
|
|
uint32_t session_type;
|
2020-12-30 20:35:28 +01:00
|
|
|
struct list entry;
|
|
|
|
|
|
|
|
uint32_t composition_layer_count;
|
|
|
|
CompositionLayer *composition_layers;
|
|
|
|
XrCompositionLayerBaseHeader **composition_layer_ptrs;
|
|
|
|
|
2021-12-28 16:01:20 +01:00
|
|
|
uint32_t projection_view_count, view_info_count;
|
2020-12-30 20:35:28 +01:00
|
|
|
XrCompositionLayerProjectionView *projection_views;
|
2021-12-28 16:01:20 +01:00
|
|
|
view_info *view_infos;
|
2020-12-30 20:35:28 +01:00
|
|
|
} wine_XrSession;
|
|
|
|
|
|
|
|
typedef struct wine_XrSwapchain{
|
|
|
|
XrSwapchain swapchain;
|
2024-05-08 16:11:24 +02:00
|
|
|
XrSwapchainImageBaseHeader *images;
|
|
|
|
uint32_t image_count;
|
2024-05-09 23:35:09 +02:00
|
|
|
uint32_t acquired_count, acquired_start;
|
|
|
|
BOOL *acquired;
|
|
|
|
uint32_t *acquired_indices;
|
2020-12-30 20:35:28 +01:00
|
|
|
struct wine_XrSession *wine_session;
|
|
|
|
|
|
|
|
XrSwapchainCreateInfo create_info;
|
2024-05-09 23:35:09 +02:00
|
|
|
VkCommandBuffer *cmd_release;
|
|
|
|
VkCommandBuffer *cmd_acquire;
|
2020-12-30 20:35:28 +01:00
|
|
|
} wine_XrSwapchain;
|
|
|
|
|
|
|
|
struct openxr_func {
|
|
|
|
const char *name;
|
|
|
|
void *func;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern void *wine_xr_proc_addr(const char *name);
|
|
|
|
|
|
|
|
extern XrResult WINAPI wine_xrEnumerateInstanceExtensionProperties(const char *layerName,
|
|
|
|
uint32_t propertyCapacityInput, uint32_t *propertyCountOutput, XrExtensionProperties *properties);
|
|
|
|
extern XrResult WINAPI wine_xrConvertTimeToWin32PerformanceCounterKHR(XrInstance instance,
|
|
|
|
XrTime time, LARGE_INTEGER *performanceCounter);
|
|
|
|
extern XrResult WINAPI wine_xrConvertWin32PerformanceCounterToTimeKHR(XrInstance instance,
|
|
|
|
const LARGE_INTEGER *performanceCounter, XrTime *time);
|
|
|
|
extern XrResult WINAPI wine_xrGetD3D11GraphicsRequirementsKHR(XrInstance instance,
|
|
|
|
XrSystemId systemId, XrGraphicsRequirementsD3D11KHR *graphicsRequirements);
|
|
|
|
extern XrResult WINAPI wine_xrGetD3D12GraphicsRequirementsKHR(XrInstance instance,
|
|
|
|
XrSystemId systemId, XrGraphicsRequirementsD3D12KHR *graphicsRequirements);
|
|
|
|
|
2023-12-28 23:51:10 +01:00
|
|
|
extern VkDevice (*get_native_VkDevice)(VkDevice);
|
|
|
|
extern VkInstance (*get_native_VkInstance)(VkInstance);
|
|
|
|
extern VkPhysicalDevice (*get_native_VkPhysicalDevice)(VkPhysicalDevice);
|
|
|
|
extern VkPhysicalDevice (*get_wrapped_VkPhysicalDevice)(VkInstance, VkPhysicalDevice);
|
|
|
|
extern VkQueue (*get_native_VkQueue)(VkQueue);
|
2020-12-30 20:35:28 +01:00
|
|
|
extern XrResult load_host_openxr_loader(void);
|
2024-04-20 03:25:34 +02:00
|
|
|
|
|
|
|
extern void register_dispatchable_handle(uint64_t handle, struct openxr_instance_funcs *funcs);
|
|
|
|
extern void unregister_dispatchable_handle(uint64_t handle);
|
|
|
|
extern struct openxr_instance_funcs *get_dispatch_table(uint64_t handle);
|