2 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
7 #ifndef _BASICTYPES_INCLUDED_
8 #define _BASICTYPES_INCLUDED_
11 // Precision qualifiers
15 // These need to be kept sorted
22 inline const char* getPrecisionString(TPrecision p)
26 case EbpHigh: return "highp"; break;
27 case EbpMedium: return "mediump"; break;
28 case EbpLow: return "lowp"; break;
29 default: return "mediump"; break; // Safest fallback
34 // Basic type. Arrays, vectors, etc., are orthogonal to this.
42 EbtGuardSamplerBegin, // non type: see implementation of IsSampler()
45 EbtSamplerExternalOES, // Only valid if OES_EGL_image_external exists.
46 EbtSampler2DRect, // Only valid if GL_ARB_texture_rectangle exists.
47 EbtGuardSamplerEnd, // non type: see implementation of IsSampler()
49 EbtAddress, // should be deprecated??
50 EbtInvariant // used as a type when qualifying a previously declared variable as being invariant
53 inline const char* getBasicString(TBasicType t)
57 case EbtVoid: return "void"; break;
58 case EbtFloat: return "float"; break;
59 case EbtInt: return "int"; break;
60 case EbtBool: return "bool"; break;
61 case EbtSampler2D: return "sampler2D"; break;
62 case EbtSamplerCube: return "samplerCube"; break;
63 case EbtSamplerExternalOES: return "samplerExternalOES"; break;
64 case EbtSampler2DRect: return "sampler2DRect"; break;
65 case EbtStruct: return "structure"; break;
66 default: return "unknown type";
70 inline bool IsSampler(TBasicType type)
72 return type > EbtGuardSamplerBegin && type < EbtGuardSamplerEnd;
76 // Qualifiers and built-ins. These are mainly used to see what can be read
77 // or written, and by the machine dependent translator to know which registers
78 // to allocate variables in. Since built-ins tend to go to different registers
79 // than varying or uniform, it makes sense they are peers, not sub-classes.
83 EvqTemporary, // For temporaries (within a function), read/write
84 EvqGlobal, // For globals read/write
85 EvqInternal, // For internal use, not visible to the user
86 EvqConst, // User defined constants and non-output parameters in functions
87 EvqAttribute, // Readonly
88 EvqVaryingIn, // readonly, fragment shaders only
89 EvqVaryingOut, // vertex shaders only read/write
90 EvqInvariantVaryingIn, // readonly, fragment shaders only
91 EvqInvariantVaryingOut, // vertex shaders only read/write
92 EvqUniform, // Readonly, vertex and fragment
100 // built-ins written by vertex shader
104 // built-ins read by fragment shader
109 // built-ins written by fragment shader
119 // This is just for debug print out, carried along with the definitions above.
121 inline const char* getQualifierString(TQualifier q)
125 case EvqTemporary: return "Temporary"; break;
126 case EvqGlobal: return "Global"; break;
127 case EvqConst: return "const"; break;
128 case EvqConstReadOnly: return "const"; break;
129 case EvqAttribute: return "attribute"; break;
130 case EvqVaryingIn: return "varying"; break;
131 case EvqVaryingOut: return "varying"; break;
132 case EvqInvariantVaryingIn: return "invariant varying"; break;
133 case EvqInvariantVaryingOut:return "invariant varying"; break;
134 case EvqUniform: return "uniform"; break;
135 case EvqIn: return "in"; break;
136 case EvqOut: return "out"; break;
137 case EvqInOut: return "inout"; break;
138 case EvqPosition: return "Position"; break;
139 case EvqPointSize: return "PointSize"; break;
140 case EvqFragCoord: return "FragCoord"; break;
141 case EvqFrontFacing: return "FrontFacing"; break;
142 case EvqFragColor: return "FragColor"; break;
143 case EvqFragData: return "FragData"; break;
144 case EvqFragDepth: return "FragDepth"; break;
145 default: return "unknown qualifier";
149 #endif // _BASICTYPES_INCLUDED_