vrclient: Factor out ivrcompositor_submit_wined3d().

This commit is contained in:
Józef Kucia 2018-09-10 17:14:55 +02:00 committed by Andrew Eikum
parent 3f2b30d351
commit 66e149f87f

View File

@ -500,34 +500,16 @@ static void *get_our_compositor(void)
return our_compositor;
}
EVRCompositorError ivrcompositor_submit(
static EVRCompositorError ivrcompositor_submit_wined3d(
EVRCompositorError (*cpp_func)(void *, EVREye, Texture_t *, VRTextureBounds_t *, EVRSubmitFlags),
void *linux_side, EVREye eye, Texture_t *texture, VRTextureBounds_t *bounds, EVRSubmitFlags flags,
unsigned int version, struct compositor_data *user_data)
unsigned int version, struct compositor_data *user_data, IWineD3D11Texture2D *wine_texture)
{
IWineD3D11Texture2D *wine_texture;
IWineD3D11Device *wined3d_device;
struct submit_data submit_data;
IUnknown *texture_iface, *depth_texture = NULL;
IUnknown *depth_texture = NULL;
ID3D11Device *device;
HRESULT hr;
#if !defined(__APPLE__) || defined(__x86_64__)
IDXGIVkInteropSurface *dxvk_surface;
IDXGIVkInteropDevice *dxvk_device;
#endif
TRACE("%p, %#x, %p, %p, %#x\n", linux_side, eye, texture, bounds, flags);
switch (texture->eType)
{
case TextureType_DirectX:
{
TRACE("D3D11\n");
texture_iface = texture->handle;
hr = texture_iface->lpVtbl->QueryInterface(texture_iface,
&IID_IWineD3D11Texture2D, (void **)&wine_texture);
if (SUCCEEDED(hr)) {
wine_texture->lpVtbl->GetDevice(wine_texture, &device);
if (user_data->d3d11_device != device)
@ -574,7 +556,8 @@ EVRCompositorError ivrcompositor_submit(
submit_data.linux_side = linux_side;
submit_data.submit = cpp_func;
submit_data.eye = eye;
switch(flags & (Submit_TextureWithPose | Submit_TextureWithDepth)){
switch (flags & (Submit_TextureWithPose | Submit_TextureWithDepth))
{
case 0:
submit_data.texture = *texture;
break;
@ -600,6 +583,36 @@ EVRCompositorError ivrcompositor_submit(
return 0;
}
EVRCompositorError ivrcompositor_submit(
EVRCompositorError (*cpp_func)(void *, EVREye, Texture_t *, VRTextureBounds_t *, EVRSubmitFlags),
void *linux_side, EVREye eye, Texture_t *texture, VRTextureBounds_t *bounds, EVRSubmitFlags flags,
unsigned int version, struct compositor_data *user_data)
{
IWineD3D11Texture2D *wine_texture;
IUnknown *texture_iface;
HRESULT hr;
#if !defined(__APPLE__) || defined(__x86_64__)
IDXGIVkInteropSurface *dxvk_surface;
IDXGIVkInteropDevice *dxvk_device;
#endif
TRACE("%p, %#x, %p, %p, %#x\n", linux_side, eye, texture, bounds, flags);
switch (texture->eType)
{
case TextureType_DirectX:
{
TRACE("D3D11\n");
texture_iface = texture->handle;
if (SUCCEEDED(hr = texture_iface->lpVtbl->QueryInterface(texture_iface,
&IID_IWineD3D11Texture2D, (void **)&wine_texture)))
{
return ivrcompositor_submit_wined3d(cpp_func, linux_side,
eye, texture, bounds, flags, version, user_data, wine_texture);
}
#if !defined(__APPLE__) || defined(__x86_64__)
hr = texture_iface->lpVtbl->QueryInterface(texture_iface,
&IID_IDXGIVkInteropSurface, (void **)&dxvk_surface);