| 1 | Submitted By: DJ Lucas <dj_AT_linuxfromscratch_DOT_org> |
| 2 | Date: 2018-01-28 |
| 3 | Initial Package Version: 64.0.3282.119 |
| 4 | Upstream Status: Committed |
| 5 | Origin: Upstream |
| 6 | Description: Corrects error call to non-constexpr function |
| 7 | |
| 8 | |
| 9 | From 030017a4855c7b6e7f2ff8d9566c146f31eb301b Mon Sep 17 00:00:00 2001 |
| 10 | From: Kai Ninomiya <kainino@chromium.org> |
| 11 | Date: Wed, 06 Dec 2017 14:06:53 -0800 |
| 12 | Subject: [PATCH] Mark StaticType related functions as constexpr |
| 13 | |
| 14 | Fixes compilation on some versions of GCC and probably Clang. |
| 15 | |
| 16 | Follow-up to http://crrev.com/c/786317 |
| 17 | |
| 18 | Bug: angleproject:1432 |
| 19 | Change-Id: I3fc3ad0f65492f9543eb27fcdce6ca29a9ad06e5 |
| 20 | Reviewed-on: https://chromium-review.googlesource.com/812220 |
| 21 | Reviewed-by: Jamie Madill <jmadill@chromium.org> |
| 22 | Commit-Queue: Kai Ninomiya <kainino@chromium.org> |
| 23 | --- |
| 24 | |
| 25 | diff --git a/third_party/angle/src/compiler/translator/StaticType.h b/third_party/angle/src/compiler/translator/StaticType.h |
| 26 | index e26e5ff..30b391a 100644 |
| 27 | --- a/third_party/angle/src/compiler/translator/StaticType.h |
| 28 | +++ b/third_party/angle/src/compiler/translator/StaticType.h |
| 29 | @@ -160,7 +160,7 @@ |
| 30 | TPrecision precision, |
| 31 | TQualifier qualifier, |
| 32 | unsigned char secondarySize> |
| 33 | -const TType *GetForVecMatHelper(unsigned char primarySize) |
| 34 | +constexpr const TType *GetForVecMatHelper(unsigned char primarySize) |
| 35 | { |
| 36 | static_assert(basicType == EbtFloat || basicType == EbtInt || basicType == EbtUInt || |
| 37 | basicType == EbtBool, |
| 38 | @@ -186,7 +186,7 @@ |
| 39 | template <TBasicType basicType, |
| 40 | TPrecision precision = EbpUndefined, |
| 41 | TQualifier qualifier = EvqGlobal> |
| 42 | -const TType *GetForVecMat(unsigned char primarySize, unsigned char secondarySize = 1) |
| 43 | +constexpr const TType *GetForVecMat(unsigned char primarySize, unsigned char secondarySize = 1) |
| 44 | { |
| 45 | static_assert(basicType == EbtFloat || basicType == EbtInt || basicType == EbtUInt || |
| 46 | basicType == EbtBool, |
| 47 | @@ -208,7 +208,7 @@ |
| 48 | } |
| 49 | |
| 50 | template <TBasicType basicType, TPrecision precision = EbpUndefined> |
| 51 | -const TType *GetForVec(TQualifier qualifier, unsigned char size) |
| 52 | +constexpr const TType *GetForVec(TQualifier qualifier, unsigned char size) |
| 53 | { |
| 54 | switch (qualifier) |
| 55 | { |
| 56 | diff --git a/third_party/angle/src/compiler/translator/SymbolTable.cpp b/third_party/angle/src/compiler/translator/SymbolTable.cpp |
| 57 | index adf1e4e..90d4c15 100644 |
| 58 | --- a/third_party/angle/src/compiler/translator/SymbolTable.cpp |
| 59 | +++ b/third_party/angle/src/compiler/translator/SymbolTable.cpp |
| 60 | @@ -236,7 +236,7 @@ |
| 61 | pop(); |
| 62 | } |
| 63 | |
| 64 | -bool IsGenType(const TType *type) |
| 65 | +constexpr bool IsGenType(const TType *type) |
| 66 | { |
| 67 | if (type) |
| 68 | { |
| 69 | @@ -248,7 +248,7 @@ |
| 70 | return false; |
| 71 | } |
| 72 | |
| 73 | -bool IsVecType(const TType *type) |
| 74 | +constexpr bool IsVecType(const TType *type) |
| 75 | { |
| 76 | if (type) |
| 77 | { |
| 78 | diff --git a/third_party/angle/src/compiler/translator/Types.h b/third_party/angle/src/compiler/translator/Types.h |
| 79 | index 04f46f1..a54d447 100644 |
| 80 | --- a/third_party/angle/src/compiler/translator/Types.h |
| 81 | +++ b/third_party/angle/src/compiler/translator/Types.h |
| 82 | @@ -142,13 +142,13 @@ |
| 83 | { |
| 84 | } |
| 85 | |
| 86 | - TBasicType getBasicType() const { return type; } |
| 87 | + constexpr TBasicType getBasicType() const { return type; } |
| 88 | void setBasicType(TBasicType t); |
| 89 | |
| 90 | TPrecision getPrecision() const { return precision; } |
| 91 | void setPrecision(TPrecision p) { precision = p; } |
| 92 | |
| 93 | - TQualifier getQualifier() const { return qualifier; } |
| 94 | + constexpr TQualifier getQualifier() const { return qualifier; } |
| 95 | void setQualifier(TQualifier q) { qualifier = q; } |
| 96 | |
| 97 | bool isInvariant() const { return invariant; } |
| 98 | |