1 // Copyright 2012 Intel Corporation
2 //
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // - Redistributions of source code must retain the above copyright notice, this
9 //   list of conditions and the following disclaimer.
10 //
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.
14 //
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.
25 
26 #pragma once
27 
28 #include <stdbool.h>
29 #include <stdint.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /// @brief Encodes the attribute list received by waffle_config_choose().
36 struct wcore_config_attrs {
37     int32_t context_api;
38     int32_t context_major_version;
39     int32_t context_minor_version;
40     int32_t context_profile;
41 
42     int32_t rgb_size;
43     int32_t rgba_size;
44 
45     int32_t red_size;
46     int32_t green_size;
47     int32_t blue_size;
48     int32_t alpha_size;
49 
50     int32_t depth_size;
51     int32_t stencil_size;
52 
53     int32_t samples;
54 
55     bool context_forward_compatible;
56     bool context_debug;
57     bool context_robust;
58     bool double_buffered;
59     bool sample_buffers;
60     bool accum_buffer;
61 };
62 
63 bool
64 wcore_config_attrs_parse(
65       const int32_t waffle_attrib_list[],
66       struct wcore_config_attrs *attrs);
67 
68 bool
69 wcore_config_attrs_version_eq(
70       const struct wcore_config_attrs *attrs,
71       int merged_version);
72 
73 bool
74 wcore_config_attrs_version_gt(
75       const struct wcore_config_attrs *attrs,
76       int merged_version);
77 
78 bool
79 wcore_config_attrs_version_ge(
80       const struct wcore_config_attrs *attrs,
81       int merged_version);
82 
83 bool
84 wcore_config_attrs_version_lt(
85       const struct wcore_config_attrs *attrs,
86       int merged_version);
87 
88 bool
89 wcore_config_attrs_version_le(
90       const struct wcore_config_attrs *attrs,
91       int merged_version);
92 
93 #ifdef __cplusplus
94 }
95 #endif
96