305#define PVR_LIST_OP_POLY 0
306#define PVR_LIST_OP_MOD 1
307#define PVR_LIST_TR_POLY 2
308#define PVR_LIST_TR_MOD 3
309#define PVR_LIST_PT_POLY 4
327#define PVR_SHADE_FLAT 0
328#define PVR_SHADE_GOURAUD 1
344#define PVR_DEPTHCMP_NEVER 0
345#define PVR_DEPTHCMP_LESS 1
346#define PVR_DEPTHCMP_EQUAL 2
347#define PVR_DEPTHCMP_LEQUAL 3
348#define PVR_DEPTHCMP_GREATER 4
349#define PVR_DEPTHCMP_NOTEQUAL 5
350#define PVR_DEPTHCMP_GEQUAL 6
351#define PVR_DEPTHCMP_ALWAYS 7
364#define PVR_CULLING_NONE 0
365#define PVR_CULLING_SMALL 1
366#define PVR_CULLING_CCW 2
367#define PVR_CULLING_CW 3
375#define PVR_DEPTHWRITE_ENABLE 0
376#define PVR_DEPTHWRITE_DISABLE 1
390#define PVR_TEXTURE_DISABLE 0
391#define PVR_TEXTURE_ENABLE 1
408#define PVR_BLEND_ZERO 0
409#define PVR_BLEND_ONE 1
410#define PVR_BLEND_DESTCOLOR 2
411#define PVR_BLEND_INVDESTCOLOR 3
412#define PVR_BLEND_SRCALPHA 4
413#define PVR_BLEND_INVSRCALPHA 5
414#define PVR_BLEND_DESTALPHA 6
415#define PVR_BLEND_INVDESTALPHA 7
424#define PVR_BLEND_DISABLE 0
425#define PVR_BLEND_ENABLE 1
437#define PVR_FOG_TABLE 0
438#define PVR_FOG_VERTEX 1
439#define PVR_FOG_DISABLE 2
440#define PVR_FOG_TABLE2 3
451#define PVR_USERCLIP_DISABLE 0
452#define PVR_USERCLIP_INSIDE 2
453#define PVR_USERCLIP_OUTSIDE 3
470#define PVR_CLRCLAMP_DISABLE 0
471#define PVR_CLRCLAMP_ENABLE 1
489#define PVR_SPECULAR_DISABLE 0
490#define PVR_SPECULAR_ENABLE 1
502#define PVR_ALPHA_DISABLE 0
503#define PVR_ALPHA_ENABLE 1
515#define PVR_TXRALPHA_ENABLE 0
516#define PVR_TXRALPHA_DISABLE 1
536#define PVR_UVFLIP_NONE 0
537#define PVR_UVFLIP_V 1
538#define PVR_UVFLIP_U 2
539#define PVR_UVFLIP_UV 3
552#define PVR_UVCLAMP_NONE 0
553#define PVR_UVCLAMP_V 1
554#define PVR_UVCLAMP_U 2
555#define PVR_UVCLAMP_UV 3
564#define PVR_FILTER_NONE 0
565#define PVR_FILTER_NEAREST 0
566#define PVR_FILTER_BILINEAR 2
567#define PVR_FILTER_TRILINEAR1 4
568#define PVR_FILTER_TRILINEAR2 6
577#define PVR_MIPBIAS_NORMAL PVR_MIPBIAS_1_00
578#define PVR_MIPBIAS_0_25 1
579#define PVR_MIPBIAS_0_50 2
580#define PVR_MIPBIAS_0_75 3
581#define PVR_MIPBIAS_1_00 4
582#define PVR_MIPBIAS_1_25 5
583#define PVR_MIPBIAS_1_50 6
584#define PVR_MIPBIAS_1_75 7
585#define PVR_MIPBIAS_2_00 8
586#define PVR_MIPBIAS_2_25 9
587#define PVR_MIPBIAS_2_50 10
588#define PVR_MIPBIAS_2_75 11
589#define PVR_MIPBIAS_3_00 12
590#define PVR_MIPBIAS_3_25 13
591#define PVR_MIPBIAS_3_50 14
592#define PVR_MIPBIAS_3_75 15
601#define PVR_TXRENV_REPLACE 0
602#define PVR_TXRENV_MODULATE 1
603#define PVR_TXRENV_DECAL 2
604#define PVR_TXRENV_MODULATEALPHA 3
613#define PVR_MIPMAP_DISABLE 0
614#define PVR_MIPMAP_ENABLE 1
626#define PVR_TXRFMT_NONE 0
627#define PVR_TXRFMT_VQ_DISABLE (0 << 30)
628#define PVR_TXRFMT_VQ_ENABLE (1 << 30)
629#define PVR_TXRFMT_ARGB1555 (0 << 27)
630#define PVR_TXRFMT_RGB565 (1 << 27)
631#define PVR_TXRFMT_ARGB4444 (2 << 27)
632#define PVR_TXRFMT_YUV422 (3 << 27)
633#define PVR_TXRFMT_BUMP (4 << 27)
634#define PVR_TXRFMT_PAL4BPP (5 << 27)
635#define PVR_TXRFMT_PAL8BPP (6 << 27)
636#define PVR_TXRFMT_TWIDDLED (0 << 26)
637#define PVR_TXRFMT_NONTWIDDLED (1 << 26)
638#define PVR_TXRFMT_POW2_STRIDE (0 << 25)
639#define PVR_TXRFMT_X32_STRIDE (1 << 25)
648#define PVR_TXRFMT_8BPP_PAL(x) ((x) << 25)
653#define PVR_TXRFMT_4BPP_PAL(x) ((x) << 21)
664#define PVR_CLRFMT_ARGBPACKED 0
665#define PVR_CLRFMT_4FLOATS 1
666#define PVR_CLRFMT_INTENSITY 2
667#define PVR_CLRFMT_INTENSITY_PREV 3
675#define PVR_UVFMT_32BIT 0
676#define PVR_UVFMT_16BIT 1
689#define PVR_MODIFIER_DISABLE 0
690#define PVR_MODIFIER_ENABLE 1
698#define PVR_MODIFIER_CHEAP_SHADOW 0
699#define PVR_MODIFIER_NORMAL 1
712#define PVR_MODIFIER_OTHER_POLY 0
713#define PVR_MODIFIER_INCLUDE_LAST_POLY 1
714#define PVR_MODIFIER_EXCLUDE_LAST_POLY 2
731typedef struct pvr_poly_hdr {
749typedef struct pvr_poly_ic_hdr {
768typedef struct pvr_poly_mod_hdr {
787typedef struct pvr_sprite_hdr {
806typedef struct pvr_mod_hdr {
835typedef struct pvr_vertex {
855typedef struct pvr_vertex_pcm {
875typedef struct pvr_vertex_tpcm {
907typedef struct pvr_sprite_txr {
932typedef struct pvr_sprite_col {
957typedef struct pvr_modifier_vol {
987#define PVR_PACK_COLOR(a, r, g, b) ( \
988 ( ((uint8_t)( (a) * 255 ) ) << 24 ) | \
989 ( ((uint8_t)( (r) * 255 ) ) << 16 ) | \
990 ( ((uint8_t)( (g) * 255 ) ) << 8 ) | \
991 ( ((uint8_t)( (b) * 255 ) ) << 0 ) )
1009 return (u2.i & 0xFFFF0000) | (v2.i >> 16);
1023#define PVR_CMD_POLYHDR 0x80840000
1025#define PVR_CMD_VERTEX 0xe0000000
1026#define PVR_CMD_VERTEX_EOL 0xf0000000
1027#define PVR_CMD_USERCLIP 0x20000000
1028#define PVR_CMD_MODIFIER 0x80000000
1029#define PVR_CMD_SPRITE 0xA0000000
1035#define PVR_TA_CMD_TYPE_SHIFT 24
1036#define PVR_TA_CMD_TYPE_MASK (7 << PVR_TA_CMD_TYPE_SHIFT)
1038#define PVR_TA_CMD_USERCLIP_SHIFT 16
1039#define PVR_TA_CMD_USERCLIP_MASK (3 << PVR_TA_CMD_USERCLIP_SHIFT)
1041#define PVR_TA_CMD_CLRFMT_SHIFT 4
1042#define PVR_TA_CMD_CLRFMT_MASK (7 << PVR_TA_CMD_CLRFMT_SHIFT)
1044#define PVR_TA_CMD_SPECULAR_SHIFT 2
1045#define PVR_TA_CMD_SPECULAR_MASK (1 << PVR_TA_CMD_SPECULAR_SHIFT)
1047#define PVR_TA_CMD_SHADE_SHIFT 1
1048#define PVR_TA_CMD_SHADE_MASK (1 << PVR_TA_CMD_SHADE_SHIFT)
1050#define PVR_TA_CMD_UVFMT_SHIFT 0
1051#define PVR_TA_CMD_UVFMT_MASK (1 << PVR_TA_CMD_UVFMT_SHIFT)
1053#define PVR_TA_CMD_MODIFIER_SHIFT 7
1054#define PVR_TA_CMD_MODIFIER_MASK (1 << PVR_TA_CMD_MODIFIER_SHIFT)
1056#define PVR_TA_CMD_MODIFIERMODE_SHIFT 6
1057#define PVR_TA_CMD_MODIFIERMODE_MASK (1 << PVR_TA_CMD_MODIFIERMODE_SHIFT)
1059#define PVR_TA_PM1_DEPTHCMP_SHIFT 29
1060#define PVR_TA_PM1_DEPTHCMP_MASK (7 << PVR_TA_PM1_DEPTHCMP_SHIFT)
1062#define PVR_TA_PM1_CULLING_SHIFT 27
1063#define PVR_TA_PM1_CULLING_MASK (3 << PVR_TA_PM1_CULLING_SHIFT)
1065#define PVR_TA_PM1_DEPTHWRITE_SHIFT 26
1066#define PVR_TA_PM1_DEPTHWRITE_MASK (1 << PVR_TA_PM1_DEPTHWRITE_SHIFT)
1068#define PVR_TA_PM1_TXRENABLE_SHIFT 25
1069#define PVR_TA_PM1_TXRENABLE_MASK (1 << PVR_TA_PM1_TXRENABLE_SHIFT)
1071#define PVR_TA_PM1_MODIFIERINST_SHIFT 29
1072#define PVR_TA_PM1_MODIFIERINST_MASK (3 << PVR_TA_PM1_MODIFIERINST_SHIFT)
1074#define PVR_TA_PM2_SRCBLEND_SHIFT 29
1075#define PVR_TA_PM2_SRCBLEND_MASK (7 << PVR_TA_PM2_SRCBLEND_SHIFT)
1077#define PVR_TA_PM2_DSTBLEND_SHIFT 26
1078#define PVR_TA_PM2_DSTBLEND_MASK (7 << PVR_TA_PM2_DSTBLEND_SHIFT)
1080#define PVR_TA_PM2_SRCENABLE_SHIFT 25
1081#define PVR_TA_PM2_SRCENABLE_MASK (1 << PVR_TA_PM2_SRCENABLE_SHIFT)
1083#define PVR_TA_PM2_DSTENABLE_SHIFT 24
1084#define PVR_TA_PM2_DSTENABLE_MASK (1 << PVR_TA_PM2_DSTENABLE_SHIFT)
1086#define PVR_TA_PM2_FOG_SHIFT 22
1087#define PVR_TA_PM2_FOG_MASK (3 << PVR_TA_PM2_FOG_SHIFT)
1089#define PVR_TA_PM2_CLAMP_SHIFT 21
1090#define PVR_TA_PM2_CLAMP_MASK (1 << PVR_TA_PM2_CLAMP_SHIFT)
1092#define PVR_TA_PM2_ALPHA_SHIFT 20
1093#define PVR_TA_PM2_ALPHA_MASK (1 << PVR_TA_PM2_ALPHA_SHIFT)
1095#define PVR_TA_PM2_TXRALPHA_SHIFT 19
1096#define PVR_TA_PM2_TXRALPHA_MASK (1 << PVR_TA_PM2_TXRALPHA_SHIFT)
1098#define PVR_TA_PM2_UVFLIP_SHIFT 17
1099#define PVR_TA_PM2_UVFLIP_MASK (3 << PVR_TA_PM2_UVFLIP_SHIFT)
1101#define PVR_TA_PM2_UVCLAMP_SHIFT 15
1102#define PVR_TA_PM2_UVCLAMP_MASK (3 << PVR_TA_PM2_UVCLAMP_SHIFT)
1104#define PVR_TA_PM2_FILTER_SHIFT 12
1105#define PVR_TA_PM2_FILTER_MASK (7 << PVR_TA_PM2_FILTER_SHIFT)
1107#define PVR_TA_PM2_MIPBIAS_SHIFT 8
1108#define PVR_TA_PM2_MIPBIAS_MASK (15 << PVR_TA_PM2_MIPBIAS_SHIFT)
1110#define PVR_TA_PM2_TXRENV_SHIFT 6
1111#define PVR_TA_PM2_TXRENV_MASK (3 << PVR_TA_PM2_TXRENV_SHIFT)
1113#define PVR_TA_PM2_USIZE_SHIFT 3
1114#define PVR_TA_PM2_USIZE_MASK (7 << PVR_TA_PM2_USIZE_SHIFT)
1116#define PVR_TA_PM2_VSIZE_SHIFT 0
1117#define PVR_TA_PM2_VSIZE_MASK (7 << PVR_TA_PM2_VSIZE_SHIFT)
1119#define PVR_TA_PM3_MIPMAP_SHIFT 31
1120#define PVR_TA_PM3_MIPMAP_MASK (1 << PVR_TA_PM3_MIPMAP_SHIFT)
1122#define PVR_TA_PM3_TXRFMT_SHIFT 0
1123#define PVR_TA_PM3_TXRFMT_MASK 0xffffffff
1135#define PVR_TA_CMD_TYPE GENMASK(26, 24)
1136#define PVR_TA_CMD_USERCLIP GENMASK(17, 16)
1137#define PVR_TA_CMD_MODIFIER BIT(7)
1138#define PVR_TA_CMD_MODIFIERMODE BIT(6)
1139#define PVR_TA_CMD_CLRFMT GENMASK(5, 4)
1140#define PVR_TA_CMD_TXRENABLE BIT(3)
1141#define PVR_TA_CMD_SPECULAR BIT(2)
1142#define PVR_TA_CMD_SHADE BIT(1)
1143#define PVR_TA_CMD_UVFMT BIT(0)
1144#define PVR_TA_PM1_DEPTHCMP GENMASK(31, 29)
1145#define PVR_TA_PM1_CULLING GENMASK(28, 27)
1146#define PVR_TA_PM1_DEPTHWRITE BIT(26)
1147#define PVR_TA_PM1_TXRENABLE BIT(25)
1148#define PVR_TA_PM1_MODIFIERINST GENMASK(30, 29)
1149#define PVR_TA_PM2_SRCBLEND GENMASK(31, 29)
1150#define PVR_TA_PM2_DSTBLEND GENMASK(28, 26)
1151#define PVR_TA_PM2_SRCENABLE BIT(25)
1152#define PVR_TA_PM2_DSTENABLE BIT(24)
1153#define PVR_TA_PM2_FOG GENMASK(23, 22)
1154#define PVR_TA_PM2_CLAMP BIT(21)
1155#define PVR_TA_PM2_ALPHA BIT(20)
1156#define PVR_TA_PM2_TXRALPHA BIT(19)
1157#define PVR_TA_PM2_UVFLIP GENMASK(18, 17)
1158#define PVR_TA_PM2_UVCLAMP GENMASK(16, 15)
1159#define PVR_TA_PM2_FILTER GENMASK(14, 12)
1160#define PVR_TA_PM2_MIPBIAS GENMASK(11, 8)
1161#define PVR_TA_PM2_TXRENV GENMASK(7, 6)
1162#define PVR_TA_PM2_USIZE GENMASK(5, 3)
1163#define PVR_TA_PM2_VSIZE GENMASK(2, 0)
1164#define PVR_TA_PM3_MIPMAP BIT(31)
1165#define PVR_TA_PM3_TXRFMT GENMASK(30, 21)
1179#define PVR_REGISTERS_BASE 0xa05f8000
1187#define PVR_GET(REG) (* ( (vuint32*)( PVR_REGISTERS_BASE + (REG) ) ) )
1194#define PVR_SET(REG, VALUE) PVR_GET(REG) = (VALUE)
1211#define PVR_ID 0x0000
1212#define PVR_REVISION 0x0004
1213#define PVR_RESET 0x0008
1215#define PVR_ISP_START 0x0014
1216#define PVR_UNK_0018 0x0018
1218#define PVR_ISP_VERTBUF_ADDR 0x0020
1220#define PVR_ISP_TILEMAT_ADDR 0x002c
1221#define PVR_SPANSORT_CFG 0x0030
1223#define PVR_BORDER_COLOR 0x0040
1224#define PVR_FB_CFG_1 0x0044
1225#define PVR_FB_CFG_2 0x0048
1226#define PVR_RENDER_MODULO 0x004c
1227#define PVR_FB_ADDR 0x0050
1228#define PVR_FB_IL_ADDR 0x0054
1230#define PVR_FB_SIZE 0x005c
1231#define PVR_RENDER_ADDR 0x0060
1232#define PVR_RENDER_ADDR_2 0x0064
1233#define PVR_PCLIP_X 0x0068
1234#define PVR_PCLIP_Y 0x006c
1236#define PVR_CHEAP_SHADOW 0x0074
1237#define PVR_OBJECT_CLIP 0x0078
1238#define PVR_UNK_007C 0x007c
1239#define PVR_UNK_0080 0x0080
1240#define PVR_TEXTURE_CLIP 0x0084
1241#define PVR_BGPLANE_Z 0x0088
1242#define PVR_BGPLANE_CFG 0x008c
1244#define PVR_UNK_0098 0x0098
1246#define PVR_UNK_00A0 0x00a0
1248#define PVR_UNK_00A8 0x00a8
1250#define PVR_FOG_TABLE_COLOR 0x00b0
1251#define PVR_FOG_VERTEX_COLOR 0x00b4
1252#define PVR_FOG_DENSITY 0x00b8
1253#define PVR_COLOR_CLAMP_MAX 0x00bc
1254#define PVR_COLOR_CLAMP_MIN 0x00c0
1255#define PVR_GUN_POS 0x00c4
1256#define PVR_HPOS_IRQ 0x00c8
1257#define PVR_VPOS_IRQ 0x00cc
1258#define PVR_IL_CFG 0x00d0
1259#define PVR_BORDER_X 0x00d4
1260#define PVR_SCAN_CLK 0x00d8
1261#define PVR_BORDER_Y 0x00dc
1263#define PVR_TXR_STRIDE_MULT 0x00e4
1264#define PVR_VIDEO_CFG 0x00e8
1265#define PVR_BITMAP_X 0x00ec
1266#define PVR_BITMAP_Y 0x00f0
1267#define PVR_SCALER_CFG 0x00f4
1269#define PVR_PALETTE_CFG 0x0108
1270#define PVR_SYNC_STATUS 0x010c
1271#define PVR_UNK_0110 0x0110
1272#define PVR_UNK_0114 0x0114
1273#define PVR_UNK_0118 0x0118
1275#define PVR_TA_OPB_START 0x0124
1276#define PVR_TA_VERTBUF_START 0x0128
1277#define PVR_TA_OPB_END 0x012c
1278#define PVR_TA_VERTBUF_END 0x0130
1279#define PVR_TA_OPB_POS 0x0134
1280#define PVR_TA_VERTBUF_POS 0x0138
1281#define PVR_TILEMAT_CFG 0x013c
1282#define PVR_OPB_CFG 0x0140
1283#define PVR_TA_INIT 0x0144
1284#define PVR_YUV_ADDR 0x0148
1285#define PVR_YUV_CFG 0x014c
1286#define PVR_YUV_STAT 0x0150
1288#define PVR_UNK_0160 0x0160
1289#define PVR_TA_OPB_INIT 0x0164
1291#define PVR_FOG_TABLE_BASE 0x0200
1293#define PVR_PALETTE_TABLE_BASE 0x1000
1304#define PVR_TA_INPUT 0x10000000
1305#define PVR_TA_YUV_CONV 0x10800000
1306#define PVR_TA_TEX_MEM 0x11000000
1307#define PVR_TA_TEX_MEM_32 0x13000000
1308#define PVR_RAM_BASE_32_P0 0x05000000
1309#define PVR_RAM_BASE_64_P0 0x04000000
1310#define PVR_RAM_BASE 0xa5000000
1311#define PVR_RAM_INT_BASE 0xa4000000
1313#define PVR_RAM_SIZE (8*1024*1024)
1315#define PVR_RAM_TOP (PVR_RAM_BASE + PVR_RAM_SIZE)
1316#define PVR_RAM_INT_TOP (PVR_RAM_INT_BASE + PVR_RAM_SIZE)
1331#define PVR_RESET_ALL 0xffffffff
1332#define PVR_RESET_NONE 0x00000000
1333#define PVR_RESET_TA 0x00000001
1334#define PVR_RESET_ISPTSP 0x00000002
1342#define PVR_ISP_START_GO 0xffffffff
1344#define PVR_TA_INIT_GO 0x80000000
1361#define PVR_BINSIZE_0 0
1362#define PVR_BINSIZE_8 8
1363#define PVR_BINSIZE_16 16
1364#define PVR_BINSIZE_32 32
1539typedef struct pvr_stats {
1590typedef enum pvr_palfmt {
2030#define pvr_dr_target(vtx_buf_ptr) \
2031 ({ (vtx_buf_ptr) ^= 32; \
2032 (pvr_vertex_t *)(MEM_AREA_SQ_BASE | (vtx_buf_ptr)); \
2040#define pvr_dr_commit(addr) sq_flush(addr)
2184 int textureformat,
int tw,
int th,
pvr_ptr_t textureaddr,
2228 int textureformat,
int tw,
int th,
pvr_ptr_t textureaddr,
2301 int textureformat,
int tw,
int th,
2303 int textureformat2,
int tw2,
int th2,
2304 pvr_ptr_t textureaddr2,
int filtering2);
2382#define PVR_TXRLOAD_4BPP 0x01
2383#define PVR_TXRLOAD_8BPP 0x02
2384#define PVR_TXRLOAD_16BPP 0x03
2385#define PVR_TXRLOAD_FMT_MASK 0x0f
2387#define PVR_TXRLOAD_VQ_LOAD 0x10
2388#define PVR_TXRLOAD_INVERT_Y 0x20
2389#define PVR_TXRLOAD_FMT_VQ 0x40
2390#define PVR_TXRLOAD_FMT_TWIDDLED 0x80
2391#define PVR_TXRLOAD_FMT_NOTWIDDLE 0x80
2392#define PVR_TXRLOAD_DMA 0x8000
2393#define PVR_TXRLOAD_NONBLOCK 0x4000
2394#define PVR_TXRLOAD_SQ 0x2000
2420 uint32_t w, uint32_t h, uint32_t flags);
Cache management functionality.
void pvr_sprite_cxt_txr(pvr_sprite_cxt_t *dst, pvr_list_t list, int textureformat, int tw, int th, pvr_ptr_t textureaddr, int filtering)
Fill in a sprite context for a textured sprite.
void pvr_poly_cxt_col_mod(pvr_poly_cxt_t *dst, pvr_list_t list)
Fill in a polygon context for non-textured polygons affected by a modifier volume.
void pvr_poly_cxt_txr_mod(pvr_poly_cxt_t *dst, pvr_list_t list, int textureformat, int tw, int th, pvr_ptr_t textureaddr, int filtering, int textureformat2, int tw2, int th2, pvr_ptr_t textureaddr2, int filtering2)
Fill in a polygon context for a textured polygon affected by modifier volumes.
void pvr_poly_cxt_txr(pvr_poly_cxt_t *dst, pvr_list_t list, int textureformat, int tw, int th, pvr_ptr_t textureaddr, int filtering)
Fill in a polygon context for a textured polygon.
void pvr_poly_cxt_col(pvr_poly_cxt_t *dst, pvr_list_t list)
Fill in a polygon context for non-textured polygons.
void pvr_sprite_cxt_col(pvr_sprite_cxt_t *dst, pvr_list_t list)
Fill in a sprite context for non-textured sprites.
void pvr_send_to_ta(void *data)
Upload a 32-byte payload to the Tile Accelerator.
void pvr_dr_init(pvr_dr_state_t *vtx_buf_ptr)
Initialize a state variable for Direct Rendering.
uint32_t pvr_dr_state_t
Direct Rendering state variable type.
Definition pvr.h:2010
void pvr_dr_finish(void)
Finish work with Direct Rendering.
void pvr_fog_table_exp2(float density)
Initialize the fog table using an exp2 algorithm (like GL_EXP2).
void pvr_fog_table_linear(float start, float end)
Initialize the fog table using a linear algorithm (like GL_LINEAR).
void pvr_fog_table_custom(float tbl1[])
Set a custom fog table from float values.
void pvr_fog_table_color(float a, float r, float g, float b)
Set the table fog color.
void pvr_fog_far_depth(float d)
Set the fog far depth.
void pvr_fog_table_exp(float density)
Initialize the fog table using an exp algorithm (like GL_EXP).
void pvr_fog_vertex_color(float a, float r, float g, float b)
Set the vertex fog color.
void pvr_set_zclip(float zc)
Set Z clipping depth.
void pvr_set_bg_color(float r, float g, float b)
Set the background plane color.
void pvr_set_shadow_scale(int enable, float scale_value)
Set cheap shadow parameters.
int pvr_shutdown(void)
Shut down the PVR chip from ready status.
int pvr_init_defaults(void)
Simple PVR initialization.
int pvr_init(pvr_init_params_t *params)
Initialize the PVR chip to ready status.
int pvr_list_flush(pvr_list_t list)
Flush the buffered data of the given list type to the TA.
int pvr_list_prim(pvr_list_t list, void *data, int size)
Submit a primitive of the given list type.
void * pvr_set_vertbuf(pvr_list_t list, void *buffer, int len)
Setup a vertex buffer for one of the list types.
int pvr_list_finish(void)
End collecting data for the current list type.
int pvr_prim(void *data, int size)
Submit a primitive of the current list type.
int pvr_list_begin(pvr_list_t list)
Begin collecting data for the given list type.
uint32_t pvr_list_t
PVR list specification.
Definition pvr.h:83
void pvr_mem_reset(void)
Reset the PVR RAM pool.
void pvr_mem_free(pvr_ptr_t chunk)
Free a block of allocated memory in the PVR RAM pool.
void pvr_mem_stats(void)
Print statistics about the PVR RAM pool.
void pvr_mem_print_list(void)
Print the list of allocated blocks in the PVR RAM pool.
pvr_ptr_t pvr_mem_malloc(size_t size)
Allocate a chunk of memory from texture space.
uint32_t pvr_mem_available(void)
Return the number of bytes available still in the PVR RAM pool.
static void pvr_set_pal_entry(uint32_t idx, uint32_t value)
Set a palette value.
Definition pvr.h:1625
void pvr_set_pal_format(pvr_palfmt_t fmt)
Set the palette format.
pvr_palfmt_t
Definition pvr.h:1590
@ PVR_PAL_ARGB1555
16-bit ARGB1555 palette format
Definition pvr.h:1591
@ PVR_PAL_ARGB4444
16-bit ARGB4444 palette format
Definition pvr.h:1593
@ PVR_PAL_RGB565
16-bit RGB565 palette format
Definition pvr.h:1592
@ PVR_PAL_ARGB8888
32-bit ARGB8888 palette format
Definition pvr.h:1594
void pvr_mod_compile(pvr_mod_hdr_t *dst, pvr_list_t list, uint32_t mode, uint32_t cull)
Create a modifier volume header.
void pvr_poly_compile(pvr_poly_hdr_t *dst, const pvr_poly_cxt_t *src)
Compile a polygon context into a polygon header.
void pvr_poly_mod_compile(pvr_poly_mod_hdr_t *dst, const pvr_poly_cxt_t *src)
Compile a polygon context into a polygon header that is affected by modifier volumes.
void pvr_sprite_compile(pvr_sprite_hdr_t *dst, const pvr_sprite_cxt_t *src)
Compile a sprite context into a sprite header.
#define PVR_SET(REG, VALUE)
Set a PVR register value.
Definition pvr.h:1194
#define PVR_PALETTE_TABLE_BASE
Base of the palette table.
Definition pvr.h:1293
int pvr_scene_finish(void)
Call this after you have finished submitting all data for a frame.
void pvr_scene_begin_txr(pvr_ptr_t txr, uint32_t *rx, uint32_t *ry)
Begin collecting data for a frame of 3D output to the specified texture.
void pvr_scene_begin(void)
Begin collecting data for a frame of 3D output to the off-screen frame buffer.
void pvr_set_presort_mode(int presort)
Set the translucent polygon sort mode for the next frame.
int pvr_check_ready(void)
Check if the PVR system is ready for another frame to be submitted.
int pvr_wait_ready(void)
Block the caller until the PVR system is ready for another frame to be submitted.
int pvr_get_vbl_count(void)
Retrieve the current VBlank count.
int pvr_get_stats(pvr_stats_t *stat)
Get the current statistics from the PVR.
void pvr_txr_load(const void *src, pvr_ptr_t dst, uint32_t count)
Load raw texture data from an SH-4 buffer into PVR RAM.
void pvr_txr_load_kimg(const kos_img_t *img, pvr_ptr_t dst, uint32_t flags)
Load a KOS Platform Independent Image (subject to constraint checking).
bool pvr_txr_set_stride(uint32_t texture_width)
Set the global stride width for non-power-of-two textures in PVR RAM.
uint32_t pvr_txr_get_stride(void)
Get the current texture stride width in pixels as set in the PVR.
void pvr_txr_load_ex(const void *src, pvr_ptr_t dst, uint32_t w, uint32_t h, uint32_t flags)
Load texture data from an SH-4 buffer into PVR RAM, twiddling it in the process.
int pvr_vertex_dma_enabled(void)
Is vertex DMA enabled?
void pvr_vertbuf_written(pvr_list_t list, uint32_t amt)
Notify the PVR system that data have been written into the output buffer for the given list.
void * pvr_vertbuf_tail(pvr_list_t list)
Retrieve a pointer to the current output location in the DMA buffer for the requested list.
static uint32_t PVR_PACK_16BIT_UV(float u, float v)
Pack two floating point coordinates into one 32-bit value, truncating them to 16-bits each.
Definition pvr.h:1000
void * pvr_ptr_t
PVR texture memory pointer.
Definition pvr.h:68
Platform-independent image type.
Constants for areas of the system memory map.
Macros to help dealing with register fields.
Functions to access the SH4 Store Queues.
Platform-indpendent image type.
Definition img.h:51
PVR initialization structure.
Definition pvr.h:1378
int fsaa_enabled
Enable horizontal scaling?
Definition pvr.h:1402
int dma_enabled
Enable vertex DMA?
Definition pvr.h:1395
int vertex_buf_size
Vertex buffer size (should be a nice round number)
Definition pvr.h:1387
int autosort_disabled
Disable translucent polygon autosort?
Definition pvr.h:1410
int opb_overflow_count
OPB Overflow Count.
Definition pvr.h:1421
Modifier volume header.
Definition pvr.h:806
uint32_t d4
Dummy value.
Definition pvr.h:813
uint32_t mode1
Parameter word 1.
Definition pvr.h:809
uint32_t d5
Dummy value.
Definition pvr.h:814
uint32_t d2
Dummy value.
Definition pvr.h:811
uint32_t d3
Dummy value.
Definition pvr.h:812
uint32_t d1
Dummy value.
Definition pvr.h:810
uint32_t d6
Dummy value.
Definition pvr.h:815
PVR vertex type: Modifier volume.
Definition pvr.h:957
uint32_t d1
Dummy value.
Definition pvr.h:969
uint32_t d4
Dummy value.
Definition pvr.h:972
float by
Second Y coordinate.
Definition pvr.h:964
float ay
First Y coordinate.
Definition pvr.h:961
float ax
First X coordinate.
Definition pvr.h:960
uint32_t d3
Dummy value.
Definition pvr.h:971
float cz
Third Z coordinate.
Definition pvr.h:968
float bz
Second Z coordinate.
Definition pvr.h:965
float cy
Third Y coordinate.
Definition pvr.h:967
uint32_t d6
Dummy value.
Definition pvr.h:974
uint32_t d2
Dummy value.
Definition pvr.h:970
uint32_t d5
Dummy value.
Definition pvr.h:973
float bx
Second X coordinate.
Definition pvr.h:963
float az
First Z coordinate.
Definition pvr.h:962
float cx
Third X coordinate.
Definition pvr.h:966
PVR polygon context.
Definition pvr.h:117
int clip_mode
Clipping mode.
Definition pvr.h:131
int modifier_mode
Modifier mode.
Definition pvr.h:133
int mipmap_bias
Mipmap bias.
Definition pvr.h:182
int src2
Source blending mode inside modifier.
Definition pvr.h:152
int write
Enable or disable depth writes.
Definition pvr.h:172
int dst_enable
Dest blending enable outside modifier.
Definition pvr.h:150
int dst
Dest blending mode outside modifier.
Definition pvr.h:146
int fog_type2
Fog type inside modifier.
Definition pvr.h:138
int src
Source blending mode outside modifier.
Definition pvr.h:144
int color_clamp2
Color clamp enable/disable inside modifier.
Definition pvr.h:140
int alpha2
Enable/disable alpha inside modifier.
Definition pvr.h:136
int env
Texture color contribution.
Definition pvr.h:190
pvr_ptr_t base
Texture pointer.
Definition pvr.h:196
int culling
Culling mode.
Definition pvr.h:127
int width
Texture width (requires a power of 2)
Definition pvr.h:192
int color
Color format in vertex.
Definition pvr.h:162
int specular
Offset color enable/disable outside modifier.
Definition pvr.h:134
int height
Texture height (requires a power of 2)
Definition pvr.h:193
int comparison
Depth comparison mode.
Definition pvr.h:170
int src_enable
Source blending enable outside modifier.
Definition pvr.h:148
int dst2
Dest blending mode inside modifier.
Definition pvr.h:154
int fog_type
Fog type outside modifier.
Definition pvr.h:125
int shading
Shading type.
Definition pvr.h:123
int modifier
Enable or disable modifier effect.
Definition pvr.h:166
int uv_flip
Enable/disable U/V flipping.
Definition pvr.h:184
int list_type
Primitive list.
Definition pvr.h:118
int mipmap
Enable/disable mipmaps.
Definition pvr.h:180
int dst_enable2
Dest blending mode inside modifier.
Definition pvr.h:158
int filter
Filtering mode.
Definition pvr.h:178
int src_enable2
Source blending mode inside modifier.
Definition pvr.h:156
int color_clamp
Color clamp enable/disable outside modifier.
Definition pvr.h:129
int uv_clamp
Enable/disable U/V clamping.
Definition pvr.h:186
int alpha
Enable or disable alpha outside modifier.
Definition pvr.h:121
int format
Texture format.
Definition pvr.h:194
int enable
Enable/disable texturing.
Definition pvr.h:176
int uv
U/V data format in vertex.
Definition pvr.h:164
PVR polygon header.
Definition pvr.h:731
uint32_t d1
Dummy value.
Definition pvr.h:737
uint32_t mode3
Parameter word 3.
Definition pvr.h:736
uint32_t mode1
Parameter word 1.
Definition pvr.h:734
uint32_t mode2
Parameter word 2.
Definition pvr.h:735
uint32_t d2
Dummy value.
Definition pvr.h:738
uint32_t d3
Dummy value.
Definition pvr.h:739
uint32_t d4
Dummy value.
Definition pvr.h:740
PVR polygon header with intensity color.
Definition pvr.h:749
float b
Face color blue component.
Definition pvr.h:758
uint32_t mode3
Parameter word 3.
Definition pvr.h:754
float r
Face color red component.
Definition pvr.h:756
uint32_t mode1
Parameter word 1.
Definition pvr.h:752
float a
Face color alpha component.
Definition pvr.h:755
uint32_t mode2
Parameter word 2.
Definition pvr.h:753
float g
Face color green component.
Definition pvr.h:757
PVR polygon header to be used with modifier volumes.
Definition pvr.h:768
uint32_t mode3_1
Parameter word 3 (inside volume)
Definition pvr.h:775
uint32_t d2
Dummy value.
Definition pvr.h:777
uint32_t mode2_0
Parameter word 2 (outside volume)
Definition pvr.h:772
uint32_t d1
Dummy value.
Definition pvr.h:776
uint32_t mode2_1
Parameter word 2 (inside volume)
Definition pvr.h:774
uint32_t mode1
Parameter word 1.
Definition pvr.h:771
uint32_t mode3_0
Parameter word 3 (outside volume)
Definition pvr.h:773
PVR vertex type: Untextured sprite.
Definition pvr.h:932
float bz
Second Z coordinate.
Definition pvr.h:940
float ay
First Y coordinate.
Definition pvr.h:936
uint32_t d3
Dummy value.
Definition pvr.h:948
float cz
Third Z coordinate.
Definition pvr.h:943
float bx
Second X coordinate.
Definition pvr.h:938
uint32_t d1
Dummy value.
Definition pvr.h:946
float cy
Third Y coordinate.
Definition pvr.h:942
float ax
First X coordinate.
Definition pvr.h:935
float by
Second Y coordinate.
Definition pvr.h:939
uint32_t d4
Dummy value.
Definition pvr.h:949
float dy
Fourth Y coordinate.
Definition pvr.h:945
uint32_t d2
Dummy value.
Definition pvr.h:947
float cx
Third X coordinate.
Definition pvr.h:941
float az
First Z coordinate.
Definition pvr.h:937
float dx
Fourth X coordinate.
Definition pvr.h:944
PVR sprite context.
Definition pvr.h:236
int color_clamp
Color clamp enable/disable.
Definition pvr.h:246
int write
Enable or disable depth writes.
Definition pvr.h:266
int env
Texture color contribution.
Definition pvr.h:284
int enable
Enable/disable texturing.
Definition pvr.h:270
int src_enable
Source blending enable.
Definition pvr.h:258
int dst
Dest blending mode.
Definition pvr.h:256
int clip_mode
Clipping mode.
Definition pvr.h:248
int list_type
Primitive list.
Definition pvr.h:237
int dst_enable
Dest blending enable.
Definition pvr.h:260
int specular
Offset color enable/disable.
Definition pvr.h:250
int src
Source blending mode.
Definition pvr.h:254
int alpha
Enable or disable alpha.
Definition pvr.h:240
int width
Texture width (requires a power of 2)
Definition pvr.h:286
int filter
Filtering mode.
Definition pvr.h:272
int comparison
Depth comparison mode.
Definition pvr.h:264
pvr_ptr_t base
Texture pointer.
Definition pvr.h:290
int mipmap
Enable/disable mipmaps.
Definition pvr.h:274
int mipmap_bias
Mipmap bias.
Definition pvr.h:276
int uv_flip
Enable/disable U/V flipping.
Definition pvr.h:278
int uv_clamp
Enable/disable U/V clamping.
Definition pvr.h:280
int fog_type
Fog type.
Definition pvr.h:242
int height
Texture height (requires a power of 2)
Definition pvr.h:287
int format
Texture format.
Definition pvr.h:288
int culling
Culling mode.
Definition pvr.h:244
PVR polygon header specifically for sprites.
Definition pvr.h:787
uint32_t oargb
Sprite offset color.
Definition pvr.h:794
uint32_t d2
Dummy value.
Definition pvr.h:796
uint32_t mode1
Parameter word 1.
Definition pvr.h:790
uint32_t mode2
Parameter word 2.
Definition pvr.h:791
uint32_t d1
Dummy value.
Definition pvr.h:795
uint32_t mode3
Parameter word 3.
Definition pvr.h:792
uint32_t argb
Sprite face color.
Definition pvr.h:793
PVR vertex type: Textured sprite.
Definition pvr.h:907
float bz
Second Z coordinate.
Definition pvr.h:915
float dx
Fourth X coordinate.
Definition pvr.h:919
float az
First Z coordinate.
Definition pvr.h:912
float ax
First X coordinate.
Definition pvr.h:910
uint32_t buv
Second U/V texture coordinates.
Definition pvr.h:923
float cz
Third Z coordinate.
Definition pvr.h:918
uint32_t dummy
Dummy value.
Definition pvr.h:921
float by
Second Y coordinate.
Definition pvr.h:914
uint32_t auv
First U/V texture coordinates.
Definition pvr.h:922
float dy
Fourth Y coordinate.
Definition pvr.h:920
float cx
Third X coordinate.
Definition pvr.h:916
uint32_t cuv
Third U/V texture coordinates.
Definition pvr.h:924
float bx
Second X coordinate.
Definition pvr.h:913
float cy
Third Y coordinate.
Definition pvr.h:917
float ay
First Y coordinate.
Definition pvr.h:911
PVR statistics structure.
Definition pvr.h:1539
size_t vtx_buffer_used
Number of bytes used in the vertex buffer for the last frame.
Definition pvr.h:1546
size_t vtx_buffer_used_max
Number of bytes used in the vertex buffer for the largest frame.
Definition pvr.h:1547
uint64_t buf_last_time
DMA buffer file time for the last frame in nanoseconds.
Definition pvr.h:1543
size_t frame_count
Total number of rendered/viewed frames.
Definition pvr.h:1544
uint64_t frame_last_time
Ready-to-Ready length for the last frame in nanoseconds.
Definition pvr.h:1540
float frame_rate
Current frame rate (per second)
Definition pvr.h:1548
uint32_t enabled_list_mask
Which lists are enabled?
Definition pvr.h:1549
size_t vbl_count
VBlank count.
Definition pvr.h:1545
uint64_t reg_last_time
Registration time for the last frame in nanoseconds.
Definition pvr.h:1541
uint64_t rnd_last_time
Rendering time for the last frame in nanoseconds.
Definition pvr.h:1542
PVR vertex type: Non-textured, packed color, affected by modifier volume.
Definition pvr.h:855
float z
Z coordinate.
Definition pvr.h:860
uint32_t d1
Dummy value.
Definition pvr.h:863
uint32_t argb0
Vertex color (outside volume)
Definition pvr.h:861
float x
X coordinate.
Definition pvr.h:858
float y
Y coordinate.
Definition pvr.h:859
uint32_t d2
Dummy value.
Definition pvr.h:864
uint32_t argb1
Vertex color (inside volume)
Definition pvr.h:862
Generic PVR vertex type.
Definition pvr.h:835
float z
Z coordinate.
Definition pvr.h:840
float y
Y coordinate.
Definition pvr.h:839
float u
Texture U coordinate.
Definition pvr.h:841
uint32_t oargb
Vertex offset color.
Definition pvr.h:844
float x
X coordinate.
Definition pvr.h:838
float v
Texture V coordinate.
Definition pvr.h:842
uint32_t argb
Vertex color.
Definition pvr.h:843
PVR vertex type: Textured, packed color, affected by modifier volume.
Definition pvr.h:875
float z
Z coordinate.
Definition pvr.h:880
uint32_t oargb1
Vertex offset color (inside)
Definition pvr.h:888
uint32_t oargb0
Vertex offset color (outside)
Definition pvr.h:884
float x
X coordinate.
Definition pvr.h:878
float u0
Texture U coordinate (outside)
Definition pvr.h:881
uint32_t d2
Dummy value.
Definition pvr.h:890
float v0
Texture V coordinate (outside)
Definition pvr.h:882
uint32_t d4
Dummy value.
Definition pvr.h:892
float u1
Texture U coordinate (inside)
Definition pvr.h:885
float y
Y coordinate.
Definition pvr.h:879
float v1
Texture V coordinate (inside)
Definition pvr.h:886
uint32_t argb0
Vertex color (outside)
Definition pvr.h:883
uint32_t argb1
Vertex color (inside)
Definition pvr.h:887
uint32_t d1
Dummy value.
Definition pvr.h:889
uint32_t d3
Dummy value.
Definition pvr.h:891