Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/GPU/Debugger/GECommandTable.h
3186 views
1
// Copyright (c) 2022- PPSSPP Project.
2
3
// This program is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, version 2.0 or later versions.
6
7
// This program is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
// GNU General Public License 2.0 for more details.
11
12
// A copy of the GPL 2.0 should have been included with the program.
13
// If not, see http://www.gnu.org/licenses/
14
15
// Official git repository and contact information can be found at
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
17
18
#pragma once
19
20
#include <cstdint>
21
22
#include "GPU/ge_constants.h"
23
24
enum class GECmdFormat {
25
DATA, // Just regular data.
26
DATA16, // Data, but only 16 bits of it used.
27
DATA8, // 8 bits value (alpha, etc.)
28
NONE, // Should have no arguments or value.
29
RELATIVE_ADDR, // 24 bits added to base + offset.
30
PRIM, // 16 bits count, 3 bits type.
31
BEZIER, // 8 bits ucount, 8 bits vcount.
32
SPLINE, // 8 bits ucount, 8 bits vcount, 2 bits utype, 2 bits vtype.
33
JUMP, // Like RELATIVE_ADDR, but lower 2 bits ignored.
34
SIGNAL, // 16 bits data, 8 bits signal type.
35
HIGH_ADDR_ONLY, // 16 bits ignored, 8 bits for a high address.
36
LOW_ADDR_ONLY, // 24 bits low address.
37
LOW_ADDR, // 24 bits low address.
38
HIGH_ADDR, // 16 bits ignored, 8 bits for a high address.
39
VERTEX_TYPE, // 24-bits of vtype flags (complex.)
40
OFFSET_ADDR, // 24 bits become the high bits of offset.
41
X10_Y10, // 10 bits X, 10 bits Y.
42
FLAG, // 1 bit on/off.
43
BONE_NUM, // 7 bits number.
44
MATRIX_NUM, // 4 bits number.
45
FLOAT, // 24 bits float data.
46
PATCH_DIVISION, // 8 bits divisionu, 8 bits divisionv.
47
PATCH_PRIM, // 2 bits primitive type.
48
SUBPIXEL_COORD, // 4 bits subpixel, 12 bits integer value.
49
MATERIAL_UPDATE, // 3 bits colors to update.
50
RGB, // 24 bits RGB color.
51
LIGHT_TYPE, // 8 bits computation (2 bits), 2 bits type.
52
STRIDE, // 11 bits.
53
STRIDE_HIGH_ADDR, // 11 bits stride, 5 ignored, 8 bits high address.
54
TEX_SIZE, // 4 bits width power, 4 bits ignored, 4 bits height power.
55
TEX_MAP_MODE, // 8 bits mode (2 bits), 2 bits matrix factor.
56
TEX_LIGHT_SRC, // 8 bits lightu (2 bits), 2 bits lightv.
57
TEX_MODE, // 8 bits swizzle (1 bit), 8 bits separate clut4 (1 bit), 3 bits max level.
58
TEX_FORMAT, // 4 bits format.
59
TEX_FILTER, // 3 bits minify mode, 5 bits ignored, 1 bit magnify mode.
60
TEX_CLAMP, // 1 bit clampu, 7 bits ignored, 1 bit clampv.
61
TEX_LEVEL_MODE, // 2 bits mode, 15 bits ignored, 4.4 (8 bits) bias.
62
TEX_FUNC, // 3 bits function, 5 bits ignored, 1 bit use alpha, 7 bits ignored, 1 bit double color.
63
CLUT_BLOCKS, // 6 bits block count.
64
CLUT_FORMAT, // 2 bits format, 5 bits shift, 1 bit ignored, 8 bits mask, 5 bits base.
65
CLEAR_MODE, // 1 bit on, 7 bits ignored, 3 bits aspect.
66
COLOR_TEST_FUNC, // 2 bits test function.
67
ALPHA_TEST, // 3 bits function, 5 bits ignored, 8 bits ref, 8 bits mask.
68
STENCIL_OP, // 8 bits sfail (3 bits), 8 bits zfail (3 bits), 8 bits zpass (3 bits.)
69
DEPTH_TEST_FUNC, // 3 bits function.
70
BLEND_MODE, // 4 bits srcfactor, 4 bits dstfactor, 3 bits equation.
71
DITHER_ROW, // 4 s.3.0 fixed point dither offsets.
72
LOGIC_OP, // 4 bits logic operation.
73
ALPHA_PRIM, // 8 bits alpha, 3 bits primitive type, 1 bit antialias, 6 bit clip?, 1 bit shading, 1 bit cullenable, 1 bit cullface, 1 bit tex enable, 1 bit fog, 1 bit dither.
74
};
75
76
// TODO: Merge with the above.
77
enum CmdFormatType {
78
CMD_FMT_HEX = 0,
79
CMD_FMT_NUM,
80
CMD_FMT_FLOAT24,
81
CMD_FMT_PTRWIDTH,
82
CMD_FMT_XY,
83
CMD_FMT_XYXY,
84
CMD_FMT_XYZ,
85
CMD_FMT_XYPLUS1,
86
CMD_FMT_TEXSIZE,
87
CMD_FMT_F16_XY,
88
CMD_FMT_VERTEXTYPE,
89
CMD_FMT_TEXFMT,
90
CMD_FMT_CLUTFMT,
91
CMD_FMT_COLORTEST,
92
CMD_FMT_ALPHATEST,
93
CMD_FMT_STENCILTEST,
94
CMD_FMT_ZTEST,
95
CMD_FMT_OFFSETADDR,
96
CMD_FMT_VADDR,
97
CMD_FMT_IADDR,
98
CMD_FMT_MATERIALUPDATE,
99
CMD_FMT_STENCILOP,
100
CMD_FMT_BLENDMODE,
101
CMD_FMT_FLAG,
102
CMD_FMT_CLEARMODE,
103
CMD_FMT_TEXFUNC,
104
CMD_FMT_TEXMODE,
105
CMD_FMT_LOGICOP,
106
CMD_FMT_TEXWRAP,
107
CMD_FMT_TEXLEVEL,
108
CMD_FMT_TEXFILTER,
109
CMD_FMT_TEXMAPMODE,
110
CMD_FMT_TEXSHADELS,
111
CMD_FMT_SHADEMODEL,
112
CMD_FMT_LIGHTMODE,
113
CMD_FMT_LIGHTTYPE,
114
CMD_FMT_CULL,
115
CMD_FMT_PATCHPRIMITIVE,
116
CMD_FMT_HEX8 = CMD_FMT_HEX, // TODO
117
CMD_FMT_INTEGER = CMD_FMT_HEX,
118
};
119
120
struct GECmdInfo {
121
GECommand cmd;
122
const char *name; // scripting / expression name
123
GECmdFormat cmdFmt;
124
const char *uiName; // friendly name
125
CmdFormatType fmt;
126
uint8_t enableCmd;
127
uint8_t otherCmd;
128
uint8_t otherCmd2;
129
};
130
131
bool GECmdInfoByName(const char *name, GECmdInfo &info);
132
const GECmdInfo &GECmdInfoByCmd(GECommand reg);
133
134