OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "gpu/gles2_conform_support/egl/config.h" | |
6 | |
7 namespace egl { | |
8 | |
9 Config::Config() | |
10 : buffer_size_(0), | |
11 red_size_(0), | |
12 green_size_(0), | |
13 blue_size_(0), | |
14 luminance_size_(0), | |
15 alpha_size_(0), | |
16 alpha_mask_size_(0), | |
17 bind_to_texture_rgb_(EGL_DONT_CARE), | |
18 bind_to_texture_rgba_(EGL_DONT_CARE), | |
19 color_buffer_type_(EGL_RGB_BUFFER), | |
20 config_caveat_(EGL_DONT_CARE), | |
21 config_id_(EGL_DONT_CARE), | |
22 conformant_(EGL_OPENGL_ES2_BIT), | |
23 depth_size_(0), | |
24 level_(0), | |
25 max_pbuffer_width_(0), | |
26 max_pbuffer_height_(0), | |
27 max_pbuffer_pixels_(0), | |
28 min_swap_interval_(EGL_DONT_CARE), | |
29 max_swap_interval_(EGL_DONT_CARE), | |
30 native_renderable_(EGL_DONT_CARE), | |
31 native_visual_id_(0), | |
32 native_visual_type_(EGL_DONT_CARE), | |
33 renderable_type_(EGL_OPENGL_ES2_BIT), | |
34 sample_buffers_(0), | |
35 samples_(0), | |
36 stencil_size_(0), | |
37 surface_type_(EGL_WINDOW_BIT), | |
38 transparent_type_(EGL_NONE), | |
39 transparent_red_value_(EGL_DONT_CARE), | |
40 transparent_green_value_(EGL_DONT_CARE), | |
41 transparent_blue_value_(EGL_DONT_CARE) { | |
42 } | |
43 | |
44 Config::~Config() { | |
45 } | |
46 | |
47 bool Config::GetAttrib(EGLint attribute, EGLint* value) const { | |
48 // TODO(alokp): Find out how to get correct values. | |
49 switch (attribute) { | |
50 case EGL_BUFFER_SIZE: | |
51 *value = buffer_size_; | |
52 break; | |
53 case EGL_RED_SIZE: | |
54 *value = red_size_; | |
55 break; | |
56 case EGL_GREEN_SIZE: | |
57 *value = green_size_; | |
58 break; | |
59 case EGL_BLUE_SIZE: | |
60 *value = blue_size_; | |
61 break; | |
62 case EGL_LUMINANCE_SIZE: | |
63 *value = luminance_size_; | |
64 break; | |
65 case EGL_ALPHA_SIZE: | |
66 *value = alpha_size_; | |
67 break; | |
68 case EGL_ALPHA_MASK_SIZE: | |
69 *value = alpha_mask_size_; | |
70 break; | |
71 case EGL_BIND_TO_TEXTURE_RGB: | |
72 *value = bind_to_texture_rgb_; | |
73 break; | |
74 case EGL_BIND_TO_TEXTURE_RGBA: | |
75 *value = bind_to_texture_rgba_; | |
76 break; | |
77 case EGL_COLOR_BUFFER_TYPE: | |
78 *value = color_buffer_type_; | |
79 break; | |
80 case EGL_CONFIG_CAVEAT: | |
81 *value = config_caveat_; | |
82 break; | |
83 case EGL_CONFIG_ID: | |
84 *value = config_id_; | |
85 break; | |
86 case EGL_CONFORMANT: | |
87 *value = conformant_; | |
88 break; | |
89 case EGL_DEPTH_SIZE: | |
90 *value = depth_size_; | |
91 break; | |
92 case EGL_LEVEL: | |
93 *value = level_; | |
94 break; | |
95 case EGL_MAX_PBUFFER_WIDTH: | |
96 *value = max_pbuffer_width_; | |
97 break; | |
98 case EGL_MAX_PBUFFER_HEIGHT: | |
99 *value = max_pbuffer_height_; | |
100 break; | |
101 case EGL_MAX_PBUFFER_PIXELS: | |
102 *value = max_pbuffer_pixels_; | |
103 break; | |
104 case EGL_MIN_SWAP_INTERVAL: | |
105 *value = min_swap_interval_; | |
106 break; | |
107 case EGL_MAX_SWAP_INTERVAL: | |
108 *value = max_swap_interval_; | |
109 break; | |
110 case EGL_NATIVE_RENDERABLE: | |
111 *value = native_renderable_; | |
112 break; | |
113 case EGL_NATIVE_VISUAL_ID: | |
114 *value = native_visual_id_; | |
115 break; | |
116 case EGL_NATIVE_VISUAL_TYPE: | |
117 *value = native_visual_type_; | |
118 break; | |
119 case EGL_RENDERABLE_TYPE: | |
120 *value = renderable_type_; | |
121 break; | |
122 case EGL_SAMPLE_BUFFERS: | |
123 *value = sample_buffers_; | |
124 break; | |
125 case EGL_SAMPLES: | |
126 *value = samples_; | |
127 break; | |
128 case EGL_STENCIL_SIZE: | |
129 *value = stencil_size_; | |
130 break; | |
131 case EGL_SURFACE_TYPE: | |
132 *value = surface_type_; | |
133 break; | |
134 case EGL_TRANSPARENT_TYPE: | |
135 *value = transparent_type_; | |
136 break; | |
137 case EGL_TRANSPARENT_RED_VALUE: | |
138 *value = transparent_red_value_; | |
139 break; | |
140 case EGL_TRANSPARENT_GREEN_VALUE: | |
141 *value = transparent_green_value_; | |
142 break; | |
143 case EGL_TRANSPARENT_BLUE_VALUE: | |
144 *value = transparent_blue_value_; | |
145 break; | |
146 default: | |
147 return false; | |
148 } | |
149 return true; | |
150 } | |
151 | |
152 } // namespace egl | |
OLD | NEW |