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