blob: e12a9b7d7cd752b801c74214f2243d82a9175d05 [file] [log] [blame]
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +00001//
Nicolas Capens1fbc2872014-01-03 14:12:09 -05002// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +00003// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
Geoff Lang17732822013-08-29 13:46:49 -04007#include "compiler/translator/Initialize.h"
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +00008
Jamie Madill45bcc782016-11-07 13:58:48 -05009namespace sh
10{
11
Jamie Madilld7b1ab52016-12-12 14:42:19 -050012void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavior &extBehavior)
alokp@chromium.orgad771eb2010-09-07 17:36:23 +000013{
14 if (resources.OES_standard_derivatives)
Olli Etuaho2a1e8f92017-07-14 11:49:36 +030015 {
16 extBehavior[TExtension::OES_standard_derivatives] = EBhUndefined;
17 }
zmo@google.com09c323a2011-08-12 18:22:25 +000018 if (resources.OES_EGL_image_external)
Olli Etuaho2a1e8f92017-07-14 11:49:36 +030019 {
20 extBehavior[TExtension::OES_EGL_image_external] = EBhUndefined;
21 }
Geoff Langb66a9092016-05-16 15:59:14 -040022 if (resources.OES_EGL_image_external_essl3)
Olli Etuaho2a1e8f92017-07-14 11:49:36 +030023 {
24 extBehavior[TExtension::OES_EGL_image_external_essl3] = EBhUndefined;
25 }
Ian Ewellbda75592016-04-18 17:25:54 -040026 if (resources.NV_EGL_stream_consumer_external)
Olli Etuaho2a1e8f92017-07-14 11:49:36 +030027 {
28 extBehavior[TExtension::NV_EGL_stream_consumer_external] = EBhUndefined;
29 }
kbr@chromium.org205fef32011-11-22 20:50:02 +000030 if (resources.ARB_texture_rectangle)
Olli Etuaho2a1e8f92017-07-14 11:49:36 +030031 {
Olli Etuaho703671e2017-11-08 17:47:18 +020032 // 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;
Olli Etuaho2a1e8f92017-07-14 11:49:36 +030035 }
Kimmo Kinnunenb18609b2015-07-16 14:13:11 +030036 if (resources.EXT_blend_func_extended)
Olli Etuaho2a1e8f92017-07-14 11:49:36 +030037 {
38 extBehavior[TExtension::EXT_blend_func_extended] = EBhUndefined;
39 }
shannon.woods@transgaming.com550cd092013-02-28 23:19:54 +000040 if (resources.EXT_draw_buffers)
Olli Etuaho2a1e8f92017-07-14 11:49:36 +030041 {
42 extBehavior[TExtension::EXT_draw_buffers] = EBhUndefined;
43 }
Jamie Madill2aeb26a2013-07-08 14:02:55 -040044 if (resources.EXT_frag_depth)
Olli Etuaho2a1e8f92017-07-14 11:49:36 +030045 {
46 extBehavior[TExtension::EXT_frag_depth] = EBhUndefined;
47 }
Nicolas Capens46485082014-04-15 13:12:50 -040048 if (resources.EXT_shader_texture_lod)
Olli Etuaho2a1e8f92017-07-14 11:49:36 +030049 {
50 extBehavior[TExtension::EXT_shader_texture_lod] = EBhUndefined;
51 }
Erik Dahlströmea7a2122014-11-17 16:15:57 +010052 if (resources.EXT_shader_framebuffer_fetch)
Olli Etuaho2a1e8f92017-07-14 11:49:36 +030053 {
54 extBehavior[TExtension::EXT_shader_framebuffer_fetch] = EBhUndefined;
55 }
Erik Dahlströmea7a2122014-11-17 16:15:57 +010056 if (resources.NV_shader_framebuffer_fetch)
Olli Etuaho2a1e8f92017-07-14 11:49:36 +030057 {
58 extBehavior[TExtension::NV_shader_framebuffer_fetch] = EBhUndefined;
59 }
Erik Dahlströmea7a2122014-11-17 16:15:57 +010060 if (resources.ARM_shader_framebuffer_fetch)
Olli Etuaho2a1e8f92017-07-14 11:49:36 +030061 {
62 extBehavior[TExtension::ARM_shader_framebuffer_fetch] = EBhUndefined;
63 }
Olli Etuaho09b04a22016-12-15 13:30:26 +000064 if (resources.OVR_multiview)
65 {
Olli Etuaho2a1e8f92017-07-14 11:49:36 +030066 extBehavior[TExtension::OVR_multiview] = EBhUndefined;
Olli Etuaho09b04a22016-12-15 13:30:26 +000067 }
Andrei Volykhina5527072017-03-22 16:46:30 +030068 if (resources.EXT_YUV_target)
69 {
Olli Etuaho2a1e8f92017-07-14 11:49:36 +030070 extBehavior[TExtension::EXT_YUV_target] = EBhUndefined;
Andrei Volykhina5527072017-03-22 16:46:30 +030071 }
Jiawei Shaobd924af2017-11-16 15:28:04 +080072 if (resources.EXT_geometry_shader)
Shaob5cc1192017-07-06 10:47:20 +080073 {
Jiawei Shao0e883132017-10-26 09:53:50 +080074 extBehavior[TExtension::EXT_geometry_shader] = EBhUndefined;
Shaob5cc1192017-07-06 10:47:20 +080075 }
Olli Etuahof0d04082018-08-28 16:02:13 +030076 if (resources.OES_texture_storage_multisample_2d_array)
Olli Etuaho8ca60802018-08-23 14:10:02 +030077 {
Olli Etuahof0d04082018-08-28 16:02:13 +030078 extBehavior[TExtension::OES_texture_storage_multisample_2d_array] = EBhUndefined;
Olli Etuaho8ca60802018-08-23 14:10:02 +030079 }
Yizhou Jiangc4533ea2018-09-19 15:23:29 +080080 if (resources.ANGLE_texture_multisample)
81 {
82 extBehavior[TExtension::ANGLE_texture_multisample] = EBhUndefined;
83 }
alokp@chromium.orgad771eb2010-09-07 17:36:23 +000084}
David Yen0fbd1282015-02-02 14:46:09 -080085
86void ResetExtensionBehavior(TExtensionBehavior &extBehavior)
87{
Olli Etuaho703671e2017-11-08 17:47:18 +020088 for (auto &ext : extBehavior)
David Yen0fbd1282015-02-02 14:46:09 -080089 {
Olli Etuaho703671e2017-11-08 17:47:18 +020090 if (ext.first == TExtension::ARB_texture_rectangle)
91 {
92 ext.second = EBhEnable;
93 }
94 else
95 {
96 ext.second = EBhUndefined;
97 }
David Yen0fbd1282015-02-02 14:46:09 -080098 }
99}
Jamie Madill45bcc782016-11-07 13:58:48 -0500100
101} // namespace sh