vrclient: Use Vulkan unwrappers for IVRCompositor::Submit

This commit is contained in:
Andrew Eikum 2018-04-11 09:59:14 -05:00
parent f83a2f393c
commit 73ba2b3471
3 changed files with 65 additions and 1 deletions

View File

@ -188,6 +188,17 @@ typedef enum ETextureType
TextureType_DirectX12 = 4, // Handle is a pointer to a D3D12TextureData_t structure
} ETextureType;
struct VRVulkanTextureData_t
{
uint64_t m_nImage; // VkImage
VkDevice_T *m_pDevice;
VkPhysicalDevice_T *m_pPhysicalDevice;
VkInstance_T *m_pInstance;
VkQueue_T *m_pQueue;
uint32_t m_nQueueFamilyIndex;
uint32_t m_nWidth, m_nHeight, m_nFormat, m_nSampleCount;
};
typedef struct Texture_t
{
void *handle;

View File

@ -138,6 +138,31 @@ void *CDECL VRClientCoreFactory(const char *name, int *return_code)
return create_win_interface(name, vrclient_VRClientCoreFactory(name, return_code));
}
static VkDevice_T *(WINAPI *get_native_VkDevice)(VkDevice_T *);
static VkInstance_T *(WINAPI *get_native_VkInstance)(VkInstance_T *);
static VkPhysicalDevice_T *(WINAPI *get_native_VkPhysicalDevice)(VkPhysicalDevice_T *);
static VkQueue_T *(WINAPI *get_native_VkQueue)(VkQueue_T *);
static void load_vk_unwrappers(void)
{
static HMODULE h = NULL;
if(h)
/* already loaded */
return;
h = LoadLibraryA("winevulkan");
if(!h){
ERR("unable to load winevulkan\n");
return;
}
get_native_VkDevice = (void*)GetProcAddress(h, "__wine_get_native_VkDevice");
get_native_VkInstance = (void*)GetProcAddress(h, "__wine_get_native_VkInstance");
get_native_VkPhysicalDevice = (void*)GetProcAddress(h, "__wine_get_native_VkPhysicalDevice");
get_native_VkQueue = (void*)GetProcAddress(h, "__wine_get_native_VkQueue");
}
void get_dxgi_output_info(void *cpp_func, void *linux_side,
int32_t *adapter_idx, unsigned int version)
{
@ -325,6 +350,34 @@ EVRCompositorError ivrcompositor_submit(
wine_texture->lpVtbl->Release(wine_texture);
return 0;
case TextureType_Vulkan:
{
struct VRVulkanTextureData_t our_vkdata, *their_vkdata;
Texture_t our_texture;
if (flags & (Submit_TextureWithPose | Submit_TextureWithDepth))
{
FIXME("Submit with pose or depth is not supported.\n");
flags &= ~(Submit_TextureWithPose | Submit_TextureWithDepth);
}
load_vk_unwrappers();
their_vkdata = (struct VRVulkanTextureData_t*)texture->handle;
our_vkdata = *their_vkdata;
our_vkdata.m_pDevice = get_native_VkDevice(our_vkdata.m_pDevice);
our_vkdata.m_pPhysicalDevice = get_native_VkPhysicalDevice(our_vkdata.m_pPhysicalDevice);
our_vkdata.m_pInstance = get_native_VkInstance(our_vkdata.m_pInstance);
our_vkdata.m_pQueue = get_native_VkQueue(our_vkdata.m_pQueue);
our_texture = *texture;
our_texture.handle = &our_vkdata;
return cpp_func(linux_side, eye, &our_texture, bounds, flags);
}
default:
return cpp_func(linux_side, eye, texture, bounds, flags);
}

2
wine

@ -1 +1 @@
Subproject commit abba0d9d3b7807c340d32a99f15b31c06afc65bf
Subproject commit 1b8c5cf02b12c586f7a3a98530f25300113a8a5d