zenilib: zenilib/jni/external/angle/src/compiler/BaseTypes.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
BaseTypes.h
Go to the documentation of this file.
1 //
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.
5 //
6
7 #ifndef _BASICTYPES_INCLUDED_
8 #define _BASICTYPES_INCLUDED_
9
10 //
11 // Precision qualifiers
12 //
13 enum TPrecision
14 {
15 // These need to be kept sorted
16 EbpUndefined,
17 EbpLow,
18 EbpMedium,
19 EbpHigh
20 };
21
22 inline const char* getPrecisionString(TPrecision p)
23 {
24 switch(p)
25 {
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
30 }
31 }
32
33 //
34 // Basic type. Arrays, vectors, etc., are orthogonal to this.
35 //
36 enum TBasicType
37 {
38 EbtVoid,
39 EbtFloat,
40 EbtInt,
41 EbtBool,
42 EbtGuardSamplerBegin, // non type: see implementation of IsSampler()
43 EbtSampler2D,
44 EbtSamplerCube,
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()
48 EbtStruct,
49 EbtAddress, // should be deprecated??
50 EbtInvariant // used as a type when qualifying a previously declared variable as being invariant
51 };
52
53 inline const char* getBasicString(TBasicType t)
54 {
55 switch (t)
56 {
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";
67 }
68 }
69
70 inline bool IsSampler(TBasicType type)
71 {
72 return type > EbtGuardSamplerBegin && type < EbtGuardSamplerEnd;
73 }
74
75 //
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.
80 //
81 enum TQualifier
82 {
83 EvqTemporary, // For temporaries (within a function), read/write
84 EvqGlobal, // For globals read/write
85 EvqConst, // User defined constants and non-output parameters in functions
86 EvqAttribute, // Readonly
87 EvqVaryingIn, // readonly, fragment shaders only
88 EvqVaryingOut, // vertex shaders only read/write
89 EvqInvariantVaryingIn, // readonly, fragment shaders only
90 EvqInvariantVaryingOut, // vertex shaders only read/write
91 EvqUniform, // Readonly, vertex and fragment
92
93 // parameters
94 EvqIn,
95 EvqOut,
96 EvqInOut,
97 EvqConstReadOnly,
98
99 // built-ins written by vertex shader
100 EvqPosition,
101 EvqPointSize,
102
103 // built-ins read by fragment shader
104 EvqFragCoord,
105 EvqFrontFacing,
106 EvqPointCoord,
107
108 // built-ins written by fragment shader
109 EvqFragColor,
110 EvqFragData,
111 EvqFragDepth,
112
113 // end of list
114 EvqLast
115 };
116
117 //
118 // This is just for debug print out, carried along with the definitions above.
119 //
120 inline const char* getQualifierString(TQualifier q)
121 {
122 switch(q)
123 {
124 case EvqTemporary: return "Temporary"; break;
125 case EvqGlobal: return "Global"; break;
126 case EvqConst: return "const"; break;
127 case EvqConstReadOnly: return "const"; break;
128 case EvqAttribute: return "attribute"; break;
129 case EvqVaryingIn: return "varying"; break;
130 case EvqVaryingOut: return "varying"; break;
131 case EvqInvariantVaryingIn: return "invariant varying"; break;
132 case EvqInvariantVaryingOut:return "invariant varying"; break;
133 case EvqUniform: return "uniform"; break;
134 case EvqIn: return "in"; break;
135 case EvqOut: return "out"; break;
136 case EvqInOut: return "inout"; break;
137 case EvqPosition: return "Position"; break;
138 case EvqPointSize: return "PointSize"; break;
139 case EvqFragCoord: return "FragCoord"; break;
140 case EvqFrontFacing: return "FrontFacing"; break;
141 case EvqFragColor: return "FragColor"; break;
142 case EvqFragData: return "FragData"; break;
143 case EvqFragDepth: return "FragDepth"; break;
144 default: return "unknown qualifier";
145 }
146 }
147
148 #endif // _BASICTYPES_INCLUDED_
EbtStruct
Definition: BaseTypes.h:48
TQualifier
TQualifier
Definition: BaseTypes.h:81
EbtVoid
Definition: BaseTypes.h:38
type
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
Definition: gl2ext.h:845
EvqUniform
Definition: BaseTypes.h:91
getPrecisionString
const char * getPrecisionString(TPrecision p)
Definition: BaseTypes.h:22
EvqVaryingOut
Definition: BaseTypes.h:88
EbtGuardSamplerEnd
Definition: BaseTypes.h:47
IsSampler
bool IsSampler(TBasicType type)
Definition: BaseTypes.h:70
EvqInvariantVaryingOut
Definition: BaseTypes.h:90
t
GLdouble GLdouble t
Definition: glew.h:1384
EvqGlobal
Definition: BaseTypes.h:84
EbtAddress
Definition: BaseTypes.h:49
EbtInt
Definition: BaseTypes.h:40
EvqTemporary
Definition: BaseTypes.h:83
EbpHigh
Definition: BaseTypes.h:19
EvqPointSize
Definition: BaseTypes.h:101
EbtFloat
Definition: BaseTypes.h:39
EbpUndefined
Definition: BaseTypes.h:16
EvqPosition
Definition: BaseTypes.h:100
EvqIn
Definition: BaseTypes.h:94
EbtGuardSamplerBegin
Definition: BaseTypes.h:42
EvqInOut
Definition: BaseTypes.h:96
EbtSampler2D
Definition: BaseTypes.h:43
EvqFragCoord
Definition: BaseTypes.h:104
EbpMedium
Definition: BaseTypes.h:18
EvqAttribute
Definition: BaseTypes.h:86
getBasicString
const char * getBasicString(TBasicType t)
Definition: BaseTypes.h:53
EvqConst
Definition: BaseTypes.h:85
EbtInvariant
Definition: BaseTypes.h:50
p
GLfloat GLfloat p
Definition: glew.h:14938
EvqPointCoord
Definition: BaseTypes.h:106
EbtBool
Definition: BaseTypes.h:41
EbtSampler2DRect
Definition: BaseTypes.h:46
TBasicType
TBasicType
Definition: BaseTypes.h:36
EvqFragDepth
Definition: BaseTypes.h:111
EbtSamplerCube
Definition: BaseTypes.h:44
EvqFragColor
Definition: BaseTypes.h:109
q
GLdouble GLdouble GLdouble GLdouble q
Definition: glew.h:1400
EvqVaryingIn
Definition: BaseTypes.h:87
getQualifierString
const char * getQualifierString(TQualifier q)
Definition: BaseTypes.h:120
EvqConstReadOnly
Definition: BaseTypes.h:97
EvqLast
Definition: BaseTypes.h:114
TPrecision
TPrecision
Definition: BaseTypes.h:13
EvqFragData
Definition: BaseTypes.h:110
EvqInvariantVaryingIn
Definition: BaseTypes.h:89
EbpLow
Definition: BaseTypes.h:17
EvqFrontFacing
Definition: BaseTypes.h:105
EbtSamplerExternalOES
Definition: BaseTypes.h:45
EvqOut
Definition: BaseTypes.h:95