ps2sdk
1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
|
Macros | |
#define | VU_GS_PRIM(PRIM, IIP, TME, FGE, ABE, AA1, FST, CTXT, FIX) (u128)(((FIX << 10) | (CTXT << 9) | (FST << 8) | (AA1 << 7) | (ABE << 6) | (FGE << 5) | (TME << 4) | (IIP << 3) | (PRIM))) |
#define | VU_GS_GIFTAG(NLOOP, EOP, PRE, PRIM, FLG, NREG) (((u64)(NREG) << 60) | ((u64)(FLG) << 58) | ((u64)(PRIM) << 47) | ((u64)(PRE) << 46) | (EOP << 15) | (NLOOP << 0)) |
Useful functions and examples for libpacket2.
#define VU_GS_GIFTAG | ( | NLOOP, | |
EOP, | |||
PRE, | |||
PRIM, | |||
FLG, | |||
NREG | |||
) | (((u64)(NREG) << 60) | ((u64)(FLG) << 58) | ((u64)(PRIM) << 47) | ((u64)(PRE) << 46) | (EOP << 15) | (NLOOP << 0)) |
Definition at line 33 of file packet2_utils.h.
#define VU_GS_PRIM | ( | PRIM, | |
IIP, | |||
TME, | |||
FGE, | |||
ABE, | |||
AA1, | |||
FST, | |||
CTXT, | |||
FIX | |||
) | (u128)(((FIX << 10) | (CTXT << 9) | (FST << 8) | (AA1 << 7) | (ABE << 6) | (FGE << 5) | (TME << 4) | (IIP << 3) | (PRIM))) |
Definition at line 32 of file packet2_utils.h.
Get program size in qws
start | Start address. |
end | End address. |
Definition at line 138 of file packet2_utils.h.
Referenced by vu1_upload_micro_program().
Add set GIFTag which will be sent from VU1 via XGKICK instruction.
packet2 | Pointer to packet2. |
loops_count | How many GIF tags there will be? |
Definition at line 157 of file packet2_utils.h.
References GIF_FLG_PACKED, GIF_REG_AD, GIF_SET_TAG, and packet2_add_2x_s64().
Referenced by calculate_cube().
|
inlinestatic |
Add draw finish event GIFTag which will be sent from VU1 via XGKICK instruction. Used for synchronization via draw_wait_finish()
packet2 | Pointer to packet2. |
Definition at line 220 of file packet2_utils.h.
References GS_REG_FINISH, and packet2_add_2x_s64().
Add lod GIFTag which will be sent from VU1 via XGKICK instruction.
packet2 | Pointer to packet2. |
lod | Pointer to lod settings. |
Definition at line 172 of file packet2_utils.h.
References lod_t::calculation, GS_REG_TEX1, GS_SET_TEX1, lod_t::k, lod_t::l, lod, lod_t::mag_filter, lod_t::max_level, lod_t::min_filter, lod_t::mipmap_select, and packet2_add_2x_s64().
Referenced by calculate_cube().
|
inlinestatic |
Add drawing (prim) GIFTag which will be sent from VU1 via XGKICK instruction.
packet2 | Pointer to packet2. |
prim | Pointer to prim settings. |
loops_count | GIF tag loops count. |
nreg | What types of data we will use? |
nreg_count | How many types there are in nreg? |
context | Drawing context |
Definition at line 235 of file packet2_utils.h.
References prim_t::antialiasing, prim_t::blending, prim_t::colorfix, context, prim_t::fogging, prim_t::mapping, prim_t::mapping_type, packet2_add_2x_s64(), prim, prim_t::shading, prim_t::type, VU_GS_GIFTAG, and VU_GS_PRIM.
Referenced by calculate_cube().
|
inlinestatic |
Add texture buffer / clut GIFTag which will be sent from VU1 via XGKICK instruction.
packet2 | Pointer to packet2. |
texbuff | Pointer to texture buffer. |
clut | Pointer to clut buffer. |
Definition at line 194 of file packet2_utils.h.
References texbuffer_t::address, clutbuffer_t::address, clut, texinfo_t::components, texinfo_t::function, GS_REG_TEX0, GS_SET_TEX0, texinfo_t::height, texbuffer_t::info, clutbuffer_t::load_method, packet2_add_2x_s64(), texbuffer_t::psm, clutbuffer_t::psm, clutbuffer_t::start, clutbuffer_t::storage_mode, texinfo_t::width, and texbuffer_t::width.
Referenced by calculate_cube().
|
inlinestatic |
Continue VU micro program (from –cont line). Adds FLUSH and MSCNT VIF opcodes.
Definition at line 103 of file packet2_utils.h.
References packet2_chain_close_tag(), packet2_chain_open_cnt(), packet2_vif_flush(), and packet2_vif_mscnt().
|
inlinestatic |
Add VU buffers size settings.
t_base | Base address (qw) |
t_offset | Offset address (qw) |
Definition at line 49 of file packet2_utils.h.
References packet2_chain_close_tag(), packet2_chain_open_cnt(), packet2_vif_base(), and packet2_vif_offset().
Referenced by vu1_set_double_buffer_settings().
|
inlinestatic |
Add aligned END tag (with nops).
Definition at line 124 of file packet2_utils.h.
References packet2_chain_close_tag(), packet2_chain_open_end(), and packet2_vif_nop().
Referenced by draw_cube(), vu1_set_double_buffer_settings(), and vu1_upload_micro_program().
Start VU micro program. Adds FLUSH and MSCAL VIF opcodes.
Definition at line 115 of file packet2_utils.h.
References packet2_chain_close_tag(), packet2_chain_open_cnt(), packet2_vif_flush(), and packet2_vif_mscal().
Referenced by draw_cube().
|
inlinestatic |
Add data via REF tag and UNPACK. Please be sure that data is aligned, and there is no any open UNPACK/DIRECT.
packet2 | Pointer to packet2. |
t_dest_address | Destination address. |
t_data | Data pointer. |
t_size | Size in quadwords. |
t_use_top | Unpack to current double buffer? |
Definition at line 67 of file packet2_utils.h.
References P2_UNPACK_V4_32, packet2_chain_ref(), packet2_vif_close_unpack_manual(), packet2_vif_open_unpack(), and packet2_vif_stcycl().
Referenced by draw_cube().
Close CNT tag + VU unpack.
Definition at line 92 of file packet2_utils.h.
References packet2_chain_close_tag(), packet2_vif_close_unpack_auto(), and packet2_vif_pad128().
|
inlinestatic |
Open CNT tag + VU unpack.
packet2 | Pointer to packet2. |
t_dest_address | Destination address. |
t_use_top | Unpack to current double buffer? |
Definition at line 81 of file packet2_utils.h.
References P2_UNPACK_V4_32, packet2_chain_open_cnt(), packet2_vif_open_unpack(), and packet2_vif_stcycl().