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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
/*
* GLX Hardware Device Driver for Intel i810
* Copyright (C) 1999 Keith Whitwell
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*
*/
/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810tris.h,v 1.8 2000/12/04 19:21:43 dawes Exp $ */
#ifndef I810TRIS_INC
#define I810TRIS_INC
#include "types.h"
#include "i810ioctl.h"
#include "i810vb.h"
extern void i810PrintRenderState( const char *msg, GLuint state );
extern void i810DDChooseRenderState(GLcontext *ctx);
extern void i810DDTrifuncInit( void );
#define I810_FLAT_BIT 0x1
#define I810_OFFSET_BIT 0x2
#define I810_TWOSIDE_BIT 0x4
#define I810_FALLBACK_BIT 0x8
static void __inline__ i810_draw_triangle( i810ContextPtr imesa,
i810VertexPtr v0,
i810VertexPtr v1,
i810VertexPtr v2 )
{
GLuint vertsize = imesa->vertsize;
GLuint *vb = i810AllocDwordsInline( imesa, 3 * vertsize );
int j;
#if defined(USE_X86_ASM)
__asm__ __volatile__( "rep ; movsl"
: "=%c" (j)
: "0" (vertsize), "D" ((long)vb), "S" ((long)v0)
: "memory" );
__asm__ __volatile__( "rep ; movsl"
: "=%c" (j)
: "0" (vertsize), "S" ((long)v1)
: "memory" );
__asm__ __volatile__( "rep ; movsl"
: "=%c" (j)
: "0" (vertsize), "S" ((long)v2)
: "memory" );
#else
for (j = 0 ; j < vertsize ; j++)
vb[j] = v0->ui[j];
vb += vertsize;
for (j = 0 ; j < vertsize ; j++)
vb[j] = v1->ui[j];
vb += vertsize;
for (j = 0 ; j < vertsize ; j++)
vb[j] = v2->ui[j];
#endif
}
static __inline__ void i810_draw_point( i810ContextPtr imesa,
i810VertexPtr tmp,
float sz )
{
int vertsize = imesa->vertsize;
GLuint *vb = i810AllocDwordsInline( imesa, 6 * vertsize );
const GLfloat x = tmp->v.x + 0.125;
const GLfloat y = tmp->v.y - 0.5F;
int j;
*(float *)&vb[0] = x - sz;
*(float *)&vb[1] = y - sz;
for (j = 2 ; j < vertsize ; j++)
vb[j] = tmp->ui[j];
vb += vertsize;
*(float *)&vb[0] = x + sz;
*(float *)&vb[1] = y - sz;
for (j = 2 ; j < vertsize ; j++)
vb[j] = tmp->ui[j];
vb += vertsize;
*(float *)&vb[0] = x + sz;
*(float *)&vb[1] = y + sz;
for (j = 2 ; j < vertsize ; j++)
vb[j] = tmp->ui[j];
vb += vertsize;
*(float *)&vb[0] = x + sz;
*(float *)&vb[1] = y + sz;
for (j = 2 ; j < vertsize ; j++)
vb[j] = tmp->ui[j];
vb += vertsize;
*(float *)&vb[0] = x - sz;
*(float *)&vb[1] = y + sz;
for (j = 2 ; j < vertsize ; j++)
vb[j] = tmp->ui[j];
vb += vertsize;
*(float *)&vb[0] = x - sz;
*(float *)&vb[1] = y - sz;
for (j = 2 ; j < vertsize ; j++)
vb[j] = tmp->ui[j];
}
static __inline__ void i810_draw_line( i810ContextPtr imesa,
i810VertexPtr v0,
i810VertexPtr v1 )
{
GLuint vertsize = imesa->vertsize;
GLuint *vb = i810AllocDwordsInline( imesa, 2 * vertsize );
int j;
#if defined(USE_X86_ASM)
__asm__ __volatile__( "rep ; movsl"
: "=%c" (j)
: "0" (vertsize), "D" ((long)vb), "S" ((long)v0)
: "memory" );
__asm__ __volatile__( "rep ; movsl"
: "=%c" (j)
: "0" (vertsize), "S" ((long)v1)
: "memory" );
#elif 0
for (j = 0 ; j < vertsize ; j++)
vb[j] = v0->ui[j];
vb += vertsize;
for (j = 0 ; j < vertsize ; j++)
vb[j] = v1->ui[j];
#else
const GLfloat dx = -0.5;
const GLfloat dy = -0.5;
v0->v.x += dx;
v0->v.y += dy;
v1->v.x += dx;
v1->v.y += dy;
for (j = 0 ; j < vertsize ; j++)
vb[j] = v0->ui[j];
vb += vertsize;
for (j = 0 ; j < vertsize ; j++)
vb[j] = v1->ui[j];
v0->v.x -= dx;
v0->v.y -= dy;
v1->v.x -= dx;
v1->v.y -= dy;
#endif
}
#endif
|