This commit is contained in:
Daveo 2000-12-09 17:22:06 +00:00
parent 06bf236150
commit cd381e1694
7 changed files with 287 additions and 251 deletions

View file

@ -20,13 +20,13 @@
#define GPUCODE_MODE_SEMI_TRANS (1<<1)
// GPU Primitive codes. Please remember that 3 and 4 point lines require the pad field setting to 0x55555555.
#define GPUCODE_POLY_F3 (0x20)
#define GPUCODE_POLY_F3 (0x20)
#define GPUCODE_POLY_FT3 (0x24)
#define GPUCODE_POLY_G3 (0x30)
#define GPUCODE_POLY_G3 (0x30)
#define GPUCODE_POLY_GT3 (0x34)
#define GPUCODE_POLY_F4 (0x28)
#define GPUCODE_POLY_F4 (0x28)
#define GPUCODE_POLY_FT4 (0x2c)
#define GPUCODE_POLY_G4 (0x38)
#define GPUCODE_POLY_G4 (0x38)
#define GPUCODE_POLY_GT4 (0x3c)
#define GPUCODE_SPRT (0x64)
@ -44,15 +44,15 @@
#define GPUCODE_LINE_G3 (0x58)
#define GPUCODE_LINE_F4 (0x4c)
#define GPUCODE_LINE_G4 (0x5c)
// GPU Primitive sizes excluding the tag word. This is NOT the same as sizeof(<primitive type>)
#define GPUSIZE_POLY_F3 (4)
// GPU Primitive sizes excluding the tag word. This is NOT the same as sizeof(<primitive type>) due to lack of tag word
#define GPUSIZE_POLY_F3 (4)
#define GPUSIZE_POLY_FT3 (7)
#define GPUSIZE_POLY_G3 (6)
#define GPUSIZE_POLY_G3 (6)
#define GPUSIZE_POLY_GT3 (9)
#define GPUSIZE_POLY_F4 (5)
#define GPUSIZE_POLY_F4 (5)
#define GPUSIZE_POLY_FT4 (9)
#define GPUSIZE_POLY_G4 (8)
#define GPUSIZE_POLY_G4 (8)
#define GPUSIZE_POLY_GT4 (12)
#define GPUSIZE_SPRT (4)
@ -73,190 +73,183 @@
#define GPUSIZE_DR_TPAGE (1)
#define GPUSIZE_TPOLY_F3 (GPUSIZE_DR_TPAGE+GPUSIZE_POLY_F3+1)
#define GPUSIZE_TPOLY_F4 (GPUSIZE_DR_TPAGE+GPUSIZE_POLY_F4+1)
#define GPUSIZE_TPOLY_G3 (GPUSIZE_DR_TPAGE+GPUSIZE_POLY_G3+1)
#define GPUSIZE_TPOLY_G4 (GPUSIZE_DR_TPAGE+GPUSIZE_POLY_G4+1)
#define GPUSIZE_TPOLY_F3 (GPUSIZE_DR_TPAGE+GPUSIZE_POLY_F3)
#define GPUSIZE_TPOLY_F4 (GPUSIZE_DR_TPAGE+GPUSIZE_POLY_F4)
#define GPUSIZE_TPOLY_G3 (GPUSIZE_DR_TPAGE+GPUSIZE_POLY_G3)
#define GPUSIZE_TPOLY_G4 (GPUSIZE_DR_TPAGE+GPUSIZE_POLY_G4)
#define GPUSIZE_TLINE_F2 (GPUSIZE_DR_TPAGE+GPUSIZE_LINE_F3+1)
#define GPUSIZE_TLINE_G2 (GPUSIZE_DR_TPAGE+GPUSIZE_LINE_G2+1)
#define GPUSIZE_TLINE_F3 (GPUSIZE_DR_TPAGE+GPUSIZE_LINE_F3+1)
#define GPUSIZE_TLINE_G3 (GPUSIZE_DR_TPAGE+GPUSIZE_LINE_G3+1)
#define GPUSIZE_TLINE_F4 (GPUSIZE_DR_TPAGE+GPUSIZE_LINE_F4+1)
#define GPUSIZE_TLINE_G4 (GPUSIZE_DR_TPAGE+GPUSIZE_LINE_G4+1)
#define GPUSIZE_TLINE_F2 (GPUSIZE_DR_TPAGE+GPUSIZE_LINE_F3)
#define GPUSIZE_TLINE_G2 (GPUSIZE_DR_TPAGE+GPUSIZE_LINE_G2)
#define GPUSIZE_TLINE_F3 (GPUSIZE_DR_TPAGE+GPUSIZE_LINE_F3)
#define GPUSIZE_TLINE_G3 (GPUSIZE_DR_TPAGE+GPUSIZE_LINE_G3)
#define GPUSIZE_TLINE_F4 (GPUSIZE_DR_TPAGE+GPUSIZE_LINE_F4)
#define GPUSIZE_TLINE_G4 (GPUSIZE_DR_TPAGE+GPUSIZE_LINE_G4)
#define GPUSIZE_TSPRT (GPUSIZE_DR_TPAGE+GPUSIZE_SPRT+1)
#define GPUSIZE_TSPRT_8 (GPUSIZE_DR_TPAGE+GPUSIZE_SPRT_8+1)
#define GPUSIZE_TSPRT_16 (GPUSIZE_DR_TPAGE+GPUSIZE_SPRT_16+1)
#define GPUSIZE_TSPRT (GPUSIZE_DR_TPAGE+GPUSIZE_SPRT)
#define GPUSIZE_TSPRT_8 (GPUSIZE_DR_TPAGE+GPUSIZE_SPRT_8)
#define GPUSIZE_TSPRT_16 (GPUSIZE_DR_TPAGE+GPUSIZE_SPRT_16)
#define GPUSIZE_TTILE (GPUSIZE_DR_TPAGE+GPUSIZE_TILE+1)
#define GPUSIZE_TTILE_1 (GPUSIZE_DR_TPAGE+GPUSIZE_TILE_1+1)
#define GPUSIZE_TTILE_8 (GPUSIZE_DR_TPAGE+GPUSIZE_TILE_8+1)
#define GPUSIZE_TTILE_16 (GPUSIZE_DR_TPAGE+GPUSIZE_TILE_16+1)
#define GPUSIZE_TTILE (GPUSIZE_DR_TPAGE+GPUSIZE_TILE)
#define GPUSIZE_TTILE_1 (GPUSIZE_DR_TPAGE+GPUSIZE_TILE_1)
#define GPUSIZE_TTILE_8 (GPUSIZE_DR_TPAGE+GPUSIZE_TILE_8)
#define GPUSIZE_TTILE_16 (GPUSIZE_DR_TPAGE+GPUSIZE_TILE_16)
#define GPU_COLOUR_MASK (0x00ffffff)
#define GPU_CODE_MASK (0xff000000)
#define GPU_CODE_SHIFT (24)
//------------------------------------------------------------------------------------
// Macros
//------------------------------------------------------------------------------------
#define setTDrawTPageSize(p,s) setlen((p), (s)), (p)->t_code[0] = _get_mode(0,1,0)
#define setTDrawTPageSize(p,s) setlen((p), (s)), (p)->t_code = _get_mode(0,1,0)
#define setTDrawTPage(p) setTDrawTPageSize((p), 1)
#define setTPolyF3(p) setTDrawTPageSize((p), GPUSIZE_TPOLY_F3), setcode(&((p)->tag_poly), GPUCODE_POLY_F3), ((p)->tag_poly)=0
#define setTPolyF4(p) setTDrawTPageSize((p), GPUSIZE_TPOLY_F4), setcode(&((p)->tag_poly), GPUCODE_POLY_F4), ((p)->tag_poly)=0
#define setTPolyG3(p) setTDrawTPageSize((p), GPUSIZE_TPOLY_G3), setcode(&((p)->tag_poly), GPUCODE_POLY_G3), ((p)->tag_poly)=0
#define setTPolyG4(p) setTDrawTPageSize((p), GPUSIZE_TPOLY_G4), setcode(&((p)->tag_poly), GPUCODE_POLY_G4), ((p)->tag_poly)=0
#define setTPolyF3(p) setTDrawTPageSize((p), GPUSIZE_TPOLY_F3), ((p)->code)=GPUCODE_POLY_F3
#define setTPolyF4(p) setTDrawTPageSize((p), GPUSIZE_TPOLY_F4), ((p)->code)=GPUCODE_POLY_F4
#define setTPolyG3(p) setTDrawTPageSize((p), GPUSIZE_TPOLY_G3), ((p)->code)=GPUCODE_POLY_G3
#define setTPolyG4(p) setTDrawTPageSize((p), GPUSIZE_TPOLY_G4), ((p)->code)=GPUCODE_POLY_G4
#define setTLineF2(p) setTDrawTPageSize((p), GPUSIZE_TLINE_F2), setcode(&((p)->tag_poly), GPUCODE_LINE_F2), ((p)->tag_poly)=0
#define setTLineF3(p) setTDrawTPageSize((p), GPUSIZE_TLINE_F3), setcode(&((p)->tag_poly), GPUCODE_LINE_F3), ((p)->tag_poly)=0, ((p)->pad)=0x55555555
#define setTLineF4(p) setTDrawTPageSize((p), GPUSIZE_TLINE_F4), setcode(&((p)->tag_poly), GPUCODE_LINE_F4), ((p)->tag_poly)=0, ((p)->pad)=0x55555555
#define setTLineG2(p) setTDrawTPageSize((p), GPUSIZE_TLINE_G2), setcode(&((p)->tag_poly), GPUCODE_LINE_G2), ((p)->tag_poly)=0
#define setTLineG3(p) setTDrawTPageSize((p), GPUSIZE_TLINE_G3), setcode(&((p)->tag_poly), GPUCODE_LINE_G3), ((p)->tag_poly)=0, ((p)->pad)=0x55555555
#define setTLineG4(p) setTDrawTPageSize((p), GPUSIZE_TLINE_G4), setcode(&((p)->tag_poly), GPUCODE_LINE_G4), ((p)->tag_poly)=0, ((p)->pad)=0x55555555
#define setTLineF2(p) setTDrawTPageSize((p), GPUSIZE_TLINE_F2), ((p)->code)=GPUCODE_LINE_F2
#define setTLineG2(p) setTDrawTPageSize((p), GPUSIZE_TLINE_G2), ((p)->code)=GPUCODE_LINE_G2
#define setTLineF3(p) setTDrawTPageSize((p), GPUSIZE_TLINE_F3), ((p)->code)=GPUCODE_LINE_F3, ((p)->pad)=0x55555555
#define setTLineG3(p) setTDrawTPageSize((p), GPUSIZE_TLINE_G3), ((p)->code)=GPUCODE_LINE_G3, ((p)->pad)=0x55555555, ((p)->p2)=0
#define setTLineF4(p) setTDrawTPageSize((p), GPUSIZE_TLINE_F4), ((p)->code)=GPUCODE_LINE_F4, ((p)->pad)=0x55555555
#define setTLineG4(p) setTDrawTPageSize((p), GPUSIZE_TLINE_G4), ((p)->code)=GPUCODE_LINE_G4, ((p)->pad)=0x55555555, ((p)->p2)=0, ((p)->p3)=0
#define setTSprt(p) setTDrawTPageSize((p), GPUSIZE_TSPRT), setcode(&((p)->tag_poly), GPUCODE_SPRT), ((p)->tag_poly)=0
#define setTSprt8(p) setTDrawTPageSize((p), GPUSIZE_TSPRT_8), setcode(&((p)->tag_poly), GPUCODE_SPRT_8), ((p)->tag_poly)=0
#define setTSprt16(p) setTDrawTPageSize((p), GPUSIZE_TSPRT_16), setcode(&((p)->tag_poly), GPUCODE_SPRT_16), ((p)->tag_poly)=0
#define setTSprt(p) setTDrawTPageSize((p), GPUSIZE_TSPRT), ((p)->code)=GPUCODE_SPRT
#define setTSprt8(p) setTDrawTPageSize((p), GPUSIZE_TSPRT_8), ((p)->code)=GPUCODE_SPRT_8
#define setTSprt16(p) setTDrawTPageSize((p), GPUSIZE_TSPRT_16), ((p)->code)=GPUCODE_SPRT_16
#define setTTile(p) setTDrawTPageSize((p), GPUSIZE_TTILE), setcode(&((p)->tag_poly), GPUCODE_TILE), ((p)->tag_poly)=0
#define setTTile1(p) setTDrawTPageSize((p), GPUSIZE_TTILE_1), setcode(&((p)->tag_poly), GPUCODE_TILE_1), ((p)->tag_poly)=0
#define setTTile8(p) setTDrawTPageSize((p), GPUSIZE_TTILE_8), setcode(&((p)->tag_poly), GPUCODE_TILE_8), ((p)->tag_poly)=0
#define setTTile16(p) setTDrawTPageSize((p), GPUSIZE_TTILE_16), setcode(&((p)->tag_poly), GPUCODE_TILE_16), ((p)->tag_poly)=0
#define setTTile(p) setTDrawTPageSize((p), GPUSIZE_TTILE), ((p)->code)=GPUCODE_TILE
#define setTTile1(p) setTDrawTPageSize((p), GPUSIZE_TTILE_1), ((p)->code)=GPUCODE_TILE_1
#define setTTile8(p) setTDrawTPageSize((p), GPUSIZE_TTILE_8), ((p)->code)=GPUCODE_TILE_8
#define setTTile16(p) setTDrawTPageSize((p), GPUSIZE_TTILE_16), ((p)->code)=GPUCODE_TILE_16
#define setTSemiTrans(p, abe) setSemiTrans(&((p)->tag_poly), (abe))
#define setTABRMode(p,abr) (p)->t_code[0] = _get_mode(0,1,(abr<<5))
#define setTSprtTPage(p,tp) (p)->t_code[0] = _get_mode(0,1,(tp))
#define setTSprtTPageABR(p,t,a) (p)->t_code[0] = _get_mode(0,1,(((t)&0x19f)|((a)<<5)))
#define addPrimSize(ot,p,size) (p)->tag = ((*(ot))|((size)<<24)), *((ot)) = (((u_long)(p)<<8)>>8)
#define setTSemiTrans(p, abe) setSemiTrans(&((p)->t_code), (abe))
#define setTSetShadeTex(p, st) setShadeTex(&((p)->t_code), (st))
#define setTABRMode(p,abr) ((p)->t_code) = _get_mode(0,1,(abr<<5))
#define setTSprtTPage(p,tp) ((p)->t_code) = _get_mode(0,1,(tp))
#define setTSprtTPageABR(p,t,a) ((p)->t_code) = _get_mode(0,1,(((t)&0x19f)|((a)<<5)))
#define addPrimSize(ot,p,size) ((p)->tag) = ((*(ot))|((size)<<24)), *((ot)) = (((u_long)(p)<<8)>>8)
//------------------------------------------------------------------------------------
// Structures
//------------------------------------------------------------------------------------
struct TPOLY_F3 // Flat Triangle with ABR control
typedef struct __tpoly_f3
{
u_long tag;
u_long t_code[1];
u_long tag_poly;
u_long t_code;
u_char r0, g0, b0, code;
short x0, y0;
short x0, y0;
short x1, y1;
short x2, y2;
};
} TPOLY_F3; // Flat Triangle with ABR control
struct TPOLY_F4 // Flat Quadrangle with ABR control
typedef struct __tpoly_f4
{
u_long tag;
u_long t_code[1];
u_long tag_poly;
u_long t_code;
u_char r0, g0, b0, code;
short x0, y0;
short x0, y0;
short x1, y1;
short x2, y2;
short x3, y3;
};
} TPOLY_F4; // Flat Quadrangle with ABR control
struct TPOLY_G3 // Gouraud Triangle with ABR control
typedef struct __tpoly_g3
{
u_long tag;
u_long t_code[1];
u_long tag_poly;
u_long t_code;
u_char r0, g0, b0, code;
short x0, y0;
short x0, y0;
u_char r1, g1, b1, pad1;
short x1, y1;
u_char r2, g2, b2, pad2;
short x2, y2;
};
} TPOLY_G3; // Gouraud Triangle with ABR control
struct TPOLY_G4 // Gouraud Quadrangle with ABR control
typedef struct __tpoly_g4
{
u_long tag;
u_long t_code[1];
u_long tag_poly;
u_long t_code;
u_char r0, g0, b0, code;
short x0, y0;
short x0, y0;
u_char r1, g1, b1, pad1;
short x1, y1;
u_char r2, g2, b2, pad2;
short x2, y2;
u_char r3, g3, b3, pad3;
short x3, y3;
};
} TPOLY_G4; // Gouraud Quadrangle with ABR control
//
// Line Primitive Definitions
//
struct TLINE_F2 // Unconnected Flat Line with ABR control
typedef struct __tline_f2
{
u_long tag;
u_long t_code[1];
u_long tag_poly;
u_long t_code;
u_char r0, g0, b0, code;
short x0, y0;
short x0, y0;
short x1, y1;
};
} TLINE_F2; // Unconnected Flat Line with ABR control
struct TLINE_G2 // Unconnected Gouraud Line with ABR control
typedef struct __tline_g2
{
u_long tag;
u_long t_code[1];
u_long tag_poly;
u_long t_code;
u_char r0, g0, b0, code;
short x0, y0;
short x0, y0;
u_char r1, g1, b1, p1;
short x1, y1;
};
} TLINE_G2; // Unconnected Gouraud Line with ABR control
struct TLINE_F3 // 2 connected Flat Line with ABR control
typedef struct __tline_f3
{
u_long tag;
u_long t_code[1];
u_long tag_poly;
u_long t_code;
u_char r0, g0, b0, code;
short x0, y0;
short x0, y0;
short x1, y1;
short x2, y2;
u_long pad;
};
} TLINE_F3; // 2 connected Flat Line with ABR control
struct TLINE_G3 // 2 connected Gouraud Line with ABR control
typedef struct __tline_g3
{
u_long tag;
u_long t_code[1];
u_long tag_poly;
u_long t_code;
u_char r0, g0, b0, code;
short x0, y0;
short x0, y0;
u_char r1, g1, b1, p1;
short x1, y1;
u_char r2, g2, b2, p2;
short x2, y2;
u_long pad;
};
} TLINE_G3; // 2 connected Gouraud Line with ABR control
struct TLINE_F4 // 3 connected Flat Line Quadrangle with ABR control
typedef struct __tline_f4
{
u_long tag;
u_long t_code[1];
u_long tag_poly;
u_long t_code;
u_char r0, g0, b0, code;
short x0, y0;
short x0, y0;
short x1, y1;
short x2, y2;
short x3, y3;
u_long pad;
};
} TLINE_F4; // 3 connected Flat Line Quadrangle with ABR control
struct TLINE_G4 // 3 connected Gouraud Line with ABR control
typedef struct __tline_g4
{
u_long tag;
u_long t_code[1];
u_long tag_poly;
u_long t_code;
u_char r0, g0, b0, code;
short x0, y0;
short x0, y0;
u_char r1, g1, b1, p1;
short x1, y1;
u_char r2, g2, b2, p2;
@ -264,82 +257,75 @@ struct TLINE_G4 // 3 connected Gouraud Line with ABR control
u_char r3, g3, b3, p3;
short x3, y3;
u_long pad;
};
} TLINE_G4; // 3 connected Gouraud Line with ABR control
//
// Sprite Primitive Definitions
//
struct TSPRT // Free size Sprite with TPage/ABR control
typedef struct __tsprt
{
u_long tag;
u_long t_code[1];
u_long tag_poly;
u_long t_code;
u_char r0, g0, b0, code;
short x0, y0;
short x0, y0;
u_char u0, v0; u_short clut;
short w, h;
};
} TSPRT; // Free size Sprite with TPage/ABR control
struct TSPRT_16 // 16x16 Sprite with TPage/ABR control
typedef struct __tsprt_16
{
u_long tag;
u_long t_code[1];
u_long tag_poly;
u_long t_code;
u_char r0, g0, b0, code;
short x0, y0;
short x0, y0;
u_char u0, v0; u_short clut;
};
} TSPRT_16; // 16x16 Sprite with TPage/ABR control
struct TSPRT_8 // 8x8 Sprite with TPage/ABR control
typedef struct __tsprt_8
{
u_long tag;
u_long t_code[1];
u_long tag_poly;
u_long t_code;
u_char r0, g0, b0, code;
short x0, y0;
short x0, y0;
u_char u0, v0; u_short clut;
};
} TSPRT_8; // 8x8 Sprite with TPage/ABR control
//
// Tile Primitive Definitions
//
struct TTILE // free size Tile with ABR control
typedef struct __ttile
{
u_long tag;
u_long t_code[1];
u_long tag_poly;
u_long t_code;
u_char r0, g0, b0, code;
short x0, y0;
short x0, y0;
short w, h;
};
} TTILE; // free size Tile with ABR control
struct TTILE_16 // 16x16 Tile with ABR control
typedef struct __ttile16
{
u_long tag;
u_long t_code[1];
u_long tag_poly;
u_long t_code;
u_char r0, g0, b0, code;
short x0, y0;
};
short x0, y0;
} TTILE_16; // 16x16 Tile with ABR control
struct TTILE_8 // 8x8 Tile with ABR control
typedef struct __ttile_8
{
u_long tag;
u_long t_code[1];
u_long tag_poly;
u_long t_code;
u_char r0, g0, b0, code;
short x0, y0;
};
short x0, y0;
} TTILE_8; // 8x8 Tile with ABR control
struct TTILE_1 // 1x1 Tile with ABR control
typedef struct __ttile_1
{
u_long tag;
u_long t_code[1];
u_long tag_poly;
u_long t_code;
u_char r0, g0, b0, code;
short x0, y0;
};
short x0, y0;
} TTILE_1; // 1x1 Tile with ABR control
#endif