gt.c
3.19 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*
* Copyright 1995, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
*
* UNPUBLISHED -- Rights reserved under the copyright laws of the United
* States. Use of a copyright notice is precautionary only and does not
* imply publication or disclosure.
*
* U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
* in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
* in similar or successor clauses in the FAR, or the DOD or NASA FAR
* Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
* 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
*
* THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
* INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
* DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
* PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
* GRAPHICS, INC.
*
*/
/*
* File: gt.c
* Creator: hsa@sgi.com
* Create Date: Fri Oct 13 14:23:48 PDT 1995
*
*/
#include "gtint.h"
/*
* Set the cached RDP othermode word in the gt state structure.
*/
void
gtStateSetOthermode(Gfx *om, gtStateOthermode_t mode, int data)
{
int shift, length;
u32 mask;
if (mode == GT_CLEAR) { /* special case */
om->words.w0 = (G_RDPSETOTHERMODE << 24);
om->words.w1 = 0x0;
}
if (mode <= GT_RENDERMODE) {
/* these are OTHERMODE_L */
switch (mode) {
case GT_ALPHACOMPARE:
shift = G_MDSFT_ALPHACOMPARE;
length = 2;
break;
case GT_ZSRCSEL:
shift = G_MDSFT_ZSRCSEL;
length = 1;
break;
case GT_RENDERMODE:
shift = G_MDSFT_RENDERMODE;
length = 29;
break;
default:
break;
}
mask = (0x01 << length);
mask = mask - 1;
mask = (mask << shift);
mask = mask ^ 0xffffffff;
om->words.w1 &= mask;
om->words.w1 |= data;
} else {
/* these are OTHERMODE_H */
switch (mode) {
case GT_ALPHADITHER:
shift = G_MDSFT_ALPHADITHER;
length = 2;
break;
case GT_RGBDITHER:
shift = G_MDSFT_RGBDITHER;
length = 2;
break;
case GT_COMBKEY:
shift = G_MDSFT_COMBKEY;
length = 1;
break;
case GT_TEXTCONV:
shift = G_MDSFT_TEXTCONV;
length = 3;
break;
case GT_TEXTFILT:
shift = G_MDSFT_TEXTFILT;
length = 2;
break;
case GT_TEXTLUT:
shift = G_MDSFT_TEXTLUT;
length = 2;
break;
case GT_TEXTLOD:
shift = G_MDSFT_TEXTLOD;
length = 1;
break;
case GT_TEXTDETAIL:
shift = G_MDSFT_TEXTDETAIL;
length = 2;
break;
case GT_TEXTPERSP:
shift = G_MDSFT_TEXTPERSP;
length = 1;
break;
case GT_CYCLETYPE:
shift = G_MDSFT_CYCLETYPE;
length = 2;
break;
case GT_PIPELINE:
shift = G_MDSFT_PIPELINE;
length = 1;
break;
default:
break;
}
mask = (0x01 << length);
mask = mask - 1;
mask = (mask << shift);
mask = mask ^ 0xffffffff;
om->words.w0 &= mask;
om->words.w0 |= data;
}
/* force cached othermode word to have proper command id: */
om->words.w0 &= 0x00ffffff;
om->words.w0 |= (G_RDPSETOTHERMODE << 24);
}