1 //
2 // Copyright 2002 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // ExtensionBehavior.h: Extension name enumeration and data structures for storing extension
7 // behavior.
8 
9 #ifndef COMPILER_TRANSLATOR_EXTENSIONBEHAVIOR_H_
10 #define COMPILER_TRANSLATOR_EXTENSIONBEHAVIOR_H_
11 
12 #include <cstdint>
13 #include <map>
14 
15 namespace sh
16 {
17 
18 enum class TExtension : uint8_t
19 {
20     UNDEFINED,  // Special value used to indicate no extension.
21 
22     ANGLE_base_vertex_base_instance,
23     ANGLE_multi_draw,
24     ANGLE_texture_multisample,
25     APPLE_clip_distance,
26     ARB_texture_rectangle,
27     ARM_shader_framebuffer_fetch,
28     EXT_blend_func_extended,
29     EXT_clip_cull_distance,
30     EXT_draw_buffers,
31     EXT_frag_depth,
32     EXT_geometry_shader,
33     OES_shader_io_blocks,
34     EXT_shader_io_blocks,
35     EXT_gpu_shader5,
36     EXT_shader_framebuffer_fetch,
37     EXT_shader_framebuffer_fetch_non_coherent,
38     EXT_shader_non_constant_global_initializers,
39     EXT_shader_texture_lod,
40     EXT_shadow_samplers,
41     EXT_tessellation_shader,
42     EXT_texture_buffer,
43     EXT_texture_cube_map_array,
44     EXT_YUV_target,
45     NV_EGL_stream_consumer_external,
46     NV_shader_framebuffer_fetch,
47     NV_shader_noperspective_interpolation,
48     OES_EGL_image_external,
49     OES_EGL_image_external_essl3,
50     OES_sample_variables,
51     OES_shader_multisample_interpolation,
52     OES_shader_image_atomic,
53     OES_standard_derivatives,
54     OES_texture_3D,
55     OES_texture_buffer,
56     OES_texture_cube_map_array,
57     OES_texture_storage_multisample_2d_array,
58     OVR_multiview,
59     OVR_multiview2,
60     WEBGL_video_texture,
61 };
62 
63 enum TBehavior : uint8_t
64 {
65     EBhRequire,
66     EBhEnable,
67     EBhWarn,
68     EBhDisable,
69     EBhUndefined
70 };
71 
72 const char *GetExtensionNameString(TExtension extension);
73 TExtension GetExtensionByName(const char *extension);
74 
75 const char *GetBehaviorString(TBehavior b);
76 
77 // Mapping between extension id and behavior.
78 typedef std::map<TExtension, TBehavior> TExtensionBehavior;
79 
80 bool IsExtensionEnabled(const TExtensionBehavior &extBehavior, TExtension extension);
81 
82 }  // namespace sh
83 
84 #endif  // COMPILER_TRANSLATOR_EXTENSIONBEHAVIOR_H_
85