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
|
||||
if with_platform_windows
|
||||
subdir('frontends/wgl')
|
||||
subdir('targets/libgl-gdi')
|
||||
if with_gallium_d3d12
|
||||
subdir('winsys/d3d12/wgl')
|
||||
subdir('targets/libgl-d3d12')
|
||||
else
|
||||
winsys_d3d12_wgl = declare_dependency()
|
||||
endif
|
||||
subdir('targets/libgl-gdi')
|
||||
endif
|
||||
if with_tests
|
||||
subdir('targets/graw-null')
|
||||
|
|
|
@ -36,24 +36,19 @@
|
|||
#ifndef GALLIUM_D3D12
|
||||
#error "This file must be compiled only with the D3D12 driver"
|
||||
#endif
|
||||
#include "d3d12/d3d12_public.h"
|
||||
#include "d3d12/wgl/d3d12_wgl_public.h"
|
||||
|
||||
static struct pipe_screen *
|
||||
gdi_screen_create(HDC hDC)
|
||||
{
|
||||
struct pipe_screen *screen = NULL;
|
||||
struct sw_winsys *winsys;
|
||||
LUID *adapter_luid = NULL, local_luid;
|
||||
|
||||
winsys = gdi_create_sw_winsys();
|
||||
if(!winsys)
|
||||
goto no_winsys;
|
||||
|
||||
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 );
|
||||
screen = d3d12_wgl_create_screen( winsys, hDC );
|
||||
|
||||
if(!screen)
|
||||
goto no_screen;
|
||||
|
@ -72,20 +67,7 @@ gdi_present(struct pipe_screen *screen,
|
|||
struct pipe_resource *res,
|
||||
HDC hDC)
|
||||
{
|
||||
/* This will fail if any interposing layer (trace, debug, etc) has
|
||||
* 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);
|
||||
d3d12_wgl_present(screen, res, hDC);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ libopenglon12 = shared_library(
|
|||
vs_module_defs : 'openglon12.def',
|
||||
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_wgl, inc_gallium_winsys, inc_gallium_winsys_sw, inc_gallium_drivers,
|
||||
],
|
||||
link_whole : [libwgl],
|
||||
link_with : [
|
||||
libgallium, libglsl, libmesa_gallium, libwsgdi, libglapi_static, libglapi
|
||||
libgallium, libglsl, libmesa_gallium, libwsgdi, libd3d12winsys, libglapi_static, libglapi
|
||||
],
|
||||
dependencies : [
|
||||
dep_ws2_32, idep_nir, idep_mesautil, driver_d3d12
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
#include "swr/swr_public.h"
|
||||
#endif
|
||||
#ifdef GALLIUM_D3D12
|
||||
#include "d3d12/d3d12_public.h"
|
||||
#include "d3d12/wgl/d3d12_wgl_public.h"
|
||||
#endif
|
||||
|
||||
#ifdef GALLIUM_ZINK
|
||||
|
@ -117,12 +117,7 @@ gdi_screen_create(HDC hDC)
|
|||
#endif
|
||||
#ifdef GALLIUM_D3D12
|
||||
if (strcmp(driver, "d3d12") == 0) {
|
||||
LUID* adapter_luid = NULL, local_luid;
|
||||
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 );
|
||||
screen = d3d12_wgl_create_screen( winsys, hDC );
|
||||
if (screen)
|
||||
use_d3d12 = TRUE;
|
||||
}
|
||||
|
@ -188,7 +183,7 @@ gdi_present(struct pipe_screen *screen,
|
|||
|
||||
#ifdef GALLIUM_D3D12
|
||||
if (use_d3d12) {
|
||||
screen->flush_frontbuffer(screen, res, 0, 0, hDC, NULL);
|
||||
d3d12_wgl_present(screen, res, hDC);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -31,7 +31,7 @@ libopengl32 = shared_library(
|
|||
['libgl_gdi.c'],
|
||||
vs_module_defs : ogldef,
|
||||
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_with : [
|
||||
|
@ -39,7 +39,7 @@ libopengl32 = shared_library(
|
|||
],
|
||||
dependencies : [
|
||||
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
|
||||
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