Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenprog_instruction.h
Go to the documentation of this file.
00001 /* 00002 * Mesa 3-D graphics library 00003 * Version: 7.3 00004 * 00005 * Copyright (C) 1999-2008 Brian Paul 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 00025 00037 #ifndef PROG_INSTRUCTION_H 00038 #define PROG_INSTRUCTION_H 00039 00040 00046 #define SWIZZLE_X 0 00047 #define SWIZZLE_Y 1 00048 #define SWIZZLE_Z 2 00049 #define SWIZZLE_W 3 00050 #define SWIZZLE_ZERO 4 00051 #define SWIZZLE_ONE 5 00052 #define SWIZZLE_NIL 7 00054 00055 #define MAKE_SWIZZLE4(a,b,c,d) (((a)<<0) | ((b)<<3) | ((c)<<6) | ((d)<<9)) 00056 #define SWIZZLE_NOOP MAKE_SWIZZLE4(0,1,2,3) 00057 #define GET_SWZ(swz, idx) (((swz) >> ((idx)*3)) & 0x7) 00058 #define GET_BIT(msk, idx) (((msk) >> (idx)) & 0x1) 00059 00060 #define SWIZZLE_XYZW MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W) 00061 #define SWIZZLE_XXXX MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X) 00062 #define SWIZZLE_YYYY MAKE_SWIZZLE4(SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y) 00063 #define SWIZZLE_ZZZZ MAKE_SWIZZLE4(SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z) 00064 #define SWIZZLE_WWWW MAKE_SWIZZLE4(SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W) 00065 00066 00071 #define WRITEMASK_X 0x1 00072 #define WRITEMASK_Y 0x2 00073 #define WRITEMASK_XY 0x3 00074 #define WRITEMASK_Z 0x4 00075 #define WRITEMASK_XZ 0x5 00076 #define WRITEMASK_YZ 0x6 00077 #define WRITEMASK_XYZ 0x7 00078 #define WRITEMASK_W 0x8 00079 #define WRITEMASK_XW 0x9 00080 #define WRITEMASK_YW 0xa 00081 #define WRITEMASK_XYW 0xb 00082 #define WRITEMASK_ZW 0xc 00083 #define WRITEMASK_XZW 0xd 00084 #define WRITEMASK_YZW 0xe 00085 #define WRITEMASK_XYZW 0xf 00086 00093 #define COND_GT 1 00094 #define COND_EQ 2 00095 #define COND_LT 3 00096 #define COND_UN 4 00097 #define COND_GE 5 00098 #define COND_LE 6 00099 #define COND_NE 7 00100 #define COND_TR 8 00101 #define COND_FL 9 00103 00104 00109 #define FLOAT32 0x1 00110 #define FLOAT16 0x2 00111 #define FIXED12 0x4 00112 00119 #define SATURATE_OFF 0 00120 #define SATURATE_ZERO_ONE 1 00121 #define SATURATE_PLUS_MINUS_ONE 2 00122 00129 #define NEGATE_X 0x1 00130 #define NEGATE_Y 0x2 00131 #define NEGATE_Z 0x4 00132 #define NEGATE_W 0x8 00133 #define NEGATE_XYZW 0xf 00134 #define NEGATE_NONE 0x0 00135 00142 typedef enum prog_opcode { 00143 /* ARB_vp ARB_fp NV_vp NV_fp GLSL */ 00144 /*------------------------------------------*/ 00145 OPCODE_NOP = 0, /* X */ 00146 OPCODE_ABS, /* X X 1.1 X */ 00147 OPCODE_ADD, /* X X X X X */ 00148 OPCODE_AND, /* */ 00149 OPCODE_ARA, /* 2 */ 00150 OPCODE_ARL, /* X X */ 00151 OPCODE_ARL_NV, /* 2 */ 00152 OPCODE_ARR, /* 2 */ 00153 OPCODE_BGNLOOP, /* opt */ 00154 OPCODE_BGNSUB, /* opt */ 00155 OPCODE_BRA, /* 2 X */ 00156 OPCODE_BRK, /* 2 opt */ 00157 OPCODE_CAL, /* 2 2 */ 00158 OPCODE_CMP, /* X */ 00159 OPCODE_CONT, /* opt */ 00160 OPCODE_COS, /* X 2 X X */ 00161 OPCODE_DDX, /* X X */ 00162 OPCODE_DDY, /* X X */ 00163 OPCODE_DP2, /* 2 */ 00164 OPCODE_DP2A, /* 2 */ 00165 OPCODE_DP3, /* X X X X X */ 00166 OPCODE_DP4, /* X X X X X */ 00167 OPCODE_DPH, /* X X 1.1 */ 00168 OPCODE_DST, /* X X X X */ 00169 OPCODE_ELSE, /* X */ 00170 OPCODE_END, /* X X X X opt */ 00171 OPCODE_ENDIF, /* opt */ 00172 OPCODE_ENDLOOP, /* opt */ 00173 OPCODE_ENDSUB, /* opt */ 00174 OPCODE_EX2, /* X X 2 X X */ 00175 OPCODE_EXP, /* X X X */ 00176 OPCODE_FLR, /* X X 2 X X */ 00177 OPCODE_FRC, /* X X 2 X X */ 00178 OPCODE_IF, /* opt */ 00179 OPCODE_KIL, /* X */ 00180 OPCODE_KIL_NV, /* X X */ 00181 OPCODE_LG2, /* X X 2 X X */ 00182 OPCODE_LIT, /* X X X X */ 00183 OPCODE_LOG, /* X X X */ 00184 OPCODE_LRP, /* X X */ 00185 OPCODE_MAD, /* X X X X X */ 00186 OPCODE_MAX, /* X X X X X */ 00187 OPCODE_MIN, /* X X X X X */ 00188 OPCODE_MOV, /* X X X X X */ 00189 OPCODE_MUL, /* X X X X X */ 00190 OPCODE_NOISE1, /* X */ 00191 OPCODE_NOISE2, /* X */ 00192 OPCODE_NOISE3, /* X */ 00193 OPCODE_NOISE4, /* X */ 00194 OPCODE_NOT, /* */ 00195 OPCODE_NRM3, /* */ 00196 OPCODE_NRM4, /* */ 00197 OPCODE_OR, /* */ 00198 OPCODE_PK2H, /* X */ 00199 OPCODE_PK2US, /* X */ 00200 OPCODE_PK4B, /* X */ 00201 OPCODE_PK4UB, /* X */ 00202 OPCODE_POW, /* X X X X */ 00203 OPCODE_POPA, /* 3 */ 00204 OPCODE_PRINT, /* X X */ 00205 OPCODE_PUSHA, /* 3 */ 00206 OPCODE_RCC, /* 1.1 */ 00207 OPCODE_RCP, /* X X X X X */ 00208 OPCODE_RET, /* 2 2 */ 00209 OPCODE_RFL, /* X X */ 00210 OPCODE_RSQ, /* X X X X X */ 00211 OPCODE_SCS, /* X */ 00212 OPCODE_SEQ, /* 2 X X */ 00213 OPCODE_SFL, /* 2 X */ 00214 OPCODE_SGE, /* X X X X X */ 00215 OPCODE_SGT, /* 2 X X */ 00216 OPCODE_SIN, /* X 2 X X */ 00217 OPCODE_SLE, /* 2 X X */ 00218 OPCODE_SLT, /* X X X X X */ 00219 OPCODE_SNE, /* 2 X X */ 00220 OPCODE_SSG, /* 2 */ 00221 OPCODE_STR, /* 2 X */ 00222 OPCODE_SUB, /* X X 1.1 X X */ 00223 OPCODE_SWZ, /* X X */ 00224 OPCODE_TEX, /* X 3 X X */ 00225 OPCODE_TXB, /* X 3 X */ 00226 OPCODE_TXD, /* X X */ 00227 OPCODE_TXL, /* 3 2 X */ 00228 OPCODE_TXP, /* X X */ 00229 OPCODE_TXP_NV, /* 3 X */ 00230 OPCODE_TRUNC, /* X */ 00231 OPCODE_UP2H, /* X */ 00232 OPCODE_UP2US, /* X */ 00233 OPCODE_UP4B, /* X */ 00234 OPCODE_UP4UB, /* X */ 00235 OPCODE_X2D, /* X */ 00236 OPCODE_XOR, /* */ 00237 OPCODE_XPD, /* X X X */ 00238 MAX_OPCODE 00239 } gl_inst_opcode; 00240 00241 00246 #define INST_INDEX_BITS 10 00247 00248 00252 struct prog_src_register 00253 { 00254 GLuint File:4; 00255 GLint Index:(INST_INDEX_BITS+1); 00258 GLuint Swizzle:12; 00259 GLuint RelAddr:1; 00260 00276 GLuint NegateBase:4; 00277 00285 GLuint Abs:1; 00286 00290 GLuint NegateAbs:1; 00292 }; 00293 00294 00298 struct prog_dst_register 00299 { 00300 GLuint File:4; 00301 GLuint Index:INST_INDEX_BITS; 00302 GLuint WriteMask:4; 00303 GLuint RelAddr:1; 00304 00319 GLuint CondMask:4; 00320 00324 GLuint CondSwizzle:12; 00325 00332 GLuint CondSrc:1; 00334 GLuint pad:28; 00335 }; 00336 00337 00341 struct prog_instruction 00342 { 00343 gl_inst_opcode Opcode; 00344 #if FEATURE_MESA_program_debug 00345 GLshort StringPos; 00346 #endif 00347 00350 void *Data; 00351 00352 struct prog_src_register SrcReg[3]; 00353 struct prog_dst_register DstReg; 00354 00363 GLuint CondUpdate:1; 00364 00377 GLuint CondDst:1; 00378 00388 GLuint SaturateMode:2; 00389 00396 GLuint Precision:3; 00397 00412 GLuint TexSrcUnit:5; 00413 00417 GLuint TexSrcTarget:3; 00427 GLint BranchTarget; 00428 00433 GLint Sampler; 00434 00435 const char *Comment; 00436 }; 00437 00438 00439 extern void 00440 _mesa_init_instructions(struct prog_instruction *inst, GLuint count); 00441 00442 extern struct prog_instruction * 00443 _mesa_alloc_instructions(GLuint numInst); 00444 00445 extern struct prog_instruction * 00446 _mesa_realloc_instructions(struct prog_instruction *oldInst, 00447 GLuint numOldInst, GLuint numNewInst); 00448 00449 extern struct prog_instruction * 00450 _mesa_copy_instructions(struct prog_instruction *dest, 00451 const struct prog_instruction *src, GLuint n); 00452 00453 extern void 00454 _mesa_free_instructions(struct prog_instruction *inst, GLuint count); 00455 00456 extern GLuint 00457 _mesa_num_inst_src_regs(gl_inst_opcode opcode); 00458 00459 extern GLuint 00460 _mesa_num_inst_dst_regs(gl_inst_opcode opcode); 00461 00462 extern GLboolean 00463 _mesa_is_tex_instruction(gl_inst_opcode opcode); 00464 00465 extern const char * 00466 _mesa_opcode_string(gl_inst_opcode opcode); 00467 00468 00469 #endif /* PROG_INSTRUCTION_H */ Generated on Sun May 27 2012 04:20:34 for ReactOS by
1.7.6.1
|