d3d12: Add D3D12 WGL winsys
Add a winsys for code paths common to the libgl-gdi and libgl-d3d12 targets when using the D3D12 gallium driver. Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7535>
This commit is contained in:
parent
3b034e9771
commit
bb9cc7ede4
|
@ -217,10 +217,13 @@ if with_gallium_st_nine
|
||||||
endif
|
endif
|
||||||
if with_platform_windows
|
if with_platform_windows
|
||||||
subdir('frontends/wgl')
|
subdir('frontends/wgl')
|
||||||
subdir('targets/libgl-gdi')
|
|
||||||
if with_gallium_d3d12
|
if with_gallium_d3d12
|
||||||
|
subdir('winsys/d3d12/wgl')
|
||||||
subdir('targets/libgl-d3d12')
|
subdir('targets/libgl-d3d12')
|
||||||
|
else
|
||||||
|
winsys_d3d12_wgl = declare_dependency()
|
||||||
endif
|
endif
|
||||||
|
subdir('targets/libgl-gdi')
|
||||||
endif
|
endif
|
||||||
if with_tests
|
if with_tests
|
||||||
subdir('targets/graw-null')
|
subdir('targets/graw-null')
|
||||||
|
|
|
@ -36,24 +36,19 @@
|
||||||
#ifndef GALLIUM_D3D12
|
#ifndef GALLIUM_D3D12
|
||||||
#error "This file must be compiled only with the D3D12 driver"
|
#error "This file must be compiled only with the D3D12 driver"
|
||||||
#endif
|
#endif
|
||||||
#include "d3d12/d3d12_public.h"
|
#include "d3d12/wgl/d3d12_wgl_public.h"
|
||||||
|
|
||||||
static struct pipe_screen *
|
static struct pipe_screen *
|
||||||
gdi_screen_create(HDC hDC)
|
gdi_screen_create(HDC hDC)
|
||||||
{
|
{
|
||||||
struct pipe_screen *screen = NULL;
|
struct pipe_screen *screen = NULL;
|
||||||
struct sw_winsys *winsys;
|
struct sw_winsys *winsys;
|
||||||
LUID *adapter_luid = NULL, local_luid;
|
|
||||||
|
|
||||||
winsys = gdi_create_sw_winsys();
|
winsys = gdi_create_sw_winsys();
|
||||||
if(!winsys)
|
if(!winsys)
|
||||||
goto no_winsys;
|
goto no_winsys;
|
||||||
|
|
||||||
if (stw_dev && stw_dev->callbacks.pfnGetAdapterLuid) {
|
screen = d3d12_wgl_create_screen( winsys, hDC );
|
||||||
stw_dev->callbacks.pfnGetAdapterLuid(hDC, &local_luid);
|
|
||||||
adapter_luid = &local_luid;
|
|
||||||
}
|
|
||||||
screen = d3d12_create_screen( winsys, adapter_luid );
|
|
||||||
|
|
||||||
if(!screen)
|
if(!screen)
|
||||||
goto no_screen;
|
goto no_screen;
|
||||||
|
@ -72,20 +67,7 @@ gdi_present(struct pipe_screen *screen,
|
||||||
struct pipe_resource *res,
|
struct pipe_resource *res,
|
||||||
HDC hDC)
|
HDC hDC)
|
||||||
{
|
{
|
||||||
/* This will fail if any interposing layer (trace, debug, etc) has
|
d3d12_wgl_present(screen, res, hDC);
|
||||||
* been introduced between the state-trackers and the pipe driver.
|
|
||||||
*
|
|
||||||
* Ideally this would get replaced with a call to
|
|
||||||
* pipe_screen::flush_frontbuffer().
|
|
||||||
*
|
|
||||||
* Failing that, it may be necessary for intervening layers to wrap
|
|
||||||
* other structs such as this stw_winsys as well...
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct sw_winsys *winsys = NULL;
|
|
||||||
struct sw_displaytarget *dt = NULL;
|
|
||||||
|
|
||||||
screen->flush_frontbuffer(screen, res, 0, 0, hDC, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,11 @@ libopenglon12 = shared_library(
|
||||||
vs_module_defs : 'openglon12.def',
|
vs_module_defs : 'openglon12.def',
|
||||||
include_directories : [
|
include_directories : [
|
||||||
inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux,
|
inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux,
|
||||||
inc_wgl, inc_gallium_winsys_sw, inc_gallium_drivers,
|
inc_wgl, inc_gallium_winsys, inc_gallium_winsys_sw, inc_gallium_drivers,
|
||||||
],
|
],
|
||||||
link_whole : [libwgl],
|
link_whole : [libwgl],
|
||||||
link_with : [
|
link_with : [
|
||||||
libgallium, libglsl, libmesa_gallium, libwsgdi, libglapi_static, libglapi
|
libgallium, libglsl, libmesa_gallium, libwsgdi, libd3d12winsys, libglapi_static, libglapi
|
||||||
],
|
],
|
||||||
dependencies : [
|
dependencies : [
|
||||||
dep_ws2_32, idep_nir, idep_mesautil, driver_d3d12
|
dep_ws2_32, idep_nir, idep_mesautil, driver_d3d12
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
#include "swr/swr_public.h"
|
#include "swr/swr_public.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef GALLIUM_D3D12
|
#ifdef GALLIUM_D3D12
|
||||||
#include "d3d12/d3d12_public.h"
|
#include "d3d12/wgl/d3d12_wgl_public.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GALLIUM_ZINK
|
#ifdef GALLIUM_ZINK
|
||||||
|
@ -117,12 +117,7 @@ gdi_screen_create(HDC hDC)
|
||||||
#endif
|
#endif
|
||||||
#ifdef GALLIUM_D3D12
|
#ifdef GALLIUM_D3D12
|
||||||
if (strcmp(driver, "d3d12") == 0) {
|
if (strcmp(driver, "d3d12") == 0) {
|
||||||
LUID* adapter_luid = NULL, local_luid;
|
screen = d3d12_wgl_create_screen( winsys, hDC );
|
||||||
if (stw_dev && stw_dev->callbacks.pfnGetAdapterLuid) {
|
|
||||||
stw_dev->callbacks.pfnGetAdapterLuid(hDC, &local_luid);
|
|
||||||
adapter_luid = &local_luid;
|
|
||||||
}
|
|
||||||
screen = d3d12_create_screen( winsys, adapter_luid );
|
|
||||||
if (screen)
|
if (screen)
|
||||||
use_d3d12 = TRUE;
|
use_d3d12 = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -188,7 +183,7 @@ gdi_present(struct pipe_screen *screen,
|
||||||
|
|
||||||
#ifdef GALLIUM_D3D12
|
#ifdef GALLIUM_D3D12
|
||||||
if (use_d3d12) {
|
if (use_d3d12) {
|
||||||
screen->flush_frontbuffer(screen, res, 0, 0, hDC, NULL);
|
d3d12_wgl_present(screen, res, hDC);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,7 +31,7 @@ libopengl32 = shared_library(
|
||||||
['libgl_gdi.c'],
|
['libgl_gdi.c'],
|
||||||
vs_module_defs : ogldef,
|
vs_module_defs : ogldef,
|
||||||
include_directories : [
|
include_directories : [
|
||||||
inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_wgl, inc_gallium_winsys_sw, inc_gallium_drivers,
|
inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_wgl, inc_gallium_winsys, inc_gallium_winsys_sw, inc_gallium_drivers,
|
||||||
],
|
],
|
||||||
link_whole : [libwgl],
|
link_whole : [libwgl],
|
||||||
link_with : [
|
link_with : [
|
||||||
|
@ -39,7 +39,7 @@ libopengl32 = shared_library(
|
||||||
],
|
],
|
||||||
dependencies : [
|
dependencies : [
|
||||||
dep_ws2_32, idep_nir, idep_mesautil, driver_swrast, driver_swr,
|
dep_ws2_32, idep_nir, idep_mesautil, driver_swrast, driver_swr,
|
||||||
driver_d3d12, driver_zink
|
driver_d3d12, driver_zink, winsys_d3d12_wgl
|
||||||
],
|
],
|
||||||
name_prefix : '', # otherwise mingw will create libopengl32.dll
|
name_prefix : '', # otherwise mingw will create libopengl32.dll
|
||||||
install : true,
|
install : true,
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* Copyright © Microsoft Corporation
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
* to deal in the Software without restriction, including without limitation
|
||||||
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice (including the next
|
||||||
|
* paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
* Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
* IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef D3D12_WGL_PUBLIC_H
|
||||||
|
#define D3D12_WGL_PUBLIC_H
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct pipe_resource;
|
||||||
|
struct pipe_screen;
|
||||||
|
struct stw_winsys;
|
||||||
|
|
||||||
|
struct pipe_screen *
|
||||||
|
d3d12_wgl_create_screen(struct sw_winsys *winsys,
|
||||||
|
HDC hDC);
|
||||||
|
|
||||||
|
void
|
||||||
|
d3d12_wgl_present(struct pipe_screen *screen,
|
||||||
|
struct pipe_resource *res,
|
||||||
|
HDC hDC);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* Copyright © Microsoft Corporation
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
* to deal in the Software without restriction, including without limitation
|
||||||
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice (including the next
|
||||||
|
* paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
* Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
* IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "d3d12_wgl_public.h"
|
||||||
|
#include "d3d12/d3d12_public.h"
|
||||||
|
|
||||||
|
#include "stw_device.h"
|
||||||
|
#include "stw_winsys.h"
|
||||||
|
|
||||||
|
#include "pipe/p_screen.h"
|
||||||
|
#include "util/u_memory.h"
|
||||||
|
|
||||||
|
struct pipe_screen *
|
||||||
|
d3d12_wgl_create_screen(struct sw_winsys *winsys, HDC hDC)
|
||||||
|
{
|
||||||
|
LUID *adapter_luid = NULL, local_luid;
|
||||||
|
if (stw_dev && stw_dev->callbacks.pfnGetAdapterLuid) {
|
||||||
|
stw_dev->callbacks.pfnGetAdapterLuid(hDC, &local_luid);
|
||||||
|
adapter_luid = &local_luid;
|
||||||
|
}
|
||||||
|
return d3d12_create_screen(winsys, adapter_luid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
d3d12_wgl_present(struct pipe_screen *screen,
|
||||||
|
struct pipe_resource *res,
|
||||||
|
HDC hDC)
|
||||||
|
{
|
||||||
|
screen->flush_frontbuffer(screen, res, 0, 0, hDC, NULL);
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
# Copyright © Microsoft Corporation
|
||||||
|
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
# copy of this software and associated documentation files (the "Software"),
|
||||||
|
# to deal in the Software without restriction, including without limitation
|
||||||
|
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
# and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
# Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
# The above copyright notice and this permission notice (including the next
|
||||||
|
# paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
# Software.
|
||||||
|
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
# IN THE SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
libd3d12winsys = static_library(
|
||||||
|
'd3d12winsys',
|
||||||
|
files('d3d12_wgl_winsys.c'),
|
||||||
|
include_directories : [inc_src, inc_wgl, inc_include, inc_gallium, inc_gallium_aux, inc_gallium_drivers],
|
||||||
|
gnu_symbol_visibility : 'hidden',
|
||||||
|
)
|
||||||
|
|
||||||
|
winsys_d3d12_wgl = declare_dependency(
|
||||||
|
link_with : [libd3d12winsys],
|
||||||
|
)
|
Loading…
Reference in New Issue