Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ShOperation.hpp

00001 // Sh: A GPU metaprogramming language.
00002 //
00003 // Copyright 2003-2005 Serious Hack Inc.
00004 // 
00005 // This software is provided 'as-is', without any express or implied
00006 // warranty. In no event will the authors be held liable for any damages
00007 // arising from the use of this software.
00008 // 
00009 // Permission is granted to anyone to use this software for any purpose,
00010 // including commercial applications, and to alter it and redistribute it
00011 // freely, subject to the following restrictions:
00012 // 
00013 // 1. The origin of this software must not be misrepresented; you must
00014 // not claim that you wrote the original software. If you use this
00015 // software in a product, an acknowledgment in the product documentation
00016 // would be appreciated but is not required.
00017 // 
00018 // 2. Altered source versions must be plainly marked as such, and must
00019 // not be misrepresented as being the original software.
00020 // 
00021 // 3. This notice may not be removed or altered from any source
00022 // distribution.
00024 #ifndef SHOPERATION_HPP
00025 #define SHOPERATION_HPP
00026 
00027 #include "ShDllExport.hpp"
00028 
00029 namespace SH {
00030 
00036 enum ShOperation {
00037   SH_OP_ASN, 
00038 
00039   // Simple arithmetic
00040   SH_OP_NEG, 
00041   SH_OP_ADD, 
00042   SH_OP_MUL, 
00043 
00044   SH_OP_DIV, 
00045 
00046   // Comparisons
00047   // All of the following set dst to either 1 or 0.
00048   SH_OP_SLT, 
00049   SH_OP_SLE, 
00050   SH_OP_SGT, 
00051   SH_OP_SGE, 
00052   SH_OP_SEQ, 
00053   SH_OP_SNE, 
00054 
00055   // The bulk
00056   SH_OP_ABS, 
00057   SH_OP_ACOS, 
00058   SH_OP_ASIN, 
00059   SH_OP_ATAN, 
00060   SH_OP_ATAN2, 
00061 
00062   SH_OP_CBRT, 
00063   SH_OP_CEIL, 
00064   SH_OP_COS, 
00065   SH_OP_COSH, 
00066   SH_OP_CMUL, 
00067   SH_OP_CSUM, 
00068   SH_OP_DOT, 
00069   SH_OP_DX, 
00070   SH_OP_DY, 
00071 
00072   SH_OP_EXP, 
00073   SH_OP_EXP2, 
00074   SH_OP_EXP10, 
00075   SH_OP_FLR, 
00076   SH_OP_FRAC, 
00077 
00078   SH_OP_LIT, 
00079   SH_OP_LOG, 
00080   SH_OP_LOG2, 
00081   SH_OP_LOG10, 
00082   SH_OP_LRP, 
00083 
00084   SH_OP_MAD, 
00085   SH_OP_MAX, 
00086   SH_OP_MIN, 
00087   SH_OP_MOD, 
00088 
00089   SH_OP_POW, 
00090   SH_OP_RCP, 
00091   SH_OP_RND, 
00092   SH_OP_RSQ, 
00093 
00094   SH_OP_SIN, 
00095   SH_OP_SINH, 
00096   SH_OP_SGN, 
00097   SH_OP_SQRT, 
00098   SH_OP_TAN, 
00099   SH_OP_TANH, 
00100 
00101   // "Vector" operations
00102   SH_OP_NORM, 
00103   SH_OP_XPD, 
00104 
00105   // Textures
00106   SH_OP_TEX, 
00107   SH_OP_TEXI, 
00108   SH_OP_TEXD, 
00109 
00110   // Conditionals
00111   SH_OP_COND, 
00112 
00113   // Fragment kill
00114   SH_OP_KIL, 
00115 
00116   // Special
00117   SH_OP_OPTBRA, 
00118 
00119 
00120   SH_OP_DECL,   
00121 
00122 
00123 
00124   SH_OP_STARTSEC, 
00125   SH_OP_ENDSEC,  
00126 
00127   // Streams
00128   SH_OP_FETCH, 
00129   SH_OP_LOOKUP, 
00130 
00131 
00132   // Palettes
00133   SH_OP_PAL, 
00134 
00135   SH_OP_COMMENT, 
00136 
00137 
00138   // Control flow
00139   SH_OP_RET,
00140 
00141   SH_OPERATION_END, 
00142 };
00143 
00144 #ifdef IGNORE
00145 #undef IGNORE
00146 #endif
00147 
00149 struct
00150 SH_DLLEXPORT
00151 ShOperationInfo {
00152   const char* name; 
00153   int arity; 
00154 
00155   enum ResultSource {
00156     LINEAR,   // dest[i] depends only on src_j[i] for all 0 <= j < arity
00157     ALL,      // dest[i] depends on all elements of src_j for all 0 <= j < arity
00158     EXTERNAL, // Statement yields its results from an external source
00159               // (e.g. TEX)
00160     IGNORE   // Does not yield a result
00161   } result_source;
00162 
00163   bool commutative; 
00164 };
00165 
00166 
00167 SH_DLLEXPORT
00168 extern const ShOperationInfo opInfo[];
00169 
00170 } // namespace SH
00171 
00172 #endif

Generated on Wed Jun 15 18:12:41 2005 for Sh by  doxygen 1.4.3-20050530