aboutsummaryrefslogtreecommitdiffstats
path: root/WinQuake/pum_render.h
blob: 4af28b8f105f534eaee06568591e306c11016b4d (plain) (blame)
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
56
57
58
59
60
61
62
63
64
65
66
/*
Process-using-Memory (PuM) rendering pipeline for Quake
*/

#ifndef PUM_RENDER_H
#define PUM_RENDER_H

#ifdef RENDER_PUM

// 8192 bytes per row
// 64 bit data bus (x8 devices, 8 chips)
// 64 bytes per column, 128 columns per row

#define PUM_ROW_BYTES       8192
#define PUM_TILE_BYTES      64 // one column access = one cache line
#define PUM_TILES_PER_ROW   (PUM_ROW_BYTES / PUM_TILE_BYTES)

// DRAM organisation of HMA81GU6AFR8N-UH
#define PUM_NUM_BANKS       16
#define PUM_NUM_ROWS        32768

typedef enum {
    PUM_OP_AND = 0,
    PUM_OP_OR,
    PUM_OP_XOR,
    PUM_OP_NOT
} pum_op_t;

// Init platform, prepare rows (C0, C1, T0 ... T3)
int  PUM_Init (void);

// Release platform, precharge all banks
void PUM_Shutdown (void);

// bitwise operations
// Transparent fallbacks included
void PUM_BitwiseAnd (const byte *a, const byte *b, byte *dst, int num_bytes);
void PUM_BitwiseOr  (const byte *a, const byte *b, byte *dst, int num_bytes);
void PUM_BitwiseXor (const byte *a, const byte *b, byte *dst, int num_bytes);
void PUM_BitwiseNot (const byte *a, byte *dst, int num_bytes);

// shading on 8.8 fp mask/select
// tiles of packed 32-bit pixels
void PUM_LightMaskAndTexel (byte *dst, const byte *src, const byte *mask,
                            int num_bytes);
void PUM_EdgeSpanInit (byte *dst, const byte *clear, int num_bytes);

// Whether PUM engine is active
int  PUM_Active (void);

#endif /* RENDER_PUM */

// stub functions
#ifndef RENDER_PUM
#define PUM_Init()             (0)
#define PUM_Shutdown()         do {} while (0)
#define PUM_Active()           (0)
#define PUM_BitwiseAnd(a,b,d,n)  do {} while (0)
#define PUM_BitwiseOr(a,b,d,n)   do {} while (0)
#define PUM_BitwiseXor(a,b,d,n)  do {} while (0)
#define PUM_BitwiseNot(a,d,n)    do {} while (0)
#define PUM_LightMaskAndTexel(a,b,c,n) do {} while (0)
#define PUM_EdgeSpanInit(a,b,n)       do {} while (0)
#endif

#endif /* PUM_RENDER_H */