1//
2// Copyright (c) 2002-2014 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
7#include "compiler/translator/Initialize.h"
8
9namespace sh
10{
11
12void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavior &extBehavior)
13{
14 if (resources.OES_standard_derivatives)
15 {
16 extBehavior[TExtension::OES_standard_derivatives] = EBhUndefined;
17 }
18 if (resources.OES_EGL_image_external)
19 {
20 extBehavior[TExtension::OES_EGL_image_external] = EBhUndefined;
21 }
22 if (resources.OES_EGL_image_external_essl3)
23 {
24 extBehavior[TExtension::OES_EGL_image_external_essl3] = EBhUndefined;
25 }
26 if (resources.NV_EGL_stream_consumer_external)
27 {
28 extBehavior[TExtension::NV_EGL_stream_consumer_external] = EBhUndefined;
29 }
30 if (resources.ARB_texture_rectangle)
31 {
32 // Special: ARB_texture_rectangle extension does not follow the standard for #extension
33 // directives - it is enabled by default. An extension directive may still disable it.
34 extBehavior[TExtension::ARB_texture_rectangle] = EBhEnable;
35 }
36 if (resources.EXT_blend_func_extended)
37 {
38 extBehavior[TExtension::EXT_blend_func_extended] = EBhUndefined;
39 }
40 if (resources.EXT_draw_buffers)
41 {
42 extBehavior[TExtension::EXT_draw_buffers] = EBhUndefined;
43 }
44 if (resources.EXT_frag_depth)
45 {
46 extBehavior[TExtension::EXT_frag_depth] = EBhUndefined;
47 }
48 if (resources.EXT_shader_texture_lod)
49 {
50 extBehavior[TExtension::EXT_shader_texture_lod] = EBhUndefined;
51 }
52 if (resources.EXT_shader_framebuffer_fetch)
53 {
54 extBehavior[TExtension::EXT_shader_framebuffer_fetch] = EBhUndefined;
55 }
56 if (resources.NV_shader_framebuffer_fetch)
57 {
58 extBehavior[TExtension::NV_shader_framebuffer_fetch] = EBhUndefined;
59 }
60 if (resources.ARM_shader_framebuffer_fetch)
61 {
62 extBehavior[TExtension::ARM_shader_framebuffer_fetch] = EBhUndefined;
63 }
64 if (resources.OVR_multiview2)
65 {
66 extBehavior[TExtension::OVR_multiview2] = EBhUndefined;
67 }
68 if (resources.EXT_YUV_target)
69 {
70 extBehavior[TExtension::EXT_YUV_target] = EBhUndefined;
71 }
72 if (resources.EXT_geometry_shader)
73 {
74 extBehavior[TExtension::EXT_geometry_shader] = EBhUndefined;
75 }
76 if (resources.OES_texture_storage_multisample_2d_array)
77 {
78 extBehavior[TExtension::OES_texture_storage_multisample_2d_array] = EBhUndefined;
79 }
80 if (resources.ANGLE_texture_multisample)
81 {
82 extBehavior[TExtension::ANGLE_texture_multisample] = EBhUndefined;
83 }
84 if (resources.ANGLE_multi_draw)
85 {
86 extBehavior[TExtension::ANGLE_multi_draw] = EBhUndefined;
87 }
88}
89
90void ResetExtensionBehavior(TExtensionBehavior &extBehavior)
91{
92 for (auto &ext : extBehavior)
93 {
94 if (ext.first == TExtension::ARB_texture_rectangle)
95 {
96 ext.second = EBhEnable;
97 }
98 else
99 {
100 ext.second = EBhUndefined;
101 }
102 }
103}
104
105} // namespace sh
106