92typedef enum pvr_mip_bias {
129typedef enum pvr_uv_flip {
147typedef enum pvr_uv_clamp {
305#define PVR_TXRFMT_NONE 0
306#define PVR_TXRFMT_VQ_DISABLE (0 << 30)
307#define PVR_TXRFMT_VQ_ENABLE (1 << 30)
308#define PVR_TXRFMT_ARGB1555 (0 << 27)
309#define PVR_TXRFMT_RGB565 (1 << 27)
310#define PVR_TXRFMT_ARGB4444 (2 << 27)
311#define PVR_TXRFMT_YUV422 (3 << 27)
312#define PVR_TXRFMT_BUMP (4 << 27)
313#define PVR_TXRFMT_PAL4BPP (5 << 27)
314#define PVR_TXRFMT_PAL8BPP (6 << 27)
315#define PVR_TXRFMT_TWIDDLED (0 << 26)
316#define PVR_TXRFMT_NONTWIDDLED (1 << 26)
317#define PVR_TXRFMT_POW2_STRIDE (0 << 25)
318#define PVR_TXRFMT_X32_STRIDE (1 << 25)
331#define PVR_TXRFMT_8BPP_PAL(x) ((x) << 25)
336#define PVR_TXRFMT_4BPP_PAL(x) ((x) << 21)
354#define PVR_MODIFIER_OTHER_POLY 0
355#define PVR_MODIFIER_INCLUDE_LAST_POLY 1
356#define PVR_MODIFIER_EXCLUDE_LAST_POLY 2
372#define pvr_poly_ic_hdr pvr_poly_hdr
382#define pvr_poly_mod_hdr pvr_poly_hdr
392#define pvr_sprite_hdr pvr_poly_hdr
402#define pvr_mod_hdr pvr_poly_hdr
421typedef struct pvr_vertex {
449typedef struct pvr_vertex_pcm {
469typedef struct pvr_vertex_tpcm {
501typedef struct pvr_sprite_txr {
526typedef struct pvr_sprite_col {
551typedef struct pvr_modifier_vol {
582#define PVR_CMD_POLYHDR 0x80840000
584#define PVR_CMD_VERTEX 0xe0000000
585#define PVR_CMD_VERTEX_EOL 0xf0000000
586#define PVR_CMD_USERCLIP 0x20000000
587#define PVR_CMD_MODIFIER 0x80000000
588#define PVR_CMD_SPRITE 0xA0000000
600#define PVR_TA_CMD_TYPE GENMASK(26, 24)
601#define PVR_TA_CMD_USERCLIP GENMASK(17, 16)
602#define PVR_TA_CMD_MODIFIER BIT(7)
603#define PVR_TA_CMD_MODIFIERMODE BIT(6)
604#define PVR_TA_CMD_CLRFMT GENMASK(5, 4)
605#define PVR_TA_CMD_TXRENABLE BIT(3)
606#define PVR_TA_CMD_SPECULAR BIT(2)
607#define PVR_TA_CMD_SHADE BIT(1)
608#define PVR_TA_CMD_UVFMT BIT(0)
609#define PVR_TA_PM1_DEPTHCMP GENMASK(31, 29)
610#define PVR_TA_PM1_CULLING GENMASK(28, 27)
611#define PVR_TA_PM1_DEPTHWRITE BIT(26)
612#define PVR_TA_PM1_TXRENABLE BIT(25)
613#define PVR_TA_PM1_MODIFIERINST GENMASK(30, 29)
614#define PVR_TA_PM2_SRCBLEND GENMASK(31, 29)
615#define PVR_TA_PM2_DSTBLEND GENMASK(28, 26)
616#define PVR_TA_PM2_SRCENABLE BIT(25)
617#define PVR_TA_PM2_DSTENABLE BIT(24)
618#define PVR_TA_PM2_FOG GENMASK(23, 22)
619#define PVR_TA_PM2_CLAMP BIT(21)
620#define PVR_TA_PM2_ALPHA BIT(20)
621#define PVR_TA_PM2_TXRALPHA BIT(19)
622#define PVR_TA_PM2_UVFLIP GENMASK(18, 17)
623#define PVR_TA_PM2_UVCLAMP GENMASK(16, 15)
624#define PVR_TA_PM2_FILTER GENMASK(14, 13)
625#define PVR_TA_PM2_MIPBIAS GENMASK(11, 8)
626#define PVR_TA_PM2_TXRENV GENMASK(7, 6)
627#define PVR_TA_PM2_USIZE GENMASK(5, 3)
628#define PVR_TA_PM2_VSIZE GENMASK(2, 0)
629#define PVR_TA_PM3_MIPMAP BIT(31)
630#define PVR_TA_PM3_TXRFMT GENMASK(30, 21)
647#define PVR_BINSIZE_0 0
648#define PVR_BINSIZE_8 8
649#define PVR_BINSIZE_16 16
650#define PVR_BINSIZE_32 32
981#define pvr_dr_target(vtx_buf_ptr) \
982 ({ (vtx_buf_ptr) ^= 32; \
983 (pvr_vertex_t *)(MEM_AREA_SQ_BASE | (vtx_buf_ptr)); \
991#define pvr_dr_commit(addr) sq_flush(addr)
1147 int textureformat,
int tw,
int th,
pvr_ptr_t textureaddr,
1190 int textureformat,
int tw,
int th,
pvr_ptr_t textureaddr,
1262 int textureformat,
int tw,
int th,
1264 int textureformat2,
int tw2,
int th2,
int mode
Definition 2ndmix.c:539
pvr_init_params_t params
Definition 2ndmix.c:821
static struct @68 data[BARRIER_COUNT]
static pvr_ptr_t txr
Definition bump.c:28
Cache management functionality.
Various common macros used throughout the codebase.
Constants for areas of the system memory map.
static float rx
Definition gl-elements.c:45
void pvr_poly_cxt_txr(pvr_poly_cxt_t *dst, pvr_list_t list, int textureformat, int tw, int th, pvr_ptr_t textureaddr, pvr_filter_mode_t filtering)
Fill in a polygon context for a textured polygon.
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_sprite_cxt_txr(pvr_sprite_cxt_t *dst, pvr_list_t list, int textureformat, int tw, int th, pvr_ptr_t textureaddr, pvr_filter_mode_t filtering)
Fill in a sprite context for a textured sprite.
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, pvr_filter_mode_t filtering, int textureformat2, int tw2, int th2, pvr_ptr_t textureaddr2, pvr_filter_mode_t filtering2)
Fill in a polygon context for a textured polygon affected by modifier volumes.
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:961
void pvr_dr_finish(void)
Finish work with Direct Rendering.
int pvr_shutdown(void)
Shut down the PVR chip from ready status.
int pvr_init_defaults(void)
Simple PVR initialization.
int pvr_init(const pvr_init_params_t *params)
Initialize the PVR chip to ready status.
void * pvr_set_vertbuf(pvr_list_t list, void *buffer, size_t len)
Setup a vertex buffer for one of the list types.
int pvr_list_flush(pvr_list_t list)
Flush the buffered data of the given list type to the TA.
int pvr_prim(const void *data, size_t size)
Submit a primitive of the current list type.
int pvr_list_finish(void)
End collecting data for the current list type.
int pvr_list_prim(pvr_list_t list, const void *data, size_t size)
Submit a primitive of the given list type.
int pvr_list_begin(pvr_list_t list)
Begin collecting data for the given list type.
pvr_mip_bias_t
Definition pvr.h:92
@ PVR_MIPBIAS_1_50
Definition pvr.h:98
@ PVR_MIPBIAS_3_25
Definition pvr.h:105
@ PVR_MIPBIAS_3_50
Definition pvr.h:106
@ PVR_MIPBIAS_2_00
Definition pvr.h:100
@ PVR_MIPBIAS_0_75
Definition pvr.h:95
@ PVR_MIPBIAS_1_00
Definition pvr.h:96
@ PVR_MIPBIAS_0_50
Definition pvr.h:94
@ PVR_MIPBIAS_2_50
Definition pvr.h:102
@ PVR_MIPBIAS_0_25
Definition pvr.h:93
@ PVR_MIPBIAS_3_75
Definition pvr.h:107
@ PVR_MIPBIAS_2_25
Definition pvr.h:101
@ PVR_MIPBIAS_1_25
Definition pvr.h:97
@ PVR_MIPBIAS_NORMAL
Definition pvr.h:108
@ PVR_MIPBIAS_2_75
Definition pvr.h:103
@ PVR_MIPBIAS_1_75
Definition pvr.h:99
@ PVR_MIPBIAS_3_00
Definition pvr.h:104
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.
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.
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_wait_render_done(void)
Block the caller until the PVR has finished rendering the previous frame.
#define PVR_TXRFMT_POW2_STRIDE
Stride is a power-of-two.
Definition pvr.h:317
static const uint32_t PVR_TXRFMT_NOSTRIDE
Definition pvr.h:321
static const uint32_t PVR_TXRFMT_STRIDE
Definition pvr.h:322
#define PVR_TXRFMT_X32_STRIDE
Stride is multiple of 32.
Definition pvr.h:318
pvr_ptr_t pvr_get_back_buffer(void)
Get a pointer to the back buffer.
pvr_ptr_t pvr_get_front_buffer(void)
Get a pointer to the front buffer.
pvr_uv_clamp_t
Definition pvr.h:147
@ PVR_UVCLAMP_UV
Clamp U and V.
Definition pvr.h:151
@ PVR_UVCLAMP_NONE
Disable clamping.
Definition pvr.h:148
@ PVR_UVCLAMP_U
Clamp U only.
Definition pvr.h:150
@ PVR_UVCLAMP_V
Clamp V only.
Definition pvr.h:149
pvr_uv_flip_t
Definition pvr.h:129
@ PVR_UVFLIP_NONE
No flipped coordinates.
Definition pvr.h:130
@ PVR_UVFLIP_UV
Flip U and V.
Definition pvr.h:133
@ PVR_UVFLIP_V
Flip V only.
Definition pvr.h:131
@ PVR_UVFLIP_U
Flip U only.
Definition pvr.h:132
void pvr_vertbuf_written(pvr_list_t list, size_t amt)
Notify the PVR system that data have been written into the output buffer for the given list.
int pvr_vertex_dma_enabled(void)
Is vertex DMA enabled?
void * pvr_vertbuf_tail(pvr_list_t list)
Retrieve a pointer to the current output location in the DMA buffer for the requested list.
void * pvr_ptr_t
PVR texture memory pointer.
Definition pvr_mem.h:45
Platform-independent image type.
static char buffer[256]
Definition porthelper.c:11
API for utilizing the DMA with the PVR for rendering.
Public API for the PVR's hardware fog.
All deprecated PVR API Constants.
VRAM Management and Access.
Miscellaneous utilities for the PVR API.
Palette API for the PowerVR.
Texture management with the PVR 3D API.
Macros to help dealing with register fields.
static pvr_list_t list
Definition shadow.c:25
Functions to access the SH4 Store Queues.
PVR initialization structure.
Definition pvr.h:664
int fsaa_enabled
Enable horizontal scaling?
Definition pvr.h:688
int vbuf_doublebuf_disabled
Disable vertex buffer double-buffering.
Definition pvr.h:714
int dma_enabled
Enable vertex DMA?
Definition pvr.h:681
int vertex_buf_size
Vertex buffer size (should be a nice round number)
Definition pvr.h:673
int autosort_disabled
Disable translucent polygon autosort?
Definition pvr.h:696
int opb_overflow_count
OPB Overflow Count.
Definition pvr.h:707
PVR vertex type: Modifier volume.
Definition pvr.h:551
uint32_t d1
Dummy value.
Definition pvr.h:563
uint32_t d4
Dummy value.
Definition pvr.h:566
float by
Second Y coordinate.
Definition pvr.h:558
float ay
First Y coordinate.
Definition pvr.h:555
float ax
First X coordinate.
Definition pvr.h:554
uint32_t d3
Dummy value.
Definition pvr.h:565
float cz
Third Z coordinate.
Definition pvr.h:562
float bz
Second Z coordinate.
Definition pvr.h:559
float cy
Third Y coordinate.
Definition pvr.h:561
uint32_t d6
Dummy value.
Definition pvr.h:568
uint32_t d2
Dummy value.
Definition pvr.h:564
uint32_t d5
Dummy value.
Definition pvr.h:567
float bx
Second X coordinate.
Definition pvr.h:557
float az
First Z coordinate.
Definition pvr.h:556
float cx
Third X coordinate.
Definition pvr.h:560
PVR polygon context.
Definition pvr.h:172
pvr_list_t list_type
Primitive list.
Definition pvr.h:173
bool specular
Enable offset color outside modifier.
Definition pvr.h:182
pvr_blend_mode_t src
Source blending mode outside modifier.
Definition pvr.h:188
pvr_uv_clamp_t uv_clamp
Enable/disable U/V clamping.
Definition pvr.h:212
pvr_cull_mode_t culling
Culling mode.
Definition pvr.h:178
bool mipmap
Enable/disable mipmaps.
Definition pvr.h:209
pvr_fog_type_t fog_type2
Fog type inside modifier.
Definition pvr.h:184
bool modifier_mode
True normal; false: cheap shadow.
Definition pvr.h:181
bool alpha2
Enable alpha inside modifier.
Definition pvr.h:183
pvr_uv_flip_t uv_flip
Enable/disable U/V flipping.
Definition pvr.h:211
bool color_clamp
Enable color clamping outside modifer.
Definition pvr.h:179
pvr_filter_mode_t filter
Filtering mode.
Definition pvr.h:208
bool write
Enable depth writes.
Definition pvr.h:204
pvr_ptr_t base
Texture pointer.
Definition pvr.h:219
pvr_blend_mode_t src2
Source blending mode inside modifier.
Definition pvr.h:192
bool enable
Enable/disable texturing.
Definition pvr.h:207
bool shading
Enable gourad shading.
Definition pvr.h:176
pvr_mip_bias_t mipmap_bias
Mipmap bias.
Definition pvr.h:210
int width
Texture width (requires a power of 2)
Definition pvr.h:215
pvr_blend_mode_t dst
Dest blending mode outside modifier.
Definition pvr.h:189
bool color_clamp2
Enable color clamping inside modifer.
Definition pvr.h:185
int height
Texture height (requires a power of 2)
Definition pvr.h:216
bool uv
True: 16-bit floating-point U/Vs; False: 32-bit.
Definition pvr.h:199
pvr_depthcmp_mode_t comparison
Depth comparison mode.
Definition pvr.h:203
bool src_enable2
Source blending mode inside modifier.
Definition pvr.h:194
pvr_blend_mode_t dst2
Dest blending mode inside modifier.
Definition pvr.h:193
bool modifier
Enable modifier effects.
Definition pvr.h:200
bool src_enable
Source blending enable outside modifier.
Definition pvr.h:190
pvr_color_fmts_t color
Color format in vertex.
Definition pvr.h:198
pvr_txr_shading_mode_t env
Texture color contribution.
Definition pvr.h:214
pvr_fog_type_t fog_type
Fog type outside modifier.
Definition pvr.h:177
struct pvr_poly_cxt_t::@30 txr2
Texturing params inside modifier.
bool alpha
Enable alpha outside modifier.
Definition pvr.h:175
pvr_clip_mode_t clip_mode
Clipping mode.
Definition pvr.h:180
bool dst_enable2
Dest blending mode inside modifier.
Definition pvr.h:195
bool dst_enable
Dest blending enable outside modifier.
Definition pvr.h:191
int format
Texture format.
Definition pvr.h:217
PVR polygon header.
Definition pvr_header.h:311
PVR vertex type: Untextured sprite.
Definition pvr.h:526
float bz
Second Z coordinate.
Definition pvr.h:534
float ay
First Y coordinate.
Definition pvr.h:530
uint32_t d3
Dummy value.
Definition pvr.h:542
float cz
Third Z coordinate.
Definition pvr.h:537
float bx
Second X coordinate.
Definition pvr.h:532
uint32_t d1
Dummy value.
Definition pvr.h:540
float cy
Third Y coordinate.
Definition pvr.h:536
float ax
First X coordinate.
Definition pvr.h:529
float by
Second Y coordinate.
Definition pvr.h:533
uint32_t d4
Dummy value.
Definition pvr.h:543
float dy
Fourth Y coordinate.
Definition pvr.h:539
uint32_t d2
Dummy value.
Definition pvr.h:541
float cx
Third X coordinate.
Definition pvr.h:535
float az
First Z coordinate.
Definition pvr.h:531
float dx
Fourth X coordinate.
Definition pvr.h:538
PVR sprite context.
Definition pvr.h:237
bool alpha
Enable alpha.
Definition pvr.h:240
bool mipmap
Enable/disable mipmaps.
Definition pvr.h:260
bool enable
Enable/disable texturing.
Definition pvr.h:258
pvr_mip_bias_t mipmap_bias
Mipmap bias.
Definition pvr.h:261
bool src_enable
Source blending enable.
Definition pvr.h:250
pvr_uv_clamp_t uv_clamp
Enable/disable U/V clamping.
Definition pvr.h:263
pvr_blend_mode_t dst
Dest blending mode.
Definition pvr.h:249
pvr_fog_type_t fog_type
Fog type.
Definition pvr.h:241
bool write
Enable depth writes.
Definition pvr.h:255
pvr_uv_flip_t uv_flip
Enable/disable U/V flipping.
Definition pvr.h:262
bool specular
Enable offset color.
Definition pvr.h:245
bool color_clamp
Enable color clamp.
Definition pvr.h:243
pvr_list_t list_type
Primitive list.
Definition pvr.h:238
pvr_clip_mode_t clip_mode
Clipping mode.
Definition pvr.h:244
int width
Texture width (requires a power of 2)
Definition pvr.h:266
pvr_txr_shading_mode_t env
Texture color contribution.
Definition pvr.h:265
pvr_ptr_t base
Texture pointer.
Definition pvr.h:270
pvr_blend_mode_t src
Source blending mode.
Definition pvr.h:248
pvr_filter_mode_t filter
Filtering mode.
Definition pvr.h:259
pvr_cull_mode_t culling
Culling mode.
Definition pvr.h:242
pvr_depthcmp_mode_t comparison
Depth comparison mode.
Definition pvr.h:254
int height
Texture height (requires a power of 2)
Definition pvr.h:267
bool dst_enable
Dest blending enable.
Definition pvr.h:251
int format
Texture format.
Definition pvr.h:268
PVR vertex type: Textured sprite.
Definition pvr.h:501
float bz
Second Z coordinate.
Definition pvr.h:509
float dx
Fourth X coordinate.
Definition pvr.h:513
float az
First Z coordinate.
Definition pvr.h:506
float ax
First X coordinate.
Definition pvr.h:504
uint32_t buv
Second U/V texture coordinates.
Definition pvr.h:517
float cz
Third Z coordinate.
Definition pvr.h:512
uint32_t dummy
Dummy value.
Definition pvr.h:515
float by
Second Y coordinate.
Definition pvr.h:508
uint32_t auv
First U/V texture coordinates.
Definition pvr.h:516
float dy
Fourth Y coordinate.
Definition pvr.h:514
float cx
Third X coordinate.
Definition pvr.h:510
uint32_t cuv
Third U/V texture coordinates.
Definition pvr.h:518
float bx
Second X coordinate.
Definition pvr.h:507
float cy
Third Y coordinate.
Definition pvr.h:511
float ay
First Y coordinate.
Definition pvr.h:505
PVR vertex type: Non-textured, packed color, affected by modifier volume.
Definition pvr.h:449
float z
Z coordinate.
Definition pvr.h:454
uint32_t d1
Dummy value.
Definition pvr.h:457
uint32_t argb0
Vertex color (outside volume)
Definition pvr.h:455
float x
X coordinate.
Definition pvr.h:452
float y
Y coordinate.
Definition pvr.h:453
uint32_t d2
Dummy value.
Definition pvr.h:458
uint32_t argb1
Vertex color (inside volume)
Definition pvr.h:456
Generic PVR vertex type.
Definition pvr.h:421
float z
Z coordinate.
Definition pvr.h:426
float y
Y coordinate.
Definition pvr.h:425
float u
Texture U coordinate.
Definition pvr.h:429
uint32_t oargb
Vertex offset color.
Definition pvr.h:438
uint32_t argb1
Vertex color when modified, inside area.
Definition pvr.h:434
float x
X coordinate.
Definition pvr.h:424
float v
Texture V coordinate.
Definition pvr.h:430
uint32_t argb
Vertex color.
Definition pvr.h:437
uint32_t argb0
Vertex color when modified, outside area.
Definition pvr.h:433
PVR vertex type: Textured, packed color, affected by modifier volume.
Definition pvr.h:469
float z
Z coordinate.
Definition pvr.h:474
uint32_t oargb1
Vertex offset color (inside)
Definition pvr.h:482
uint32_t oargb0
Vertex offset color (outside)
Definition pvr.h:478
float x
X coordinate.
Definition pvr.h:472
float u0
Texture U coordinate (outside)
Definition pvr.h:475
uint32_t d2
Dummy value.
Definition pvr.h:484
float v0
Texture V coordinate (outside)
Definition pvr.h:476
uint32_t d4
Dummy value.
Definition pvr.h:486
float u1
Texture U coordinate (inside)
Definition pvr.h:479
float y
Y coordinate.
Definition pvr.h:473
float v1
Texture V coordinate (inside)
Definition pvr.h:480
uint32_t argb0
Vertex color (outside)
Definition pvr.h:477
uint32_t argb1
Vertex color (inside)
Definition pvr.h:481
uint32_t d1
Dummy value.
Definition pvr.h:483
uint32_t d3
Dummy value.
Definition pvr.h:485