mirror of
https://github.com/ValveSoftware/Proton.git
synced 2025-04-17 14:52:37 +03:00
vrclient: Factor out ivrcompositor_submit_wined3d().
This commit is contained in:
parent
3f2b30d351
commit
66e149f87f
@ -500,34 +500,16 @@ static void *get_our_compositor(void)
|
|||||||
return our_compositor;
|
return our_compositor;
|
||||||
}
|
}
|
||||||
|
|
||||||
EVRCompositorError ivrcompositor_submit(
|
static EVRCompositorError ivrcompositor_submit_wined3d(
|
||||||
EVRCompositorError (*cpp_func)(void *, EVREye, Texture_t *, VRTextureBounds_t *, EVRSubmitFlags),
|
EVRCompositorError (*cpp_func)(void *, EVREye, Texture_t *, VRTextureBounds_t *, EVRSubmitFlags),
|
||||||
void *linux_side, EVREye eye, Texture_t *texture, VRTextureBounds_t *bounds, EVRSubmitFlags flags,
|
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;
|
IWineD3D11Device *wined3d_device;
|
||||||
struct submit_data submit_data;
|
struct submit_data submit_data;
|
||||||
IUnknown *texture_iface, *depth_texture = NULL;
|
IUnknown *depth_texture = NULL;
|
||||||
ID3D11Device *device;
|
ID3D11Device *device;
|
||||||
HRESULT hr;
|
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);
|
wine_texture->lpVtbl->GetDevice(wine_texture, &device);
|
||||||
if (user_data->d3d11_device != device)
|
if (user_data->d3d11_device != device)
|
||||||
@ -574,7 +556,8 @@ EVRCompositorError ivrcompositor_submit(
|
|||||||
submit_data.linux_side = linux_side;
|
submit_data.linux_side = linux_side;
|
||||||
submit_data.submit = cpp_func;
|
submit_data.submit = cpp_func;
|
||||||
submit_data.eye = eye;
|
submit_data.eye = eye;
|
||||||
switch(flags & (Submit_TextureWithPose | Submit_TextureWithDepth)){
|
switch (flags & (Submit_TextureWithPose | Submit_TextureWithDepth))
|
||||||
|
{
|
||||||
case 0:
|
case 0:
|
||||||
submit_data.texture = *texture;
|
submit_data.texture = *texture;
|
||||||
break;
|
break;
|
||||||
@ -583,11 +566,11 @@ EVRCompositorError ivrcompositor_submit(
|
|||||||
break;
|
break;
|
||||||
case Submit_TextureWithDepth:
|
case Submit_TextureWithDepth:
|
||||||
submit_data.texture_depth = *(VRTextureWithDepth_t *)texture;
|
submit_data.texture_depth = *(VRTextureWithDepth_t *)texture;
|
||||||
depth_texture = (IUnknown*)submit_data.texture_depth.depth.handle;
|
depth_texture = (IUnknown *)submit_data.texture_depth.depth.handle;
|
||||||
break;
|
break;
|
||||||
case Submit_TextureWithPose | Submit_TextureWithDepth:
|
case Submit_TextureWithPose | Submit_TextureWithDepth:
|
||||||
submit_data.texture_both = *(VRTextureWithPoseAndDepth_t *)texture;
|
submit_data.texture_both = *(VRTextureWithPoseAndDepth_t *)texture;
|
||||||
depth_texture = (IUnknown*)submit_data.texture_both.depth.handle;
|
depth_texture = (IUnknown *)submit_data.texture_both.depth.handle;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
submit_data.bounds = *bounds;
|
submit_data.bounds = *bounds;
|
||||||
@ -598,6 +581,36 @@ EVRCompositorError ivrcompositor_submit(
|
|||||||
wine_texture->lpVtbl->Release(wine_texture);
|
wine_texture->lpVtbl->Release(wine_texture);
|
||||||
|
|
||||||
return 0;
|
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__)
|
#if !defined(__APPLE__) || defined(__x86_64__)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user