• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © Microsoft Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23 
24 #include "d3d12_wgl_public.h"
25 #include "d3d12/d3d12_public.h"
26 
27 #include "stw_device.h"
28 #include "stw_winsys.h"
29 
30 #include "pipe/p_screen.h"
31 #include "util/u_memory.h"
32 
33 struct pipe_screen *
d3d12_wgl_create_screen(struct sw_winsys * winsys,HDC hDC)34 d3d12_wgl_create_screen(struct sw_winsys *winsys, HDC hDC)
35 {
36    LUID *adapter_luid = NULL, local_luid;
37    if (stw_dev && stw_dev->callbacks.pfnGetAdapterLuid) {
38       stw_dev->callbacks.pfnGetAdapterLuid(hDC, &local_luid);
39       adapter_luid = &local_luid;
40    }
41    return d3d12_create_dxgi_screen(winsys, adapter_luid);
42 }
43 
44 void
d3d12_wgl_present(struct pipe_screen * screen,struct pipe_context * ctx,struct pipe_resource * res,HDC hDC)45 d3d12_wgl_present(struct pipe_screen *screen,
46                   struct pipe_context *ctx,
47                   struct pipe_resource *res,
48                   HDC hDC)
49 {
50    screen->flush_frontbuffer(screen, ctx, res, 0, 0, hDC, NULL);
51 }
52 
53 unsigned
d3d12_wgl_get_pfd_flags(struct pipe_screen * screen)54 d3d12_wgl_get_pfd_flags(struct pipe_screen *screen)
55 {
56    (void)screen;
57    return stw_pfd_gdi_support | stw_pfd_double_buffer;
58 }
59