Commit 7322195e by Nicolas Capens

Use safer typed enums.

Bug 19331817 Change-Id: I75787c6a9df3bca539dcaf3a1d3f0e49994c73b4 Reviewed-on: https://swiftshader-review.googlesource.com/2390Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent e9233fb7
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// //
// Precision qualifiers // Precision qualifiers
// //
enum TPrecision enum TPrecision : unsigned char
{ {
// These need to be kept sorted // These need to be kept sorted
EbpUndefined, EbpUndefined,
...@@ -33,7 +33,7 @@ inline const char* getPrecisionString(TPrecision p) ...@@ -33,7 +33,7 @@ inline const char* getPrecisionString(TPrecision p)
// //
// Basic type. Arrays, vectors, etc., are orthogonal to this. // Basic type. Arrays, vectors, etc., are orthogonal to this.
// //
enum TBasicType enum TBasicType : unsigned char
{ {
EbtVoid, EbtVoid,
EbtFloat, EbtFloat,
...@@ -97,7 +97,7 @@ inline bool IsSampler(TBasicType type) ...@@ -97,7 +97,7 @@ inline bool IsSampler(TBasicType type)
// to allocate variables in. Since built-ins tend to go to different registers // to allocate variables in. Since built-ins tend to go to different registers
// than varying or uniform, it makes sense they are peers, not sub-classes. // than varying or uniform, it makes sense they are peers, not sub-classes.
// //
enum TQualifier enum TQualifier : unsigned char
{ {
EvqTemporary, // For temporaries (within a function), read/write EvqTemporary, // For temporaries (within a function), read/write
EvqGlobal, // For globals read/write EvqGlobal, // For globals read/write
......
...@@ -241,17 +241,17 @@ protected: ...@@ -241,17 +241,17 @@ protected:
int getStructSize() const; int getStructSize() const;
void computeDeepestStructNesting(); void computeDeepestStructNesting();
TBasicType type : 6; TBasicType type;
TPrecision precision; TPrecision precision;
TQualifier qualifier : 7; TQualifier qualifier;
int size : 8; // size of vector or matrix, not size of array unsigned char size; // size of vector or matrix, not size of array
unsigned int matrix : 1; bool matrix;
unsigned int array : 1; bool array;
int arraySize; int arraySize;
int maxArraySize; int maxArraySize;
TType* arrayInformationType; TType *arrayInformationType;
TTypeList* structure; // 0 unless this is a struct TTypeList *structure; // 0 unless this is a struct
mutable int structureSize; mutable int structureSize;
int deepestStructNesting; int deepestStructNesting;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment