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 library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
00018 // MA  02110-1301, USA
00020 #ifndef SHOPERATION_HPP
00021 #define SHOPERATION_HPP
00022 
00023 #include "ShDllExport.hpp"
00024 
00025 namespace SH {
00026 
00032 enum ShOperation {
00033   SH_OP_ASN, 
00034 
00035   // Simple arithmetic
00036   SH_OP_NEG, 
00037   SH_OP_ADD, 
00038   SH_OP_MUL, 
00039 
00040   SH_OP_DIV, 
00041 
00042   // Comparisons
00043   // All of the following set dst to either 1 or 0.
00044   SH_OP_SLT, 
00045   SH_OP_SLE, 
00046   SH_OP_SGT, 
00047   SH_OP_SGE, 
00048   SH_OP_SEQ, 
00049   SH_OP_SNE, 
00050 
00051   // The bulk
00052   SH_OP_ABS, 
00053   SH_OP_ACOS, 
00054   SH_OP_ACOSH, 
00055   SH_OP_ASIN, 
00056   SH_OP_ASINH, 
00057   SH_OP_ATAN, 
00058   SH_OP_ATAN2, 
00059   SH_OP_ATANH, 
00060 
00061   SH_OP_CBRT, 
00062   SH_OP_CEIL, 
00063   SH_OP_COS, 
00064   SH_OP_COSH, 
00065   SH_OP_CMUL, 
00066   SH_OP_CSUM, 
00067   SH_OP_DOT, 
00068   SH_OP_DX, 
00069   SH_OP_DY, 
00070 
00071   SH_OP_EXP, 
00072   SH_OP_EXP2, 
00073   SH_OP_EXP10, 
00074   SH_OP_FLR, 
00075   SH_OP_FRAC, 
00076 
00077   SH_OP_HASH, 
00078 
00079   SH_OP_LIT, 
00080   SH_OP_LOG, 
00081   SH_OP_LOG2, 
00082   SH_OP_LOG10, 
00083   SH_OP_LRP, 
00084 
00085   SH_OP_MAD, 
00086   SH_OP_MAX, 
00087   SH_OP_MIN, 
00088   SH_OP_MOD, 
00089 
00090   SH_OP_NOISE, 
00091 
00092   SH_OP_POW, 
00093   SH_OP_RCP, 
00094   SH_OP_RND, 
00095   SH_OP_RSQ, 
00096 
00097   SH_OP_SIN, 
00098   SH_OP_SINH, 
00099   SH_OP_SGN, 
00100   SH_OP_SQRT, 
00101   SH_OP_TAN, 
00102   SH_OP_TANH, 
00103 
00104   // "Vector" operations
00105   SH_OP_NORM, 
00106   SH_OP_XPD, 
00107 
00108   // Textures
00109   SH_OP_TEX, 
00110   SH_OP_TEXI, 
00111   SH_OP_TEXD, 
00112 
00113   // Conditionals
00114   SH_OP_COND, 
00115 
00116   // Fragment kill
00117   SH_OP_KIL, 
00118 
00119   // Special
00120   SH_OP_OPTBRA, 
00121 
00122 
00123   SH_OP_DECL,   
00124 
00125 
00126 
00127   SH_OP_STARTSEC, 
00128   SH_OP_ENDSEC,  
00129 
00130   // Streams
00131   SH_OP_FETCH, 
00132   SH_OP_LOOKUP, 
00133 
00134 
00135   // Palettes
00136   SH_OP_PAL, 
00137 
00138   SH_OP_COMMENT, 
00139 
00140 
00141   // Control flow
00142   SH_OP_RET,
00143 
00144   SH_OPERATION_END, 
00145 };
00146 
00147 #ifdef IGNORE
00148 #undef IGNORE
00149 #endif
00150 
00152 struct
00153 SH_DLLEXPORT
00154 ShOperationInfo {
00155   const char* name; 
00156   int arity; 
00157 
00158   enum ResultSource {
00159     LINEAR,   // dest[i] depends only on src_j[i] for all 0 <= j < arity
00160     ALL,      // dest[i] depends on all elements of src_j for all 0 <= j < arity
00161     EXTERNAL, // Statement yields its results from an external source
00162               // (e.g. TEX)
00163     IGNORE   // Does not yield a result
00164   } result_source;
00165 
00166   bool commutative; 
00167 };
00168 
00169 
00170 SH_DLLEXPORT
00171 extern const ShOperationInfo opInfo[];
00172 
00173 } // namespace SH
00174 
00175 #endif

Generated on Thu Jul 28 17:33:04 2005 for Sh by  doxygen 1.4.3-20050530