vrclient: Use Vulkan unwrappers in IVRSystem::GetOutputDevice

This commit is contained in:
Andrew Eikum 2018-04-11 11:03:38 -05:00
parent f386e16db8
commit 5aa155edb2
4 changed files with 55 additions and 3 deletions

View file

@ -127,6 +127,12 @@ def ivrsystem_get_dxgi_output_info(cppname, method):
2: "get_dxgi_output_info2"
}.get(param_count, "unhandled_get_dxgi_output_info_method")
def ivrsystem_get_output_device(cppname, method):
#introduced in 016, changed in 017
if "016" in cppname:
return "ivrsystem_016_get_output_device"
return "ivrsystem_get_output_device"
def ivrcompositor_submit(cppname, method):
if "005" in cppname:
return "ivrcompositor_005_submit"
@ -152,6 +158,7 @@ def ivrcompositor_get_vulkan_device_extensions_required(cppname, method):
method_overrides = [
("IVRSystem", "GetDXGIOutputInfo", ivrsystem_get_dxgi_output_info),
("IVRSystem", "GetOutputDevice", ivrsystem_get_output_device),
("IVRCompositor", "Submit", ivrcompositor_submit),
("IVRCompositor", "PostPresentHandoff", ivrcompositor_post_present_handoff),
("IVRCompositor", "WaitGetPoses", ivrcompositor_wait_get_poses),

View file

@ -141,6 +141,7 @@ void *CDECL VRClientCoreFactory(const char *name, int *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 VkPhysicalDevice_T *(WINAPI *get_wrapped_VkPhysicalDevice)(VkInstance_T *, VkPhysicalDevice_T *);
static VkQueue_T *(WINAPI *get_native_VkQueue)(VkQueue_T *);
static void load_vk_unwrappers(void)
@ -160,6 +161,7 @@ static void load_vk_unwrappers(void)
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_wrapped_VkPhysicalDevice = (void*)GetProcAddress(h, "__wine_get_wrapped_VkPhysicalDevice");
get_native_VkQueue = (void*)GetProcAddress(h, "__wine_get_native_VkQueue");
}
@ -178,6 +180,41 @@ void get_dxgi_output_info2(void *cpp_func, void *linux_side,
*output_idx = 0;
}
void ivrsystem_016_get_output_device(
void (*cpp_func)(void *, uint64_t *, ETextureType),
void *linux_side, uint64_t *out_device, ETextureType type,
unsigned int version)
{
cpp_func(linux_side, out_device, type);
}
void ivrsystem_get_output_device(
void (*cpp_func)(void *, uint64_t *, ETextureType, VkInstance_T *),
void *linux_side, uint64_t *out_device, ETextureType type,
VkInstance_T *wrapped_instance, unsigned int version)
{
switch(type){
case TextureType_Vulkan:
{
VkInstance_T *native_instance;
load_vk_unwrappers();
native_instance = get_native_VkInstance(wrapped_instance);
cpp_func(linux_side, out_device, type, native_instance);
*out_device = (uint64_t)(intptr_t)get_wrapped_VkPhysicalDevice(wrapped_instance,
(VkPhysicalDevice_T *)(intptr_t)*out_device);
return;
}
default:
cpp_func(linux_side, out_device, type, wrapped_instance);
return;
}
}
struct submit_data
{
void *linux_side;

View file

@ -48,6 +48,14 @@ void get_dxgi_output_info(void *cpp_func, void *linux_side,
int32_t *adapter_idx, unsigned int version);
void get_dxgi_output_info2(void *cpp_func, void *linux_side,
int32_t *adapter_idx, int32_t *output_idx, unsigned int version);
void ivrsystem_016_get_output_device(
void (*cpp_func)(void *, uint64_t *, ETextureType),
void *linux_side, uint64_t *out_device, ETextureType type,
unsigned int version);
void ivrsystem_get_output_device(
void (*cpp_func)(void *, uint64_t *, ETextureType, VkInstance_T *),
void *linux_side, uint64_t *out_device, ETextureType type,
VkInstance_T *wrapped_instance, unsigned int version);
void ivrcompositor_005_submit(
void (*cpp_func)(void *, Hmd_Eye, void *, Compositor_TextureBounds *),

View file

@ -85,7 +85,7 @@ DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_019_GetOutputDevice, 24)
void __thiscall winIVRSystem_IVRSystem_019_GetOutputDevice(winIVRSystem_IVRSystem_019 *_this, uint64_t * pnDevice, ETextureType textureType, VkInstance_T * pInstance)
{
TRACE("%p\n", _this);
cppIVRSystem_IVRSystem_019_GetOutputDevice(_this->linux_side, pnDevice, textureType, pInstance);
ivrsystem_get_output_device(cppIVRSystem_IVRSystem_019_GetOutputDevice, _this->linux_side, pnDevice, textureType, pInstance, 19);
}
DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_019_IsDisplayOnDesktop, 4)
@ -494,7 +494,7 @@ DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_017_GetOutputDevice, 24)
void __thiscall winIVRSystem_IVRSystem_017_GetOutputDevice(winIVRSystem_IVRSystem_017 *_this, uint64_t * pnDevice, ETextureType textureType, VkInstance_T * pInstance)
{
TRACE("%p\n", _this);
cppIVRSystem_IVRSystem_017_GetOutputDevice(_this->linux_side, pnDevice, textureType, pInstance);
ivrsystem_get_output_device(cppIVRSystem_IVRSystem_017_GetOutputDevice, _this->linux_side, pnDevice, textureType, pInstance, 17);
}
DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_017_IsDisplayOnDesktop, 4)
@ -887,7 +887,7 @@ DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_016_GetOutputDevice, 16)
void __thiscall winIVRSystem_IVRSystem_016_GetOutputDevice(winIVRSystem_IVRSystem_016 *_this, uint64_t * pnDevice, ETextureType textureType)
{
TRACE("%p\n", _this);
cppIVRSystem_IVRSystem_016_GetOutputDevice(_this->linux_side, pnDevice, textureType);
ivrsystem_016_get_output_device(cppIVRSystem_IVRSystem_016_GetOutputDevice, _this->linux_side, pnDevice, textureType, 16);
}
DEFINE_THISCALL_WRAPPER(winIVRSystem_IVRSystem_016_IsDisplayOnDesktop, 4)