90typedef enum pvr_mip_bias {
127typedef enum pvr_uv_flip {
145typedef enum pvr_uv_clamp {
303#define PVR_TXRFMT_NONE 0
304#define PVR_TXRFMT_VQ_DISABLE (0 << 30)
305#define PVR_TXRFMT_VQ_ENABLE (1 << 30)
306#define PVR_TXRFMT_ARGB1555 (0 << 27)
307#define PVR_TXRFMT_RGB565 (1 << 27)
308#define PVR_TXRFMT_ARGB4444 (2 << 27)
309#define PVR_TXRFMT_YUV422 (3 << 27)
310#define PVR_TXRFMT_BUMP (4 << 27)
311#define PVR_TXRFMT_PAL4BPP (5 << 27)
312#define PVR_TXRFMT_PAL8BPP (6 << 27)
313#define PVR_TXRFMT_TWIDDLED (0 << 26)
314#define PVR_TXRFMT_NONTWIDDLED (1 << 26)
315#define PVR_TXRFMT_POW2_STRIDE (0 << 25)
316#define PVR_TXRFMT_X32_STRIDE (1 << 25)
329#define PVR_TXRFMT_8BPP_PAL(x) ((x) << 25)
334#define PVR_TXRFMT_4BPP_PAL(x) ((x) << 21)
352#define PVR_MODIFIER_OTHER_POLY 0
353#define PVR_MODIFIER_INCLUDE_LAST_POLY 1
354#define PVR_MODIFIER_EXCLUDE_LAST_POLY 2
370#define pvr_poly_ic_hdr pvr_poly_hdr
380#define pvr_poly_mod_hdr pvr_poly_hdr
390#define pvr_sprite_hdr pvr_poly_hdr
400#define pvr_mod_hdr pvr_poly_hdr
419typedef struct pvr_vertex {
447typedef struct pvr_vertex_pcm {
467typedef struct pvr_vertex_tpcm {
499typedef struct pvr_sprite_txr {
524typedef struct pvr_sprite_col {
549typedef struct pvr_modifier_vol {
580#define PVR_CMD_POLYHDR 0x80840000
582#define PVR_CMD_VERTEX 0xe0000000
583#define PVR_CMD_VERTEX_EOL 0xf0000000
584#define PVR_CMD_USERCLIP 0x20000000
585#define PVR_CMD_MODIFIER 0x80000000
586#define PVR_CMD_SPRITE 0xA0000000
598#define PVR_TA_CMD_TYPE GENMASK(26, 24)
599#define PVR_TA_CMD_USERCLIP GENMASK(17, 16)
600#define PVR_TA_CMD_MODIFIER BIT(7)
601#define PVR_TA_CMD_MODIFIERMODE BIT(6)
602#define PVR_TA_CMD_CLRFMT GENMASK(5, 4)
603#define PVR_TA_CMD_TXRENABLE BIT(3)
604#define PVR_TA_CMD_SPECULAR BIT(2)
605#define PVR_TA_CMD_SHADE BIT(1)
606#define PVR_TA_CMD_UVFMT BIT(0)
607#define PVR_TA_PM1_DEPTHCMP GENMASK(31, 29)
608#define PVR_TA_PM1_CULLING GENMASK(28, 27)
609#define PVR_TA_PM1_DEPTHWRITE BIT(26)
610#define PVR_TA_PM1_TXRENABLE BIT(25)
611#define PVR_TA_PM1_MODIFIERINST GENMASK(30, 29)
612#define PVR_TA_PM2_SRCBLEND GENMASK(31, 29)
613#define PVR_TA_PM2_DSTBLEND GENMASK(28, 26)
614#define PVR_TA_PM2_SRCENABLE BIT(25)
615#define PVR_TA_PM2_DSTENABLE BIT(24)
616#define PVR_TA_PM2_FOG GENMASK(23, 22)
617#define PVR_TA_PM2_CLAMP BIT(21)
618#define PVR_TA_PM2_ALPHA BIT(20)
619#define PVR_TA_PM2_TXRALPHA BIT(19)
620#define PVR_TA_PM2_UVFLIP GENMASK(18, 17)
621#define PVR_TA_PM2_UVCLAMP GENMASK(16, 15)
622#define PVR_TA_PM2_FILTER GENMASK(14, 13)
623#define PVR_TA_PM2_MIPBIAS GENMASK(11, 8)
624#define PVR_TA_PM2_TXRENV GENMASK(7, 6)
625#define PVR_TA_PM2_USIZE GENMASK(5, 3)
626#define PVR_TA_PM2_VSIZE GENMASK(2, 0)
627#define PVR_TA_PM3_MIPMAP BIT(31)
628#define PVR_TA_PM3_TXRFMT GENMASK(30, 21)
645#define PVR_BINSIZE_0 0
646#define PVR_BINSIZE_8 8
647#define PVR_BINSIZE_16 16
648#define PVR_BINSIZE_32 32
726 .vertex_buf_size = 512 * 1024,
727 .opb_overflow_count = 3
904 __depr(
"pvr_scene_begin_txr() is deprecated. Use pvr_scene_begin_rtt().");
931 uint32_t render_h, uint32_t stride_px);
1003extern uint32_t pvr_dr_addr;
1015#define pvr_dr_target(...) __builtin_assume_aligned((void *)((pvr_dr_addr ^= 32)), 32)
1022#define pvr_dr_commit(addr) sq_flush(addr)
1170 int textureformat,
int tw,
int th,
pvr_ptr_t textureaddr,
1213 int textureformat,
int tw,
int th,
pvr_ptr_t textureaddr,
1285 int textureformat,
int tw,
int th,
1287 int textureformat2,
int tw2,
int th2,
int mode
Definition 2ndmix.c:539
pvr_init_params_t params
Definition 2ndmix.c:820
static struct @89 data[BARRIER_COUNT]
static pvr_ptr_t txr
Definition bump.c:28
Various common macros used throughout the codebase.
Constants for areas of the system memory map.
#define PVR_BINSIZE_16
16-word (64-byte) length
Definition pvr.h:647
#define PVR_BINSIZE_0
0-length (disables the list)
Definition pvr.h:645
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.
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.
static const pvr_init_params_t pvr_default_params
PVR initialization structure defaults.
Definition pvr.h:724
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:90
@ PVR_MIPBIAS_1_50
Definition pvr.h:96
@ PVR_MIPBIAS_3_25
Definition pvr.h:103
@ PVR_MIPBIAS_3_50
Definition pvr.h:104
@ PVR_MIPBIAS_2_00
Definition pvr.h:98
@ PVR_MIPBIAS_0_75
Definition pvr.h:93
@ PVR_MIPBIAS_1_00
Definition pvr.h:94
@ PVR_MIPBIAS_0_50
Definition pvr.h:92
@ PVR_MIPBIAS_2_50
Definition pvr.h:100
@ PVR_MIPBIAS_0_25
Definition pvr.h:91
@ PVR_MIPBIAS_3_75
Definition pvr.h:105
@ PVR_MIPBIAS_2_25
Definition pvr.h:99
@ PVR_MIPBIAS_1_25
Definition pvr.h:95
@ PVR_MIPBIAS_NORMAL
Definition pvr.h:106
@ PVR_MIPBIAS_2_75
Definition pvr.h:101
@ PVR_MIPBIAS_1_75
Definition pvr.h:97
@ PVR_MIPBIAS_3_00
Definition pvr.h:102
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_scene_begin_rtt(pvr_ptr_t txr, uint32_t render_w, uint32_t render_h, uint32_t stride_px)
Begin collecting scene data for rendering into a texture target with an explicit render size.
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:315
static const uint32_t PVR_TXRFMT_NOSTRIDE
Definition pvr.h:319
static const uint32_t PVR_TXRFMT_STRIDE
Definition pvr.h:320
#define PVR_TXRFMT_X32_STRIDE
Stride is multiple of 32.
Definition pvr.h:316
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:145
@ PVR_UVCLAMP_UV
Clamp U and V.
Definition pvr.h:149
@ PVR_UVCLAMP_NONE
Disable clamping.
Definition pvr.h:146
@ PVR_UVCLAMP_U
Clamp U only.
Definition pvr.h:148
@ PVR_UVCLAMP_V
Clamp V only.
Definition pvr.h:147
pvr_uv_flip_t
Definition pvr.h:127
@ PVR_UVFLIP_NONE
No flipped coordinates.
Definition pvr.h:128
@ PVR_UVFLIP_UV
Flip U and V.
Definition pvr.h:131
@ PVR_UVFLIP_V
Flip V only.
Definition pvr.h:129
@ PVR_UVFLIP_U
Flip U only.
Definition pvr.h:130
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:663
int fsaa_enabled
Enable horizontal scaling?
Definition pvr.h:687
int vbuf_doublebuf_disabled
Disable vertex buffer double-buffering.
Definition pvr.h:713
int dma_enabled
Enable vertex DMA?
Definition pvr.h:680
int vertex_buf_size
Vertex buffer size (should be a nice round number)
Definition pvr.h:672
int autosort_disabled
Disable translucent polygon autosort?
Definition pvr.h:695
int opb_overflow_count
OPB Overflow Count.
Definition pvr.h:706
PVR vertex type: Modifier volume.
Definition pvr.h:549
uint32_t d1
Dummy value.
Definition pvr.h:561
uint32_t d4
Dummy value.
Definition pvr.h:564
float by
Second Y coordinate.
Definition pvr.h:556
float ay
First Y coordinate.
Definition pvr.h:553
float ax
First X coordinate.
Definition pvr.h:552
uint32_t d3
Dummy value.
Definition pvr.h:563
float cz
Third Z coordinate.
Definition pvr.h:560
float bz
Second Z coordinate.
Definition pvr.h:557
float cy
Third Y coordinate.
Definition pvr.h:559
uint32_t d6
Dummy value.
Definition pvr.h:566
uint32_t d2
Dummy value.
Definition pvr.h:562
uint32_t d5
Dummy value.
Definition pvr.h:565
float bx
Second X coordinate.
Definition pvr.h:555
float az
First Z coordinate.
Definition pvr.h:554
float cx
Third X coordinate.
Definition pvr.h:558
PVR polygon context.
Definition pvr.h:170
pvr_list_t list_type
Primitive list.
Definition pvr.h:171
bool specular
Enable offset color outside modifier.
Definition pvr.h:180
pvr_blend_mode_t src
Source blending mode outside modifier.
Definition pvr.h:186
pvr_uv_clamp_t uv_clamp
Enable/disable U/V clamping.
Definition pvr.h:210
pvr_cull_mode_t culling
Culling mode.
Definition pvr.h:176
bool mipmap
Enable/disable mipmaps.
Definition pvr.h:207
pvr_fog_type_t fog_type2
Fog type inside modifier.
Definition pvr.h:182
bool modifier_mode
True normal; false: cheap shadow.
Definition pvr.h:179
bool alpha2
Enable alpha inside modifier.
Definition pvr.h:181
pvr_uv_flip_t uv_flip
Enable/disable U/V flipping.
Definition pvr.h:209
bool color_clamp
Enable color clamping outside modifer.
Definition pvr.h:177
pvr_filter_mode_t filter
Filtering mode.
Definition pvr.h:206
bool write
Enable depth writes.
Definition pvr.h:202
pvr_ptr_t base
Texture pointer.
Definition pvr.h:217
pvr_blend_mode_t src2
Source blending mode inside modifier.
Definition pvr.h:190
struct pvr_poly_cxt_t::@51 txr2
Texturing params inside modifier.
bool enable
Enable/disable texturing.
Definition pvr.h:205
bool shading
Enable gourad shading.
Definition pvr.h:174
pvr_mip_bias_t mipmap_bias
Mipmap bias.
Definition pvr.h:208
int width
Texture width (requires a power of 2)
Definition pvr.h:213
pvr_blend_mode_t dst
Dest blending mode outside modifier.
Definition pvr.h:187
bool color_clamp2
Enable color clamping inside modifer.
Definition pvr.h:183
int height
Texture height (requires a power of 2)
Definition pvr.h:214
bool uv
True: 16-bit floating-point U/Vs; False: 32-bit.
Definition pvr.h:197
pvr_depthcmp_mode_t comparison
Depth comparison mode.
Definition pvr.h:201
bool src_enable2
Source blending mode inside modifier.
Definition pvr.h:192
pvr_blend_mode_t dst2
Dest blending mode inside modifier.
Definition pvr.h:191
bool modifier
Enable modifier effects.
Definition pvr.h:198
bool src_enable
Source blending enable outside modifier.
Definition pvr.h:188
pvr_color_fmts_t color
Color format in vertex.
Definition pvr.h:196
pvr_txr_shading_mode_t env
Texture color contribution.
Definition pvr.h:212
pvr_fog_type_t fog_type
Fog type outside modifier.
Definition pvr.h:175
bool alpha
Enable alpha outside modifier.
Definition pvr.h:173
pvr_clip_mode_t clip_mode
Clipping mode.
Definition pvr.h:178
bool dst_enable2
Dest blending mode inside modifier.
Definition pvr.h:193
bool dst_enable
Dest blending enable outside modifier.
Definition pvr.h:189
int format
Texture format.
Definition pvr.h:215
PVR polygon header.
Definition pvr_header.h:312
PVR vertex type: Untextured sprite.
Definition pvr.h:524
float bz
Second Z coordinate.
Definition pvr.h:532
float ay
First Y coordinate.
Definition pvr.h:528
uint32_t d3
Dummy value.
Definition pvr.h:540
float cz
Third Z coordinate.
Definition pvr.h:535
float bx
Second X coordinate.
Definition pvr.h:530
uint32_t d1
Dummy value.
Definition pvr.h:538
float cy
Third Y coordinate.
Definition pvr.h:534
float ax
First X coordinate.
Definition pvr.h:527
float by
Second Y coordinate.
Definition pvr.h:531
uint32_t d4
Dummy value.
Definition pvr.h:541
float dy
Fourth Y coordinate.
Definition pvr.h:537
uint32_t d2
Dummy value.
Definition pvr.h:539
float cx
Third X coordinate.
Definition pvr.h:533
float az
First Z coordinate.
Definition pvr.h:529
float dx
Fourth X coordinate.
Definition pvr.h:536
PVR sprite context.
Definition pvr.h:235
bool alpha
Enable alpha.
Definition pvr.h:238
bool mipmap
Enable/disable mipmaps.
Definition pvr.h:258
bool enable
Enable/disable texturing.
Definition pvr.h:256
pvr_mip_bias_t mipmap_bias
Mipmap bias.
Definition pvr.h:259
bool src_enable
Source blending enable.
Definition pvr.h:248
pvr_uv_clamp_t uv_clamp
Enable/disable U/V clamping.
Definition pvr.h:261
pvr_blend_mode_t dst
Dest blending mode.
Definition pvr.h:247
pvr_fog_type_t fog_type
Fog type.
Definition pvr.h:239
bool write
Enable depth writes.
Definition pvr.h:253
pvr_uv_flip_t uv_flip
Enable/disable U/V flipping.
Definition pvr.h:260
bool specular
Enable offset color.
Definition pvr.h:243
bool color_clamp
Enable color clamp.
Definition pvr.h:241
pvr_list_t list_type
Primitive list.
Definition pvr.h:236
pvr_clip_mode_t clip_mode
Clipping mode.
Definition pvr.h:242
int width
Texture width (requires a power of 2)
Definition pvr.h:264
pvr_txr_shading_mode_t env
Texture color contribution.
Definition pvr.h:263
pvr_ptr_t base
Texture pointer.
Definition pvr.h:268
pvr_blend_mode_t src
Source blending mode.
Definition pvr.h:246
pvr_filter_mode_t filter
Filtering mode.
Definition pvr.h:257
pvr_cull_mode_t culling
Culling mode.
Definition pvr.h:240
pvr_depthcmp_mode_t comparison
Depth comparison mode.
Definition pvr.h:252
int height
Texture height (requires a power of 2)
Definition pvr.h:265
bool dst_enable
Dest blending enable.
Definition pvr.h:249
int format
Texture format.
Definition pvr.h:266
PVR vertex type: Textured sprite.
Definition pvr.h:499
float bz
Second Z coordinate.
Definition pvr.h:507
float dx
Fourth X coordinate.
Definition pvr.h:511
float az
First Z coordinate.
Definition pvr.h:504
float ax
First X coordinate.
Definition pvr.h:502
uint32_t buv
Second U/V texture coordinates.
Definition pvr.h:515
float cz
Third Z coordinate.
Definition pvr.h:510
uint32_t dummy
Dummy value.
Definition pvr.h:513
float by
Second Y coordinate.
Definition pvr.h:506
uint32_t auv
First U/V texture coordinates.
Definition pvr.h:514
float dy
Fourth Y coordinate.
Definition pvr.h:512
float cx
Third X coordinate.
Definition pvr.h:508
uint32_t cuv
Third U/V texture coordinates.
Definition pvr.h:516
float bx
Second X coordinate.
Definition pvr.h:505
float cy
Third Y coordinate.
Definition pvr.h:509
float ay
First Y coordinate.
Definition pvr.h:503
PVR vertex type: Non-textured, packed color, affected by modifier volume.
Definition pvr.h:447
float z
Z coordinate.
Definition pvr.h:452
uint32_t d1
Dummy value.
Definition pvr.h:455
uint32_t argb0
Vertex color (outside volume)
Definition pvr.h:453
float x
X coordinate.
Definition pvr.h:450
float y
Y coordinate.
Definition pvr.h:451
uint32_t d2
Dummy value.
Definition pvr.h:456
uint32_t argb1
Vertex color (inside volume)
Definition pvr.h:454
Generic PVR vertex type.
Definition pvr.h:419
float z
Z coordinate.
Definition pvr.h:424
float y
Y coordinate.
Definition pvr.h:423
float u
Texture U coordinate.
Definition pvr.h:427
uint32_t oargb
Vertex offset color.
Definition pvr.h:436
uint32_t argb1
Vertex color when modified, inside area.
Definition pvr.h:432
float x
X coordinate.
Definition pvr.h:422
float v
Texture V coordinate.
Definition pvr.h:428
uint32_t argb
Vertex color.
Definition pvr.h:435
uint32_t argb0
Vertex color when modified, outside area.
Definition pvr.h:431
PVR vertex type: Textured, packed color, affected by modifier volume.
Definition pvr.h:467
float z
Z coordinate.
Definition pvr.h:472
uint32_t oargb1
Vertex offset color (inside)
Definition pvr.h:480
uint32_t oargb0
Vertex offset color (outside)
Definition pvr.h:476
float x
X coordinate.
Definition pvr.h:470
float u0
Texture U coordinate (outside)
Definition pvr.h:473
uint32_t d2
Dummy value.
Definition pvr.h:482
float v0
Texture V coordinate (outside)
Definition pvr.h:474
uint32_t d4
Dummy value.
Definition pvr.h:484
float u1
Texture U coordinate (inside)
Definition pvr.h:477
float y
Y coordinate.
Definition pvr.h:471
float v1
Texture V coordinate (inside)
Definition pvr.h:478
uint32_t argb0
Vertex color (outside)
Definition pvr.h:475
uint32_t argb1
Vertex color (inside)
Definition pvr.h:479
uint32_t d1
Dummy value.
Definition pvr.h:481
uint32_t d3
Dummy value.
Definition pvr.h:483