Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenslang_ir.h
Go to the documentation of this file.
00001 /* 00002 * Mesa 3-D graphics library 00003 * 00004 * Copyright (C) 2005-2008 Brian Paul All Rights Reserved. 00005 * Copyright (C) 2009 VMware, Inc. All Rights Reserved. 00006 * 00007 * Permission is hereby granted, free of charge, to any person obtaining a 00008 * copy of this software and associated documentation files (the "Software"), 00009 * to deal in the Software without restriction, including without limitation 00010 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00011 * and/or sell copies of the Software, and to permit persons to whom the 00012 * Software is furnished to do so, subject to the following conditions: 00013 * 00014 * The above copyright notice and this permission notice shall be included 00015 * in all copies or substantial portions of the Software. 00016 * 00017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00018 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00019 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00020 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 00021 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00022 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00023 */ 00024 00032 #ifndef SLANG_IR_H 00033 #define SLANG_IR_H 00034 00035 00036 #include "main/imports.h" 00037 #include "slang_compile.h" 00038 #include "slang_label.h" 00039 #include "main/mtypes.h" 00040 00041 00045 typedef enum 00046 { 00047 IR_NOP = 0, 00048 IR_SEQ, /* sequence (eval left, then right) */ 00049 IR_SCOPE, /* new variable scope (one child) */ 00050 00051 IR_LABEL, /* target of a jump or cjump */ 00052 00053 IR_COND, /* conditional expression/predicate */ 00054 00055 IR_IF, /* high-level IF/then/else */ 00056 /* Children[0] = conditional expression */ 00057 /* Children[1] = if-true part */ 00058 /* Children[2] = if-else part, or NULL */ 00059 00060 IR_BEGIN_SUB, /* begin subroutine */ 00061 IR_END_SUB, /* end subroutine */ 00062 IR_RETURN, /* return from subroutine */ 00063 IR_CALL, /* call subroutine */ 00064 00065 IR_LOOP, /* high-level loop-begin / loop-end */ 00066 /* Children[0] = loop body */ 00067 /* Children[1] = loop tail code, or NULL */ 00068 00069 IR_CONT, /* continue loop */ 00070 /* n->Parent = ptr to parent IR_LOOP Node */ 00071 IR_BREAK, /* break loop */ 00072 00073 IR_BREAK_IF_TRUE, 00074 IR_CONT_IF_TRUE, 00075 00076 IR_COPY, 00077 IR_MOVE, 00079 /* vector ops: */ 00080 IR_ADD, 00081 IR_SUB, 00082 IR_MUL, 00083 IR_DIV, 00084 IR_DOT4, 00085 IR_DOT3, 00086 IR_DOT2, 00087 IR_NRM4, 00088 IR_NRM3, 00089 IR_CROSS, /* vec3 cross product */ 00090 IR_LRP, 00091 IR_CLAMP, 00092 IR_MIN, 00093 IR_MAX, 00094 IR_SEQUAL, /* Set if args are equal (vector) */ 00095 IR_SNEQUAL, /* Set if args are not equal (vector) */ 00096 IR_SGE, /* Set if greater or equal (vector) */ 00097 IR_SGT, /* Set if greater than (vector) */ 00098 IR_SLE, /* Set if less or equal (vector) */ 00099 IR_SLT, /* Set if less than (vector) */ 00100 IR_POW, /* x^y */ 00101 IR_EXP, /* e^x */ 00102 IR_EXP2, /* 2^x */ 00103 IR_LOG2, /* log base 2 */ 00104 IR_RSQ, /* 1/sqrt() */ 00105 IR_RCP, /* reciprocol */ 00106 IR_FLOOR, 00107 IR_FRAC, 00108 IR_ABS, /* absolute value */ 00109 IR_NEG, /* negate */ 00110 IR_DDX, /* derivative w.r.t. X */ 00111 IR_DDY, /* derivative w.r.t. Y */ 00112 IR_SIN, /* sine */ 00113 IR_COS, /* cosine */ 00114 IR_NOISE1, /* noise(x) */ 00115 IR_NOISE2, /* noise(x, y) */ 00116 IR_NOISE3, /* noise(x, y, z) */ 00117 IR_NOISE4, /* noise(x, y, z, w) */ 00118 00119 IR_EQUAL, /* boolean equality */ 00120 IR_NOTEQUAL,/* boolean inequality */ 00121 IR_NOT, /* boolean not */ 00122 00123 IR_VAR, /* variable reference */ 00124 IR_VAR_DECL,/* var declaration */ 00125 00126 IR_ELEMENT, /* array element */ 00127 IR_FIELD, /* struct field */ 00128 IR_SWIZZLE, /* swizzled storage access */ 00129 00130 IR_TEX, /* texture lookup */ 00131 IR_TEXB, /* texture lookup with LOD bias */ 00132 IR_TEXP, /* texture lookup with projection */ 00133 00134 IR_FLOAT, 00135 IR_I_TO_F, /* int[4] to float[4] conversion */ 00136 IR_F_TO_I, /* float[4] to int[4] conversion */ 00137 00138 IR_KILL /* fragment kill/discard */ 00139 } slang_ir_opcode; 00140 00141 00168 struct slang_ir_storage_ 00169 { 00170 enum register_file File; 00171 GLint Index; 00172 GLint Size; 00173 GLuint Swizzle; 00174 GLint RefCount; 00176 GLboolean RelAddr; /* we'll remove this eventually */ 00177 00178 GLboolean IsIndirect; 00179 enum register_file IndirectFile; 00180 GLint IndirectIndex; 00181 GLuint IndirectSwizzle; 00182 GLuint TexTarget; 00187 struct slang_ir_storage_ *Parent; 00188 }; 00189 00190 typedef struct slang_ir_storage_ slang_ir_storage; 00191 00192 00197 typedef struct slang_ir_node_ 00198 { 00199 slang_ir_opcode Opcode; 00200 struct slang_ir_node_ *Children[3]; 00201 slang_ir_storage *Store; 00202 GLint InstLocation; 00205 const char *Field; 00206 GLfloat Value[4]; 00207 slang_variable *Var; 00208 struct slang_ir_node_ *List; 00209 struct slang_ir_node_ *Parent; 00210 slang_label *Label; 00211 } slang_ir_node; 00212 00213 00214 00218 typedef struct 00219 { 00220 slang_ir_opcode IrOpcode; 00221 const char *IrName; 00222 gl_inst_opcode InstOpcode; 00223 GLuint ResultSize, NumParams; 00224 } slang_ir_info; 00225 00226 00227 00228 extern const slang_ir_info * 00229 _slang_ir_info(slang_ir_opcode opcode); 00230 00231 00232 extern void 00233 _slang_init_ir_storage(slang_ir_storage *st, 00234 enum register_file file, GLint index, GLint size, 00235 GLuint swizzle); 00236 00237 extern slang_ir_storage * 00238 _slang_new_ir_storage(enum register_file file, GLint index, GLint size); 00239 00240 00241 extern slang_ir_storage * 00242 _slang_new_ir_storage_swz(enum register_file file, GLint index, GLint size, 00243 GLuint swizzle); 00244 00245 extern slang_ir_storage * 00246 _slang_new_ir_storage_relative(GLint index, GLint size, 00247 slang_ir_storage *parent); 00248 00249 00250 extern slang_ir_storage * 00251 _slang_new_ir_storage_indirect(enum register_file file, 00252 GLint index, 00253 GLint size, 00254 enum register_file indirectFile, 00255 GLint indirectIndex, 00256 GLuint indirectSwizzle); 00257 00258 extern slang_ir_storage * 00259 _slang_new_ir_storage_sampler(GLint sampNum, GLuint texTarget, GLint size); 00260 00261 00262 extern void 00263 _slang_copy_ir_storage(slang_ir_storage *dst, const slang_ir_storage *src); 00264 00265 00266 extern void 00267 _slang_free_ir_tree(slang_ir_node *n); 00268 00269 00270 extern void 00271 _slang_print_ir_tree(const slang_ir_node *n, int indent); 00272 00273 00274 #endif /* SLANG_IR_H */ Generated on Sat May 26 2012 04:19:27 for ReactOS by
1.7.6.1
|