summarylogtreecommitdiffstats
path: root/chromium-angle-r0.patch
blob: 462b8ae44433360e96e78ac43de07c5e2add94f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
From 030017a4855c7b6e7f2ff8d9566c146f31eb301b Mon Sep 17 00:00:00 2001
From: Kai Ninomiya <kainino@chromium.org>
Date: Wed, 06 Dec 2017 14:06:53 -0800
Subject: [PATCH] Mark StaticType related functions as constexpr

Fixes compilation on some versions of GCC and probably Clang.

Follow-up to http://crrev.com/c/786317

Bug: angleproject:1432
Change-Id: I3fc3ad0f65492f9543eb27fcdce6ca29a9ad06e5
Reviewed-on: https://chromium-review.googlesource.com/812220
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
---

diff --git a/third_party/angle/src/compiler/translator/StaticType.h b/third_party/angle/src/compiler/translator/StaticType.h
index e26e5ff..30b391a 100644
--- a/third_party/angle/src/compiler/translator/StaticType.h
+++ b/third_party/angle/src/compiler/translator/StaticType.h
@@ -160,7 +160,7 @@
           TPrecision precision,
           TQualifier qualifier,
           unsigned char secondarySize>
-const TType *GetForVecMatHelper(unsigned char primarySize)
+constexpr const TType *GetForVecMatHelper(unsigned char primarySize)
 {
     static_assert(basicType == EbtFloat || basicType == EbtInt || basicType == EbtUInt ||
                       basicType == EbtBool,
@@ -186,7 +186,7 @@
 template <TBasicType basicType,
           TPrecision precision = EbpUndefined,
           TQualifier qualifier = EvqGlobal>
-const TType *GetForVecMat(unsigned char primarySize, unsigned char secondarySize = 1)
+constexpr const TType *GetForVecMat(unsigned char primarySize, unsigned char secondarySize = 1)
 {
     static_assert(basicType == EbtFloat || basicType == EbtInt || basicType == EbtUInt ||
                       basicType == EbtBool,
@@ -208,7 +208,7 @@
 }
 
 template <TBasicType basicType, TPrecision precision = EbpUndefined>
-const TType *GetForVec(TQualifier qualifier, unsigned char size)
+constexpr const TType *GetForVec(TQualifier qualifier, unsigned char size)
 {
     switch (qualifier)
     {
diff --git a/third_party/angle/src/compiler/translator/SymbolTable.cpp b/third_party/angle/src/compiler/translator/SymbolTable.cpp
index adf1e4e..90d4c15 100644
--- a/third_party/angle/src/compiler/translator/SymbolTable.cpp
+++ b/third_party/angle/src/compiler/translator/SymbolTable.cpp
@@ -236,7 +236,7 @@
         pop();
 }
 
-bool IsGenType(const TType *type)
+constexpr bool IsGenType(const TType *type)
 {
     if (type)
     {
@@ -248,7 +248,7 @@
     return false;
 }
 
-bool IsVecType(const TType *type)
+constexpr bool IsVecType(const TType *type)
 {
     if (type)
     {
diff --git a/third_party/angle/src/compiler/translator/Types.h b/third_party/angle/src/compiler/translator/Types.h
index 04f46f1..a54d447 100644
--- a/third_party/angle/src/compiler/translator/Types.h
+++ b/third_party/angle/src/compiler/translator/Types.h
@@ -142,13 +142,13 @@
     {
     }
 
-    TBasicType getBasicType() const { return type; }
+    constexpr TBasicType getBasicType() const { return type; }
     void setBasicType(TBasicType t);
 
     TPrecision getPrecision() const { return precision; }
     void setPrecision(TPrecision p) { precision = p; }
 
-    TQualifier getQualifier() const { return qualifier; }
+    constexpr TQualifier getQualifier() const { return qualifier; }
     void setQualifier(TQualifier q) { qualifier = q; }
 
     bool isInvariant() const { return invariant; }