Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / gpu / command_buffer / common / capabilities.h
blob224829c68b565c872fbcb23f3a21e4449aa94cbe
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
3 // found in the LICENSE file.
5 #ifndef GPU_COMMAND_BUFFER_COMMON_CAPABILITIES_H_
6 #define GPU_COMMAND_BUFFER_COMMON_CAPABILITIES_H_
8 #include "gpu/gpu_export.h"
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
21 namespace gpu {
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;
31 struct PerStagePrecisions {
32 PerStagePrecisions();
34 ShaderPrecision low_int;
35 ShaderPrecision medium_int;
36 ShaderPrecision high_int;
37 ShaderPrecision low_float;
38 ShaderPrecision medium_float;
39 ShaderPrecision high_float;
42 Capabilities();
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);
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);
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;
79 bool post_sub_buffer;
80 bool egl_image_external;
81 bool texture_format_bgra8888;
82 bool texture_format_etc1;
83 bool texture_format_etc1_npot;
84 bool texture_rectangle;
85 bool iosurface;
86 bool texture_usage;
87 bool texture_storage;
88 bool discard_framebuffer;
89 bool sync_query;
90 bool image;
91 bool future_sync_points;
92 bool blend_equation_advanced;
93 bool blend_equation_advanced_coherent;
96 } // namespace gpu
98 #endif // GPU_COMMAND_BUFFER_COMMON_CAPABILITIES_H_