diff options
author | Louis-Francis Ratté-Boulianne <lfrb@collabora.com> | 2020-04-24 16:09:07 -0400 |
---|---|---|
committer | Erik Faye-Lund <erik.faye-lund@collabora.com> | 2020-11-18 11:15:51 +0100 |
commit | bb9cc7ede4daf1d74b2e8140008e2f1fe03b96bd (patch) | |
tree | 9be757e9938c126cbf6dcb624a4aca9f22ef7026 /src/gallium/winsys/d3d12 | |
parent | 3b034e97716f0862151e5a52610edfef46ad0b16 (diff) |
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>
Diffstat (limited to 'src/gallium/winsys/d3d12')
-rw-r--r-- | src/gallium/winsys/d3d12/wgl/d3d12_wgl_public.h | 50 | ||||
-rw-r--r-- | src/gallium/winsys/d3d12/wgl/d3d12_wgl_winsys.c | 50 | ||||
-rw-r--r-- | src/gallium/winsys/d3d12/wgl/meson.build | 32 |
3 files changed, 132 insertions, 0 deletions
diff --git a/src/gallium/winsys/d3d12/wgl/d3d12_wgl_public.h b/src/gallium/winsys/d3d12/wgl/d3d12_wgl_public.h new file mode 100644 index 00000000000..8a9d1f666cd --- /dev/null +++ b/src/gallium/winsys/d3d12/wgl/d3d12_wgl_public.h @@ -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 diff --git a/src/gallium/winsys/d3d12/wgl/d3d12_wgl_winsys.c b/src/gallium/winsys/d3d12/wgl/d3d12_wgl_winsys.c new file mode 100644 index 00000000000..6981381175e --- /dev/null +++ b/src/gallium/winsys/d3d12/wgl/d3d12_wgl_winsys.c @@ -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); +} diff --git a/src/gallium/winsys/d3d12/wgl/meson.build b/src/gallium/winsys/d3d12/wgl/meson.build new file mode 100644 index 00000000000..9f41560b811 --- /dev/null +++ b/src/gallium/winsys/d3d12/wgl/meson.build @@ -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], +) |