ShOperation.hpp

00001 // Sh: A GPU metaprogramming language.
00002 //
00003 // Copyright 2003-2006 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   SH_OP_TEXLOD, 
00113   SH_OP_TEXBIAS, 
00114 
00115   // Conditionals
00116   SH_OP_COND, 
00117 
00118   // Fragment kill
00119   SH_OP_KIL, 
00120 
00121   // Special
00122   SH_OP_OPTBRA, 
00123 
00124 
00125   SH_OP_DECL,   
00126 
00127 
00128 
00129   SH_OP_STARTSEC, 
00130   SH_OP_ENDSEC,  
00131 
00132   // Streams
00133   SH_OP_FETCH, 
00134   SH_OP_LOOKUP, 
00135 
00136 
00137   // Palettes
00138   SH_OP_PAL, 
00139 
00140   SH_OP_COMMENT, 
00141 
00142 
00143   // Control flow
00144   SH_OP_RET,
00145 
00146   SH_OPERATION_END 
00147 };
00148 
00149 #ifdef IGNORE
00150 #undef IGNORE
00151 #endif
00152 
00154 struct
00155 SH_DLLEXPORT
00156 ShOperationInfo {
00157   const char* name; 
00158   int arity; 
00159 
00160   enum ResultSource {
00161     LINEAR,   // dest[i] depends only on src_j[i] for all 0 <= j < arity
00162     ALL,      // dest[i] depends on all elements of src_j for all 0 <= j < arity
00163     EXTERNAL, // Statement yields its results from an external source
00164               // (e.g. TEX)
00165     IGNORE   // Does not yield a result
00166   } result_source;
00167 
00168   bool commutative; 
00169 };
00170 
00171 
00172 SH_DLLEXPORT
00173 extern const ShOperationInfo opInfo[];
00174 
00175 } // namespace SH
00176 
00177 #endif

Generated on Thu Feb 16 14:51:36 2006 for Sh by  doxygen 1.4.6