OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef GPU_COMMAND_BUFFER_COMMON_CAPABILITIES_H_ | 5 #ifndef GPU_COMMAND_BUFFER_COMMON_CAPABILITIES_H_ |
6 #define GPU_COMMAND_BUFFER_COMMON_CAPABILITIES_H_ | 6 #define GPU_COMMAND_BUFFER_COMMON_CAPABILITIES_H_ |
7 | 7 |
8 #include "gpu/gpu_export.h" | 8 #include "gpu/gpu_export.h" |
9 | 9 |
| 10 // From gl2.h. We want to avoid including gl headers because client-side and |
| 11 // service-side headers conflict. |
| 12 #define GL_FRAGMENT_SHADER 0x8B30 |
| 13 #define GL_VERTEX_SHADER 0x8B31 |
| 14 #define GL_LOW_FLOAT 0x8DF0 |
| 15 #define GL_MEDIUM_FLOAT 0x8DF1 |
| 16 #define GL_HIGH_FLOAT 0x8DF2 |
| 17 #define GL_LOW_INT 0x8DF3 |
| 18 #define GL_MEDIUM_INT 0x8DF4 |
| 19 #define GL_HIGH_INT 0x8DF5 |
| 20 |
10 namespace gpu { | 21 namespace gpu { |
11 | 22 |
12 struct GPU_EXPORT Capabilities { | 23 struct GPU_EXPORT Capabilities { |
| 24 struct ShaderPrecision { |
| 25 ShaderPrecision() : min_range(0), max_range(0), precision(0) {} |
| 26 int min_range; |
| 27 int max_range; |
| 28 int precision; |
| 29 }; |
| 30 |
| 31 struct PerStagePrecisions { |
| 32 PerStagePrecisions(); |
| 33 |
| 34 ShaderPrecision low_int; |
| 35 ShaderPrecision medium_int; |
| 36 ShaderPrecision high_int; |
| 37 ShaderPrecision low_float; |
| 38 ShaderPrecision medium_float; |
| 39 ShaderPrecision high_float; |
| 40 }; |
| 41 |
| 42 Capabilities(); |
| 43 |
| 44 template <typename T> |
| 45 void VisitStagePrecisions(unsigned stage, |
| 46 PerStagePrecisions* precisions, |
| 47 const T& visitor) { |
| 48 visitor(stage, GL_LOW_INT, &precisions->low_int); |
| 49 visitor(stage, GL_MEDIUM_INT, &precisions->medium_int); |
| 50 visitor(stage, GL_HIGH_INT, &precisions->high_int); |
| 51 visitor(stage, GL_LOW_FLOAT, &precisions->low_float); |
| 52 visitor(stage, GL_MEDIUM_FLOAT, &precisions->medium_float); |
| 53 visitor(stage, GL_HIGH_FLOAT, &precisions->high_float); |
| 54 } |
| 55 |
| 56 template <typename T> |
| 57 void VisitPrecisions(const T& visitor) { |
| 58 VisitStagePrecisions(GL_VERTEX_SHADER, &vertex_shader_precisions, visitor); |
| 59 VisitStagePrecisions(GL_FRAGMENT_SHADER, &fragment_shader_precisions, |
| 60 visitor); |
| 61 } |
| 62 |
| 63 PerStagePrecisions vertex_shader_precisions; |
| 64 PerStagePrecisions fragment_shader_precisions; |
| 65 int max_combined_texture_image_units; |
| 66 int max_cube_map_texture_size; |
| 67 int max_fragment_uniform_vectors; |
| 68 int max_renderbuffer_size; |
| 69 int max_texture_image_units; |
| 70 int max_texture_size; |
| 71 int max_varying_vectors; |
| 72 int max_vertex_attribs; |
| 73 int max_vertex_texture_image_units; |
| 74 int max_vertex_uniform_vectors; |
| 75 int num_compressed_texture_formats; |
| 76 int num_shader_binary_formats; |
| 77 int bind_generates_resource_chromium; |
| 78 |
13 bool post_sub_buffer; | 79 bool post_sub_buffer; |
14 bool egl_image_external; | 80 bool egl_image_external; |
15 bool texture_format_bgra8888; | 81 bool texture_format_bgra8888; |
16 bool texture_format_etc1; | 82 bool texture_format_etc1; |
17 bool texture_format_etc1_npot; | 83 bool texture_format_etc1_npot; |
18 bool texture_rectangle; | 84 bool texture_rectangle; |
19 bool iosurface; | 85 bool iosurface; |
20 bool texture_usage; | 86 bool texture_usage; |
21 bool texture_storage; | 87 bool texture_storage; |
22 bool discard_framebuffer; | 88 bool discard_framebuffer; |
23 bool sync_query; | 89 bool sync_query; |
24 bool image; | 90 bool image; |
25 bool future_sync_points; | 91 bool future_sync_points; |
26 bool blend_equation_advanced; | 92 bool blend_equation_advanced; |
27 bool blend_equation_advanced_coherent; | 93 bool blend_equation_advanced_coherent; |
28 | |
29 Capabilities(); | |
30 }; | 94 }; |
31 | 95 |
32 } // namespace gpu | 96 } // namespace gpu |
33 | 97 |
34 #endif // GPU_COMMAND_BUFFER_COMMON_CAPABILITIES_H_ | 98 #endif // GPU_COMMAND_BUFFER_COMMON_CAPABILITIES_H_ |
OLD | NEW |