d3d12: Only support DXGI and GDI APIs on Windows

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937>
This commit is contained in:
Jesse Natalie
2020-12-08 10:58:16 -08:00
committed by Marge Bot
parent ed286325a0
commit ee4c80f77d
3 changed files with 9 additions and 1 deletions

View File

@@ -32,8 +32,10 @@ typedef struct _LUID LUID;
extern "C" {
#endif
#ifdef _WIN32
struct pipe_screen *
d3d12_create_dxgi_screen(struct sw_winsys *winsys, LUID *adapter_luid);
#endif
struct pipe_screen *
d3d12_create_dxcore_screen(struct sw_winsys *winsys, LUID *adapter_luid);

View File

@@ -633,9 +633,12 @@ d3d12_flush_frontbuffer(struct pipe_screen * pscreen,
winsys->displaytarget_unmap(winsys, res->dt);
}
#ifdef _WIN32
// WindowFromDC is Windows-only, and this method requires an HWND, so only use it on Windows
ID3D12SharingContract *sharing_contract;
if (SUCCEEDED(screen->cmdqueue->QueryInterface(IID_PPV_ARGS(&sharing_contract))))
sharing_contract->Present(d3d12_res, 0, WindowFromDC((HDC)winsys_drawable_handle));
#endif
winsys->displaytarget_display(winsys, res->dt, winsys_drawable_handle, sub_box);
}

View File

@@ -28,7 +28,6 @@ files_libd3d12 = files(
'd3d12_descriptor_pool.cpp',
'd3d12_draw.cpp',
'd3d12_dxcore_screen.cpp',
'd3d12_dxgi_screen.cpp',
'd3d12_fence.cpp',
'd3d12_format.c',
'd3d12_gs_variant.cpp',
@@ -45,6 +44,10 @@ files_libd3d12 = files(
'd3d12_surface.cpp',
)
if host_machine.system() == 'windows'
files_libd3d12 += files('d3d12_dxgi_screen.cpp')
endif
libd3d12 = static_library(
'd3d12',
files_libd3d12,