1 /* 2 Copyright (C) 2002 Rice1964 3 4 This program is free software; you can redistribute it and/or 5 modify it under the terms of the GNU General Public License 6 as published by the Free Software Foundation; either version 2 7 of the License, or (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, write to the Free Software 16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 18 */ 19 20 #ifndef _COMBINER_DEFS_H_ 21 #define _COMBINER_DEFS_H_ 22 23 #include "typedefs.h" 24 25 #define MUX_MASK 0x1F 26 #define MUX_MASK_WITH_ALPHA 0x5F 27 #define MUX_MASK_WITH_NEG 0x3F 28 #define MUX_MASK_WITH_COMP 0x9F 29 30 // Combiner constants 31 enum 32 { 33 MUX_0 = 0, 34 MUX_1 = 1, 35 MUX_COMBINED = 2, 36 MUX_TEXEL0 = 3, 37 MUX_TEXEL1 = 4, 38 MUX_PRIM = 5, 39 MUX_SHADE = 6, 40 MUX_ENV = 7, 41 MUX_COMBALPHA = 8, 42 MUX_T0_ALPHA = 9, 43 MUX_T1_ALPHA = 10, 44 MUX_PRIM_ALPHA = 11, 45 MUX_SHADE_ALPHA = 12, 46 MUX_ENV_ALPHA = 13, 47 MUX_LODFRAC = 14, 48 MUX_PRIMLODFRAC = 15, 49 MUX_K5 = 16, 50 MUX_UNK, //Use this if you want to factor to be set to 0 51 52 // Don't change value of these three flags, then need to be within 1 uint8_t 53 MUX_NEG = 0x20, //Support by NVidia register combiner 54 MUX_ALPHAREPLICATE = 0x40, 55 MUX_COMPLEMENT = 0x80, 56 MUX_FORCE_0 = 0xFE, 57 MUX_ERR = 0xFF 58 }; 59 60 61 enum CombinerFormatType 62 { 63 CM_FMT_TYPE_NOT_USED, 64 CM_FMT_TYPE_D, // = A can mapped to SEL(arg1) 65 CM_FMT_TYPE_A_MOD_C, // = A*C can mapped to MOD(arg1,arg2) 66 CM_FMT_TYPE_A_ADD_D, // = A+D can mapped to ADD(arg1,arg2) 67 CM_FMT_TYPE_A_SUB_B, // = A-B can mapped to SUB(arg1,arg2) 68 CM_FMT_TYPE_A_MOD_C_ADD_D, // = A*C+D can mapped to MULTIPLYADD(arg1,arg2,arg0) 69 CM_FMT_TYPE_A_LERP_B_C, // = (A-B)*C+B can mapped to LERP(arg1,arg2,arg0) 70 // or mapped to BLENDALPHA(arg1,arg2) if C is 71 // alpha channel or DIF, TEX, FAC, CUR 72 CM_FMT_TYPE_A_SUB_B_ADD_D, // = A-B+C can not map very well in 1 stage 73 CM_FMT_TYPE_A_SUB_B_MOD_C, // = (A-B)*C can not map very well in 1 stage 74 CM_FMT_TYPE_A_ADD_B_MOD_C, // = (A+B)*C can not map very well in 1 stage 75 CM_FMT_TYPE_A_B_C_D, // = (A-B)*C+D can not map very well in 1 stage 76 CM_FMT_TYPE_A_B_C_A, // = (A-B)*C+D can not map very well in 1 stage 77 78 // Don't use these two types in default functions 79 CM_FMT_TYPE_AB_ADD_CD, // = A*B+C*D Use by nvidia video cards 80 CM_FMT_TYPE_AB_SUB_CD, // = A*B-C*D Use by nvidia video cards 81 CM_FMT_TYPE_AB_ADD_C, // = A*B+C Use by ATI video cards 82 CM_FMT_TYPE_AB_SUB_C, // = A*B-C Use by ATI video cards 83 CM_FMT_TYPE_NOT_CHECKED = 0xFF 84 }; 85 86 87 typedef enum 88 { 89 ENABLE_BOTH, 90 DISABLE_ALPHA, 91 DISABLE_COLOR, 92 DISABLE_BOTH, 93 COLOR_ONE, 94 ALPHA_ONE 95 } BlendingFunc; 96 97 98 typedef enum 99 { 100 COLOR_CHANNEL, 101 ALPHA_CHANNEL 102 } CombineChannel; 103 104 typedef struct 105 { 106 uint8_t a; 107 uint8_t b; 108 uint8_t c; 109 uint8_t d; 110 } N64CombinerType; 111 112 #define CONST_FLAG4(a,b,c,d) (a|(b<<8)|(c<<16)|(d<<24)) //(A-B)*C+D 113 #define CONST_MOD(a,b) (a|(b<<16)) //A*B 114 #define CONST_SEL(a) (a<<24) //=D 115 #define CONST_ADD(a,b) (a|b<<24) //A+D 116 #define CONST_SUB(a,b) (a|b<<8) //A-B 117 #define CONST_MULADD(a,b,c) (a|b<<16|c<<24) //A*C+D 118 119 #define G_CCMUX_TEXEL1 2 120 #define G_ACMUX_TEXEL1 2 121 122 #define NOTUSED MUX_0 123 124 enum 125 { 126 TEX_0=0, 127 TEX_1=1 128 }; 129 130 typedef struct 131 { 132 uint32_t op; 133 uint32_t Arg1; 134 uint32_t Arg2; 135 uint32_t Arg0; 136 } StageOperate; 137 138 #endif 139 140 141 142