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_draw_buffers,
30     EXT_frag_depth,
31     EXT_geometry_shader,
32     EXT_gpu_shader5,
33     EXT_shader_framebuffer_fetch,
34     EXT_shader_non_constant_global_initializers,
35     EXT_shader_texture_lod,
36     EXT_shadow_samplers,
37     EXT_texture_buffer,
38     EXT_texture_cube_map_array,
39     EXT_YUV_target,
40     NV_EGL_stream_consumer_external,
41     NV_shader_framebuffer_fetch,
42     NV_shader_noperspective_interpolation,
43     OES_EGL_image_external,
44     OES_EGL_image_external_essl3,
45     OES_shader_multisample_interpolation,
46     OES_shader_image_atomic,
47     OES_standard_derivatives,
48     OES_texture_3D,
49     OES_texture_buffer,
50     OES_texture_cube_map_array,
51     OES_texture_storage_multisample_2d_array,
52     OVR_multiview,
53     OVR_multiview2,
54     WEBGL_video_texture,
55 };
56 
57 enum TBehavior : uint8_t
58 {
59     EBhRequire,
60     EBhEnable,
61     EBhWarn,
62     EBhDisable,
63     EBhUndefined
64 };
65 
66 const char *GetExtensionNameString(TExtension extension);
67 TExtension GetExtensionByName(const char *extension);
68 
69 const char *GetBehaviorString(TBehavior b);
70 
71 // Mapping between extension id and behavior.
72 typedef std::map<TExtension, TBehavior> TExtensionBehavior;
73 
74 bool IsExtensionEnabled(const TExtensionBehavior &extBehavior, TExtension extension);
75 
76 }  // namespace sh
77 
78 #endif  // COMPILER_TRANSLATOR_EXTENSIONBEHAVIOR_H_
79