8#ifndef __LIBDRAGON_RDP_H
9#define __LIBDRAGON_RDP_H
26#define DP_START ((volatile uint32_t*)0xA4100000)
29#define DP_END ((volatile uint32_t*)0xA4100004)
32#define DP_CURRENT ((volatile uint32_t*)0xA4100008)
35#define DP_STATUS ((volatile uint32_t*)0xA410000C)
38#define DP_CLOCK ((volatile uint32_t*)0xA4100010)
41#define DP_BUSY ((volatile uint32_t*)0xA4100014)
44#define DP_PIPE_BUSY ((volatile uint32_t*)0xA4100018)
47#define DP_TMEM_BUSY ((volatile uint32_t*)0xA410001C)
50#define DP_STATUS_DMEM_DMA (1 << 0)
52#define DP_STATUS_FREEZE (1 << 1)
54#define DP_STATUS_FLUSH (1 << 2)
56#define DP_STATUS_GCLK_ALIVE (1 << 3)
58#define DP_STATUS_TMEM_BUSY (1 << 4)
60#define DP_STATUS_PIPE_BUSY (1 << 5)
62#define DP_STATUS_BUSY (1 << 6)
64#define DP_STATUS_BUFFER_READY (1 << 7)
66#define DP_STATUS_DMA_BUSY (1 << 8)
68#define DP_STATUS_END_VALID (1 << 9)
70#define DP_STATUS_START_VALID (1 << 10)
72#define DP_WSTATUS_RESET_XBUS_DMEM_DMA (1<<0)
73#define DP_WSTATUS_SET_XBUS_DMEM_DMA (1<<1)
74#define DP_WSTATUS_RESET_FREEZE (1<<2)
75#define DP_WSTATUS_SET_FREEZE (1<<3)
76#define DP_WSTATUS_RESET_FLUSH (1<<4)
77#define DP_WSTATUS_SET_FLUSH (1<<5)
78#define DP_WSTATUS_RESET_TMEM_COUNTER (1<<6)
79#define DP_WSTATUS_RESET_PIPE_COUNTER (1<<7)
80#define DP_WSTATUS_RESET_CMD_COUNTER (1<<8)
81#define DP_WSTATUS_RESET_CLOCK_COUNTER (1<<9)
337__attribute__((deprecated(
"use rdpq_init instead")))
338void rdp_init(
void );
340__attribute__((deprecated("use
rdpq_close instead")))
341void rdp_close(
void );
343__attribute__((deprecated("use
rdpq_attach instead")))
344static inline
void rdp_attach(
surface_t *surface )
349__attribute__((deprecated(
"use rdpq_detach_cb instead")))
350static inline
void rdp_detach_async(
void (*cb)(
void*),
void *arg )
355__attribute__((deprecated(
"use rdpq_detach_wait instead")))
356void rdp_detach(
void );
359static inline
bool rdp_is_attached(
void )
364__attribute__((deprecated(
"use rdpq_detach_show instead")))
365static inline
void rdp_detach_show(
surface_t *disp )
370__attribute__((deprecated(
"use rdpq_attach instead")))
376__attribute__((deprecated(
"use rdqp_detach_wait instead")))
377static inline
void rdp_detach_display(
void )
382__attribute__((deprecated(
"use rdpq_set_scissor instead")))
383void rdp_set_clipping( uint32_t tx, uint32_t ty, uint32_t bx, uint32_t by );
385__attribute__((deprecated("default clipping is activated automatically during rdp_attach_display")))
386void rdp_set_default_clipping(
void );
388__attribute__((deprecated("syncs are now performed automatically -- or use rdpq_sync_* functions otherwise")))
389void rdp_sync( sync_t sync );
392void rdp_draw_filled_rectangle(
int tx,
int ty,
int bx,
int by );
395static inline
void rdp_set_primitive_color(uint32_t color) {
400__attribute__((deprecated(
"use rdpq_set_mode_fill instead")))
401void rdp_enable_primitive_fill(
void );
404void rdp_enable_texture_copy(
void );
void display_show(surface_t *surf)
Display a buffer on the screen.
Definition display.c:342
void rdp_draw_textured_rectangle_scaled(uint32_t texslot, int tx, int ty, int bx, int by, double x_scale, double y_scale, mirror_t mirror)
Draw a textured rectangle with a scaled texture.
Definition rdp.c:230
void rdp_set_texture_flush(flush_t flush)
Set the flush strategy for texture loads.
Definition rdp.c:290
uint32_t rdp_load_texture(uint32_t texslot, uint32_t texloc, mirror_t mirror, sprite_t *sprite)
Load a sprite into RDP TMEM.
Definition rdp.c:199
void rdp_draw_sprite_scaled(uint32_t texslot, int x, int y, double x_scale, double y_scale, mirror_t mirror)
Draw a texture to the screen as a scaled sprite.
Definition rdp.c:267
mirror_t
Mirror settings for textures.
Definition rdp.h:87
void rdp_draw_textured_rectangle(uint32_t texslot, int tx, int ty, int bx, int by, mirror_t mirror)
Draw a textured rectangle.
Definition rdp.c:255
void rdp_draw_sprite(uint32_t texslot, int x, int y, mirror_t mirror)
Draw a texture to the screen as a sprite.
Definition rdp.c:261
uint32_t rdp_load_texture_stride(uint32_t texslot, uint32_t texloc, mirror_t mirror, sprite_t *sprite, int offset)
Load part of a sprite into RDP TMEM.
Definition rdp.c:210
void rdp_draw_filled_triangle(float x1, float y1, float x2, float y2, float x3, float y3)
Draw a filled triangle.
Definition rdp.c:282
flush_t
Caching strategy for loaded textures.
Definition rdp.h:102
void rdp_set_blend_color(uint32_t color)
Set the blend draw color for subsequent filled primitive operations.
Definition rdp.c:277
@ MIRROR_X
Enable texture mirroring on x axis.
Definition rdp.h:91
@ MIRROR_Y
Enable texture mirroring on y axis.
Definition rdp.h:93
@ MIRROR_XY
Enable texture mirroring on both x & y axis.
Definition rdp.h:95
@ MIRROR_DISABLED
Disable texture mirroring.
Definition rdp.h:89
@ FLUSH_STRATEGY_AUTOMATIC
Cache will be flushed on all incoming textures.
Definition rdp.h:106
@ FLUSH_STRATEGY_NONE
Textures are assumed to be pre-flushed.
Definition rdp.h:104
void rdp_enable_blend_fill(void)
Enable display of 2D filled (untextured) triangles, with possible alpha blending.
void rdpq_set_fill_color(color_t color)
Enqueue a SET_FILL_COLOR RDP command.
Definition rdpq.h:838
void rdpq_close()
Shutdown the RDPQ library.
Definition rdpq.c:488
void __rdpq_write8_syncchange(uint32_t cmd_id, uint32_t arg0, uint32_t arg1, uint32_t autosync)
Write a standard 8-byte RDP command, which changes some autosync resources
Definition rdpq.c:912
void rdpq_detach_cb(void(*cb)(void *), void *arg)
Detach the RDP from the current surface, and call a callback when the RDP has finished drawing to it.
Definition rdpq_attach.c:124
void rdpq_attach(const surface_t *surf_color, const surface_t *surf_z)
Attach the RDP to a color surface (and optionally a Z buffer)
Definition rdpq_attach.c:77
void rdpq_detach(void)
Detach the RDP from the current surface, and restore the previous one.
Definition rdpq_attach.h:138
bool rdpq_is_attached(void)
Check if the RDP is currently attached to a surface.
Definition rdpq_attach.c:23
RDP Command queue: surface attachment API.
void rdpq_set_mode_copy(bool transparency)
Reset render mode to COPY type.
Definition rdpq_mode.c:88
#define rdpq_fill_rectangle(x0, y0, x1, y1)
Draw a filled rectangle (RDP command: FILL_RECTANGLE)
Definition rdpq_rect.h:250
Sprite structure.
Definition sprite.h:42
A surface buffer for graphics.
Definition surface.h:140