Unify extension behavior checks
Some supportsExtension and isExtensionEnabled checks are now turned
into checkCanUseExtension checks. Using checkCanUseExtension is
preferable so that warnings are generated correctly when an extension
is used and a warn directive is present.
isExtensionEnabled is still used in some places where an error message
about the extension could be confusing, particularly when a core spec
version adds support for something that is also present in an
extension.
Also make it possible to disable ARB_texture_rectangle extension using
an extension directive. ARB_texture_rectangle extension functionality
is enabled by default in GLSL when the extension is supported.
BUG=angleproject:2238
TEST=angle_unittests
Change-Id: I7455293412ff469f54bc7da79df146e7bc127379
Reviewed-on: https://chromium-review.googlesource.com/760737
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/ParseContext.h b/src/compiler/translator/ParseContext.h
index 12924d1..c611b31 100644
--- a/src/compiler/translator/ParseContext.h
+++ b/src/compiler/translator/ParseContext.h
@@ -141,6 +141,15 @@
void checkIsParameterQualifierValid(const TSourceLoc &line,
const TTypeQualifierBuilder &typeQualifierBuilder,
TType *type);
+
+ // Check if at least one of the specified extensions can be used, and generate error/warning as
+ // appropriate according to the spec.
+ // This function is only needed for a few different small constant sizes of extension array, and
+ // we want to avoid unnecessary dynamic allocations. That's why checkCanUseOneOfExtensions is a
+ // template function rather than one taking a vector.
+ template <size_t size>
+ bool checkCanUseOneOfExtensions(const TSourceLoc &line,
+ const std::array<TExtension, size> &extensions);
bool checkCanUseExtension(const TSourceLoc &line, TExtension extension);
// Done for all declarations, whether empty or not.
@@ -171,7 +180,7 @@
{
return mDirectiveHandler.extensionBehavior();
}
- bool supportsExtension(TExtension extension);
+
bool isExtensionEnabled(TExtension extension) const;
void handleExtensionDirective(const TSourceLoc &loc, const char *extName, const char *behavior);
void handlePragmaDirective(const TSourceLoc &loc,