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
|
/* $XFree86$ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
Cedar Park, Texas.
All Rights Reserved.
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
on the rights to use, copy, modify, merge, publish, distribute, sub
license, 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 (including the next
paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS 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.
**************************************************************************/
/*
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
*
*/
#ifndef _R128_VB_H_
#define _R128_VB_H_
#ifdef GLX_DIRECT_RENDERING
#define USE_RHW2 0
/* FIXME: This is endian-specific */
typedef struct {
GLubyte b;
GLubyte g;
GLubyte r;
GLubyte a;
} r128Color;
typedef struct {
GLfloat x, y, z; /* Coordinates in screen space */
GLfloat rhw; /* Reciprocal homogeneous w */
r128Color dif_argb; /* Diffuse color */
r128Color spec_frgb; /* Specular color (alpha is fog) */
GLfloat tu0, tv0; /* Texture 0 coordinates */
GLfloat tu1, tv1; /* Texture 1 coordinates */
#if USE_RHW2
GLfloat rhw2; /* Reciprocal homogeneous w */
#endif
} r128_vertex;
#if USE_RHW2
/* Format of vertices in r128_vertex struct */
#define R128_FULL_VERTEX_FORMAT \
R128_CCE_VC_FRMT_RHW | \
R128_CCE_VC_FRMT_DIFFUSE_ARGB | \
R128_CCE_VC_FRMT_SPEC_FRGB | \
R128_CCE_VC_FRMT_S_T | \
R128_CCE_VC_FRMT_S2_T2 | \
R128_CCE_VC_FRMT_RHW2
/* Send a single vertex to the ring buffer */
#define R128CCE_SEND_VERTEX(v) \
do { \
R128CCEF((v)->x); \
R128CCEF((v)->y); \
R128CCEF((v)->z); \
R128CCEF((v)->rhw); \
R128CCE(*(int *)&(v)->dif_argb); \
R128CCE(*(int *)&(v)->spec_frgb); \
R128CCEF((v)->tu0); \
R128CCEF((v)->tv0); \
R128CCEF((v)->tu1); \
R128CCEF((v)->tv1); \
R128CCEF((v)->rhw2); \
} while (0)
#else /* !USE_RHW2 */
/* Format of vertices in r128_vertex struct */
#define R128_FULL_VERTEX_FORMAT \
R128_CCE_VC_FRMT_RHW | \
R128_CCE_VC_FRMT_DIFFUSE_ARGB | \
R128_CCE_VC_FRMT_SPEC_FRGB | \
R128_CCE_VC_FRMT_S_T | \
R128_CCE_VC_FRMT_S2_T2
/* Send a single vertex to the ring buffer */
#define R128CCE_SEND_VERTEX(v) \
do { \
R128CCEF((v)->x); \
R128CCEF((v)->y); \
R128CCEF((v)->z); \
R128CCEF((v)->rhw); \
R128CCE(*(int *)&(v)->dif_argb); \
R128CCE(*(int *)&(v)->spec_frgb); \
R128CCEF((v)->tu0); \
R128CCEF((v)->tv0); \
R128CCEF((v)->tu1); \
R128CCEF((v)->tv1); \
} while (0)
#endif
/* FIXME: We currently only have assembly for 16-stride vertices */
typedef union {
r128_vertex v;
float f[16];
} r128Vertex, *r128VertexPtr;
/* Vertex buffer for use when on the fast path */
typedef struct {
GLuint size; /* Number of vertices in store */
void *vert_store; /* Storage for vertex buffer */
r128VertexPtr verts; /* Aligned start of verts in storage */
int last_vert; /* Index of last vertex used */
GLvector1ui clipped_elements; /* List of clipped elements */
} *r128VertexBufferPtr;
#define R128_DRIVER_DATA(vb) ((r128VertexBufferPtr)((vb)->driver_data))
#define R128_SPEC_BIT 0x01
#define R128_FOG_BIT 0x02
#define R128_ALPHA_BIT 0x04 /* GL_BLEND, not used */
#define R128_TEX1_BIT 0x08
#define R128_TEX0_BIT 0x10
#define R128_RGBA_BIT 0x20
#define R128_WIN_BIT 0x40
extern void r128SetupInit(void);
extern void r128ChooseRasterSetupFunc(GLcontext *ctx);
extern void r128CheckPartialRasterSetup(GLcontext *ctx,
struct gl_pipeline_stage *s);
extern void r128PartialRasterSetup(struct vertex_buffer *VB);
extern void r128DoRasterSetup(struct vertex_buffer *VB);
extern void r128ResizeVB(struct vertex_buffer *VB, GLuint size);
extern void r128DDRegisterVB(struct vertex_buffer *VB);
extern void r128DDUnregisterVB(struct vertex_buffer *VB);
#endif
#endif /* _R128_VB_H_ */
|