/
double_buffer.h
55 lines (44 loc) · 1010 Bytes
/
double_buffer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef _DOUBLE_BUFFER_H
#define _DOUBLE_BUFFER_H
#include <sys/types.h>
#include <psxgpu.h>
#ifndef OT_LEN
#define OT_LEN 1024
#endif
#ifndef PACKET_LEN
#define PACKET_LEN 32768
#endif
#ifndef SCREEN_XRES
#define SCREEN_XRES 320
#endif
#ifndef SCREEN_YRES
#define SCREEN_YRES 240
#endif
/* Double buffer structure */
typedef struct
{
DISPENV display_environment; // Display environment
DRAWENV draw_environment; // Drawing environment
u_long ordering_table[OT_LEN]; // Ordering table
char packet_buffer[PACKET_LEN]; // Packet buffer
} DoubleBuffer;
/* Double buffer variables */
static DoubleBuffer double_buffer[2];
static int active_buffer = 0;
static char *packet_address; /* Next packet pointer for primitive generation */
/**
* @brief init double buffer setup
*
*/
void init_double_buffer();
/**
* @brief swap pointers for active frame
*
*/
void swap_buffers();
/**
* @brief put active draw and display
*
*/
void put_buffers();
#endif // _DOUBLE_BUFFER_H