init.c
3.97 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/**************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
*************************************************************************/
#include <ultra64.h>
#include "tron.h"
/*
* Remember, viewport structures have 2 bits of fraction in them.
*/
static Vp vp = {
SCREEN_WD*2, SCREEN_HT*2, G_MAXZ/2, 0, /* scale */
SCREEN_WD*2, SCREEN_HT*2, G_MAXZ/2, 0, /* translate */
};
Gfx setup_rdpstate[MAX_STATIC_GFX_SIZE] = {
/*
* Image pointers are translated via RSP segment registers.
* Preset segment register 0 with 0.
*/
gsSPSegment(0, 0),
/*
* This RDP initialization sequence will setup the following modes
*
* 1 cycle mode, point sampled, zbuffer, smooth shaded opaque polygons
*/
gsDPPipeSync(),
/*
* scissor must be larger than background clear rectangle
*/
/* dp */ gsDPSetScissor(G_SC_NON_INTERLACE, 0, 0, SCREEN_WD,
SCREEN_HT),
/* dp */ gsDPSetCycleType(G_CYC_1CYCLE),
/* dp */ gsDPPipelineMode(G_PM_1PRIMITIVE),
/*
* Set texture image pointer to z so no undefines during ASIC
* verification
*/
/* tx */ gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WD, OS_K0_TO_PHYSICAL(zbuffer)),
/* tx */ gsDPSetTextureLOD(G_TL_TILE),
/* tx */ gsDPSetTextureLUT(G_TT_NONE),
/* tx */ gsDPSetTextureDetail(G_TD_CLAMP),
/* tx */ gsDPSetTexturePersp(G_TP_NONE),
/* tx */ gsDPSetTileSize(0, 0, 0, 0, 0), /* needed for verilog simulation */
/* tx */ gsDPSetTileSize(1, 0, 0, 0, 0), /* needed for verilog simulation */
/* tx */ gsDPSetTile(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), /* needed for verilog simulation */
/* tx */ gsDPSetTile(0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), /* needed for verilog simulation */
/* tf */ gsDPSetTextureFilter(G_TF_BILERP),
/* tf */ gsDPSetTextureConvert(G_TC_FILT),
/* cc */ gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
/* cc */ gsDPSetCombineKey(G_CK_NONE),
/* bl */ gsDPSetAlphaCompare(G_AC_NONE),
/* bl */ gsDPSetDepthSource(G_ZS_PIXEL),
/* bl */ gsDPSetRenderMode(G_RM_OPA_SURF, G_RM_OPA_SURF2),
/* bl */ gsDPSetBlendMask(0xff),
/* mi */ gsDPSetColorDither(G_CD_DISABLE),
/* mi */ gsDPSetDepthImage(OS_K0_TO_PHYSICAL(zbuffer)),
gsSPEndDisplayList(),
};
Gfx setup_rspstate[MAX_STATIC_GFX_SIZE] = {
/* XXX Initialize the matrix stack after we change host init DMEM */
gsSPViewport(&vp),
gsSPClearGeometryMode(0xffffffff),
gsSPEndDisplayList(),
};
Gfx clear_fb[MAX_STATIC_GFX_SIZE] = {
gsDPPipeSync(),
gsDPSetCycleType(G_CYC_FILL),
/*
* clear color, cvg = FULL or 1
*/
gsDPSetFillColor(GPACK_RGBA5551(44,44,44,1) << 16 | GPACK_RGBA5551(44,44,44,1)),
#ifdef REALCLEAR
gsDPFillRectangle(0, 0, SCREEN_WD-1, SCREEN_HT-1),
gsDPNoOp(),
#else
gsDPSetColorImage(5, G_IM_SIZ_16b, SCREEN_WD, OS_K0_TO_PHYSICAL(cfb_16_a)),
gsDPSetColorImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WD, OS_K0_TO_PHYSICAL(cfb_16_a)),
#endif
/*
* clear z, z = max z, dz = 0
*/
gsDPPipeSync(),
gsDPSetColorImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WD, OS_K0_TO_PHYSICAL(zbuffer)),
gsDPSetFillColor(GPACK_ZDZ(G_MAXFBZ, 0) << 16 | GPACK_ZDZ(G_MAXFBZ, 0)),
#ifdef REALCLEAR
gsDPFillRectangle(0, 0, SCREEN_WD-1, SCREEN_HT-1),
gsDPNoOp(),
#else
gsDPSetColorImage(5, G_IM_SIZ_16b, SCREEN_WD, zbuffer),
gsDPSetColorImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WD, OS_K0_TO_PHYSICAL(zbuffer)),
#endif
gsDPPipeSync(),
gsDPSetCycleType(G_CYC_1CYCLE),
gsSPEndDisplayList(),
};