Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libmupen64plus/mupen64plus-video-rice/src/CombinerDefs.h
2 views
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
enum
30
{
31
MUX_0 = 0,
32
MUX_1,
33
MUX_COMBINED,
34
MUX_TEXEL0,
35
MUX_TEXEL1,
36
MUX_PRIM,
37
MUX_SHADE,
38
MUX_ENV,
39
MUX_COMBALPHA,
40
MUX_T0_ALPHA,
41
MUX_T1_ALPHA,
42
MUX_PRIM_ALPHA,
43
MUX_SHADE_ALPHA,
44
MUX_ENV_ALPHA,
45
MUX_LODFRAC,
46
MUX_PRIMLODFRAC,
47
MUX_K5,
48
MUX_UNK, //Use this if you want to factor to be set to 0
49
50
// Don't change value of these three flags, then need to be within 1 uint8
51
MUX_NEG = 0x20, //Support by NVidia register combiner
52
MUX_ALPHAREPLICATE = 0x40,
53
MUX_COMPLEMENT = 0x80,
54
MUX_FORCE_0 = 0xFE,
55
MUX_ERR = 0xFF,
56
};
57
58
59
enum CombinerFormatType
60
{
61
CM_FMT_TYPE_NOT_USED,
62
CM_FMT_TYPE_D, // = A can mapped to SEL(arg1)
63
CM_FMT_TYPE_A_MOD_C, // = A*C can mapped to MOD(arg1,arg2)
64
CM_FMT_TYPE_A_ADD_D, // = A+D can mapped to ADD(arg1,arg2)
65
CM_FMT_TYPE_A_SUB_B, // = A-B can mapped to SUB(arg1,arg2)
66
CM_FMT_TYPE_A_MOD_C_ADD_D, // = A*C+D can mapped to MULTIPLYADD(arg1,arg2,arg0)
67
CM_FMT_TYPE_A_LERP_B_C, // = (A-B)*C+B can mapped to LERP(arg1,arg2,arg0)
68
// or mapped to BLENDALPHA(arg1,arg2) if C is
69
// alpha channel or DIF, TEX, FAC, CUR
70
CM_FMT_TYPE_A_SUB_B_ADD_D, // = A-B+C can not map very well in 1 stage
71
CM_FMT_TYPE_A_SUB_B_MOD_C, // = (A-B)*C can not map very well in 1 stage
72
CM_FMT_TYPE_A_ADD_B_MOD_C, // = (A+B)*C can not map very well in 1 stage
73
CM_FMT_TYPE_A_B_C_D, // = (A-B)*C+D can not map very well in 1 stage
74
CM_FMT_TYPE_A_B_C_A, // = (A-B)*C+D can not map very well in 1 stage
75
76
// Don't use these two types in default functions
77
CM_FMT_TYPE_AB_ADD_CD, // = A*B+C*D Use by nvidia video cards
78
CM_FMT_TYPE_AB_SUB_CD, // = A*B-C*D Use by nvidia video cards
79
CM_FMT_TYPE_AB_ADD_C, // = A*B+C Use by ATI video cards
80
CM_FMT_TYPE_AB_SUB_C, // = A*B-C Use by ATI video cards
81
CM_FMT_TYPE_NOT_CHECKED = 0xFF,
82
};
83
84
85
typedef enum {
86
ENABLE_BOTH,
87
DISABLE_ALPHA,
88
DISABLE_COLOR,
89
DISABLE_BOTH,
90
COLOR_ONE,
91
ALPHA_ONE,
92
} BlendingFunc;
93
94
95
typedef enum {
96
COLOR_CHANNEL,
97
ALPHA_CHANNEL,
98
} CombineChannel;
99
100
101
102
typedef struct {
103
uint8 a;
104
uint8 b;
105
uint8 c;
106
uint8 d;
107
} N64CombinerType;
108
109
#define CONST_FLAG4(a,b,c,d) (a|(b<<8)|(c<<16)|(d<<24)) //(A-B)*C+D
110
#define CONST_MOD(a,b) (a|(b<<16)) //A*B
111
#define CONST_SEL(a) (a<<24) //=D
112
#define CONST_ADD(a,b) (a|b<<24) //A+D
113
#define CONST_SUB(a,b) (a|b<<8) //A-B
114
#define CONST_MULADD(a,b,c) (a|b<<16|c<<24) //A*C+D
115
116
#define G_CCMUX_TEXEL1 2
117
#define G_ACMUX_TEXEL1 2
118
119
#define NOTUSED MUX_0
120
121
enum { TEX_0=0, TEX_1=1};
122
123
124
125
typedef struct {
126
uint32 op;
127
uint32 Arg1;
128
uint32 Arg2;
129
uint32 Arg0;
130
} StageOperate;
131
132
#endif
133
134
135
136
137