1 // Copyright 2012 Intel Corporation
3 // All rights reserved.
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
8 // - Redistributions of source code must retain the above copyright notice, this
9 // list of conditions and the following disclaimer.
11 // - Redistributions in binary form must reproduce the above copyright notice,
12 // this list of conditions and the following disclaimer in the documentation
13 // and/or other materials provided with the distribution.
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include "c99_compat.h"
34 struct wcore_config_attrs
;
37 struct wcore_platform
;
40 struct wcore_platform_vtbl
{
42 (*destroy
)(struct wcore_platform
*self
);
46 struct wcore_platform
*self
,
47 struct wcore_display
*dpy
,
48 struct wcore_window
*window
,
49 struct wcore_context
*ctx
);
53 struct wcore_platform
*self
,
58 struct wcore_platform
*self
,
63 struct wcore_platform
*self
,
67 struct wcore_display_vtbl
{
69 (*connect
)(struct wcore_platform
*platform
,
73 (*destroy
)(struct wcore_display
*self
);
76 (*supports_context_api
)(
77 struct wcore_display
*display
,
81 union waffle_native_display
*
82 (*get_native
)(struct wcore_display
*display
);
85 struct wcore_config_vtbl
{
87 (*choose
)(struct wcore_platform
*platform
,
88 struct wcore_display
*display
,
89 const struct wcore_config_attrs
*attrs
);
92 (*destroy
)(struct wcore_config
*config
);
95 union waffle_native_config
*
96 (*get_native
)(struct wcore_config
*config
);
99 struct wcore_context_vtbl
{
100 struct wcore_context
*
101 (*create
)(struct wcore_platform
*platform
,
102 struct wcore_config
*config
,
103 struct wcore_context
*share_ctx
);
106 (*destroy
)(struct wcore_context
*ctx
);
109 union waffle_native_context
*
110 (*get_native
)(struct wcore_context
*ctx
);
113 struct wcore_window_vtbl
{
115 (*create
)(struct wcore_platform
*platform
,
116 struct wcore_config
*config
,
119 const intptr_t attrib_list
[]);
121 (*destroy
)(struct wcore_window
*window
);
124 (*show
)(struct wcore_window
*window
);
127 (*swap_buffers
)(struct wcore_window
*window
);
130 (*resize
)(struct wcore_window
*window
,
135 union waffle_native_window
*
136 (*get_native
)(struct wcore_window
*window
);
140 struct wcore_platform
{
141 const struct wcore_platform_vtbl
*vtbl
;
142 enum waffle_enum waffle_platform
; // WAFFLE_PLATFORM_*
146 wcore_platform_init(struct wcore_platform
*self
)
154 wcore_platform_teardown(struct wcore_platform
*self
)