updated some printfs, added comment about sched_yield
[mesa.git] / src / mesa / shader / slang / Include / BaseTypes.h
1 //
2 //Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
3 //All rights reserved.
4 //
5 //Redistribution and use in source and binary forms, with or without
6 //modification, are permitted provided that the following conditions
7 //are met:
8 //
9 // Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following
14 // disclaimer in the documentation and/or other materials provided
15 // with the distribution.
16 //
17 // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
18 // contributors may be used to endorse or promote products derived
19 // from this software without specific prior written permission.
20 //
21 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 //"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 //LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 //FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 //COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 //INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 //BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 //CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 //LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 //POSSIBILITY OF SUCH DAMAGE.
33 //
34
35 #ifndef _BASICTYPES_INCLUDED_
36 #define _BASICTYPES_INCLUDED_
37
38 //
39 // Basic type. Arrays, vectors, etc., are orthogonal to this.
40 //
41 enum TBasicType {
42 EbtVoid,
43 EbtFloat,
44 EbtInt,
45 EbtBool,
46 EbtSampler1D,
47 EbtSampler2D,
48 EbtSampler3D,
49 EbtSamplerCube,
50 EbtSampler1DShadow,
51 EbtSampler2DShadow,
52 EbtStruct,
53 EbtAddress
54 };
55
56 __inline bool IsSampler(TBasicType type)
57 {
58 return type >= EbtSampler1D && type <= EbtSampler2DShadow;
59 }
60
61 //
62 // Qualifiers and built-ins. These are mainly used to see what can be read
63 // or written, and by the machine dependent translator to know which registers
64 // to allocate variables in. Since built-ins tend to go to different registers
65 // than varying or uniform, it makes sense they are peers, not sub-classes.
66 //
67 enum TQualifier {
68 EvqTemporary, // For temporaries (within a function), read/write
69 EvqGlobal, // For globals read/write
70 EvqConst, // User defined constants and non-output parameters in functions
71 EvqAttribute, // Readonly
72 EvqVaryingIn, // readonly, fragment shaders only
73 EvqVaryingOut, // vertex shaders only read/write
74 EvqUniform, // Readonly, vertex and fragment
75
76 // pack/unpack input and output
77 EvqInput,
78 EvqOutput,
79
80 // parameters
81 EvqIn,
82 EvqOut,
83 EvqInOut,
84 EvqConstReadOnly,
85
86 // built-ins written by vertex shader
87 EvqPosition,
88 EvqPointSize,
89 EvqClipVertex,
90
91 // built-ins read by fragment shader
92 EvqFace,
93 EvqFragCoord,
94
95 // built-ins written by fragment shader
96 EvqFragColor,
97 EvqFragDepth,
98
99 // end of list
100 EvqLast
101 };
102
103 //
104 // This is just for debug print out, carried along with the definitions above.
105 //
106 __inline const char* getQualifierString(TQualifier q)
107 {
108 switch (q) {
109 case EvqTemporary: return "Temporary"; break;
110 case EvqGlobal: return "Global"; break;
111 case EvqConst: return "const"; break;
112 case EvqConstReadOnly: return "const"; break;
113 case EvqAttribute: return "attribute"; break;
114 case EvqVaryingIn: return "varying"; break;
115 case EvqVaryingOut: return "varying"; break;
116 case EvqUniform: return "uniform"; break;
117 case EvqIn: return "in"; break;
118 case EvqOut: return "out"; break;
119 case EvqInOut: return "inout"; break;
120 case EvqInput: return "input"; break;
121 case EvqOutput: return "output"; break;
122 case EvqPosition: return "Position"; break;
123 case EvqPointSize: return "PointSize"; break;
124 case EvqClipVertex: return "ClipVertex"; break;
125 case EvqFace: return "Face"; break;
126 case EvqFragCoord: return "FragCoord"; break;
127 case EvqFragColor: return "FragColor"; break;
128 case EvqFragDepth: return "FragDepth"; break;
129 default: return "unknown qualifier";
130 }
131 }
132
133 #endif // _BASICTYPES_INCLUDED_