• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**************************************************************************
2  *
3  * Copyright 2012-2021 VMware, Inc.
4  * All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sub license, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20  * USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * The above copyright notice and this permission notice (including the
23  * next paragraph) shall be included in all copies or substantial portions
24  * of the Software.
25  *
26  *
27  **************************************************************************/
28 
29 
30 #include "util/u_debug.h"
31 #include "target-helpers/inline_debug_helper.h"
32 #include "llvmpipe/lp_public.h"
33 #include "softpipe/sp_public.h"
34 #include "sw/gdi/gdi_sw_winsys.h"
35 
36 
37 extern struct pipe_screen *
38 d3d10_create_screen(void);
39 
40 
41 struct pipe_screen *
d3d10_create_screen(void)42 d3d10_create_screen(void)
43 {
44    const char *default_driver;
45    const char *driver;
46    struct pipe_screen *screen = NULL;
47    struct sw_winsys *winsys;
48 
49    winsys = gdi_create_sw_winsys();
50    if(!winsys)
51       goto no_winsys;
52 
53 #ifdef GALLIUM_LLVMPIPE
54    default_driver = "llvmpipe";
55 #else
56    default_driver = "softpipe";
57 #endif
58 
59    driver = debug_get_option("GALLIUM_DRIVER", default_driver);
60 
61 #ifdef GALLIUM_LLVMPIPE
62    if (strcmp(driver, "llvmpipe") == 0) {
63       screen = llvmpipe_create_screen( winsys );
64    }
65 #else
66    (void)driver;
67 #endif
68 
69    if (screen == NULL) {
70       screen = softpipe_create_screen( winsys );
71    }
72 
73    if (screen == NULL)
74       goto no_screen;
75 
76    return debug_screen_wrap( screen );
77 
78 no_screen:
79    winsys->destroy(winsys);
80 no_winsys:
81    return NULL;
82 }
83