Haiku: Add Gallium winsys and target code
[mesa.git] / src / gallium / targets / haiku-softpipe / haiku-softpipe.c
1 /**************************************************************************
2 *
3 * Copyright 2013 Alexander von Gluck IV <kallisti5@unixzen.com>
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
16 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
17 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
18 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
19 * USE OR OTHER DEALINGS IN THE SOFTWARE.
20 *
21 * The above copyright notice and this permission notice (including the
22 * next paragraph) shall be included in all copies or substantial portions
23 * of the Software.
24 *
25 **************************************************************************/
26
27
28 #include "haiku-softpipe.h"
29
30 #include "util/u_debug.h"
31 #include "sw/hgl/hgl_sw_winsys.h"
32
33 #include "softpipe/sp_texture.h"
34 #include "softpipe/sp_screen.h"
35 #include "softpipe/sp_public.h"
36
37 #ifdef HAVE_LLVMPIPE
38 #include "llvmpipe/lp_texture.h"
39 #include "llvmpipe/lp_screen.h"
40 #include "llvmpipe/lp_public.h"
41 #endif
42
43
44 struct pipe_screen*
45 hgl_sw_screen_create(void)
46 {
47 struct sw_winsys* winsys = hgl_create_sw_winsys();
48 struct pipe_screen* screen = NULL;
49
50 if (!winsys)
51 return NULL;
52
53 #ifdef HAVE_LLVMPIPE
54 screen = llvmpipe_create_screen(winsys);
55 #else
56 screen = softpipe_create_screen(winsys);
57 #endif
58
59 if (!screen) {
60 winsys->destroy(winsys);
61 return NULL;
62 }
63
64 return screen;
65 }