gallium/dri: Add D3D12 software driver option

This lets you use GALLIUM_DRIVER=d3d12 to choose the d3d12
backend with a software winsys.

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-07 13:19:58 -08:00 committed by Marge Bot
parent eb4353838d
commit 0507da62c4
4 changed files with 29 additions and 2 deletions

View file

@ -27,6 +27,10 @@
#include "virgl/vtest/virgl_vtest_public.h"
#endif
#ifdef GALLIUM_D3D12
#include "d3d12/d3d12_public.h"
#endif
static inline struct pipe_screen *
sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
{
@ -60,6 +64,11 @@ sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
screen = zink_create_screen(winsys);
#endif
#if defined(GALLIUM_D3D12)
if (screen == NULL && strcmp(driver, "d3d12") == 0)
screen = d3d12_create_dxcore_screen(winsys, NULL);
#endif
return screen;
}
@ -78,6 +87,8 @@ sw_screen_create(struct sw_winsys *winsys)
default_driver = "swr";
#elif defined(GALLIUM_ZINK)
default_driver = "zink";
#elif defined(GALLIUM_D3D12)
default_driver = "d3d12";
#else
default_driver = "";
#endif

View file

@ -16,6 +16,10 @@
#include "zink/zink_public.h"
#endif
#ifdef GALLIUM_D3D12
#include "d3d12/d3d12_public.h"
#endif
#ifdef GALLIUM_SOFTPIPE
#include "softpipe/sp_public.h"
#endif
@ -66,6 +70,11 @@ sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
screen = zink_create_screen(winsys);
#endif
#if defined(GALLIUM_D3D12)
if (screen == NULL && strcmp(driver, "d3d12") == 0)
screen = d3d12_create_dxcore_screen(winsys, NULL);
#endif
return screen;
}
@ -84,6 +93,8 @@ sw_screen_create(struct sw_winsys *winsys)
default_driver = "swr";
#elif defined(GALLIUM_ZINK)
default_driver = "zink";
#elif defined(GALLIUM_D3D12)
default_driver = "d3d12";
#else
default_driver = "";
#endif

View file

@ -57,7 +57,7 @@ libgallium_dri = shared_library(
driver_swrast, driver_r300, driver_r600, driver_radeonsi, driver_nouveau,
driver_kmsro, driver_v3d, driver_vc4, driver_freedreno, driver_etnaviv,
driver_tegra, driver_i915, driver_svga, driver_virgl,
driver_swr, driver_panfrost, driver_iris, driver_lima, driver_zink
driver_swr, driver_panfrost, driver_iris, driver_lima, driver_zink, driver_d3d12
],
# Will be deleted during installation, see install_megadrivers.py
install : true,
@ -104,7 +104,8 @@ foreach d : [[with_gallium_kmsro, [
[with_gallium_svga, 'vmwgfx_dri.so'],
[with_gallium_virgl, 'virtio_gpu_dri.so'],
[with_gallium_lima, 'lima_dri.so'],
[with_gallium_zink, 'zink_dri.so']]
[with_gallium_zink, 'zink_dri.so'],
[with_gallium_d3d12, 'd3d12_dri.so']]
if d[0]
gallium_dri_drivers += d[1]
endif

View file

@ -121,3 +121,7 @@ DEFINE_LOADER_DRM_ENTRYPOINT(lima)
#if defined(GALLIUM_ZINK)
DEFINE_LOADER_DRM_ENTRYPOINT(zink);
#endif
#if defined(GALLIUM_D3D12)
DEFINE_LOADER_DRM_ENTRYPOINT(d3d12);
#endif