Remove CVS keywords.
[mesa.git] / src / mesa / drivers / dri / ffb / ffb_vbtmp.h
1
2 static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end)
3 {
4 ffbContextPtr fmesa = FFB_CONTEXT(ctx);
5 #if defined(VB_DEBUG) || (IND & (FFB_VB_XYZ_BIT | FFB_VB_RGBA_BIT))
6 struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
7 #endif
8 #if (IND & (FFB_VB_RGBA_BIT))
9 GLfloat (*col0)[4];
10 GLuint col0_stride;
11 #if (IND & (FFB_VB_TWOSIDE_BIT))
12 GLfloat (*col1)[4];
13 GLuint col1_stride;
14 #endif
15 #endif
16 #if (IND & FFB_VB_XYZ_BIT)
17 GLfloat (*proj)[4] = VB->NdcPtr->data;
18 GLuint proj_stride = VB->NdcPtr->stride;
19 const GLubyte *mask = VB->ClipMask;
20 #endif
21 ffb_vertex *v = &fmesa->verts[start];
22 int i;
23
24 #ifdef VB_DEBUG
25 fprintf(stderr, "FFB: ffb_emit ["
26 #if (IND & (FFB_VB_XYZ_BIT))
27 " XYZ"
28 #endif
29 #if (IND & (FFB_VB_RGBA_BIT))
30 " RGBA"
31 #endif
32 #if (IND & (FFB_VB_TWOSIDE_BIT))
33 " TWOSIDE"
34 #endif
35 "] start(%d) end(%d) import(%d)\n",
36 start, end,
37 VB->importable_data);
38 #endif
39
40 #if (IND & (FFB_VB_RGBA_BIT))
41 col0 = VB->ColorPtr[0]->data;
42 col0_stride = VB->ColorPtr[0]->stride;
43 #if (IND & (FFB_VB_TWOSIDE_BIT))
44 col1 = VB->ColorPtr[1]->data;
45 col1_stride = VB->ColorPtr[1]->stride;
46 #endif
47 #endif
48
49 {
50 if (start) {
51 #if (IND & (FFB_VB_XYZ_BIT))
52 proj = (GLfloat (*)[4])((GLubyte *)proj + start * proj_stride);
53 #endif
54 #if (IND & (FFB_VB_RGBA_BIT))
55 col0 = (GLfloat (*)[4])((GLubyte *)col0 + start * col0_stride);
56 #if (IND & (FFB_VB_TWOSIDE_BIT))
57 col1 = (GLfloat (*)[4])((GLubyte *)col1 + start * col1_stride);
58 #endif
59 #endif
60 }
61 for (i = start; i < end; i++, v++) {
62 #if (IND & (FFB_VB_XYZ_BIT))
63 if (mask[i] == 0) {
64 v->x = proj[0][0];
65 v->y = proj[0][1];
66 v->z = proj[0][2];
67 }
68 proj = (GLfloat (*)[4])((GLubyte *)proj + proj_stride);
69 #endif
70 #if (IND & (FFB_VB_RGBA_BIT))
71 v->color[0].alpha = CLAMP(col0[0][3], 0.0f, 1.0f);
72 v->color[0].red = CLAMP(col0[0][0], 0.0f, 1.0f);
73 v->color[0].green = CLAMP(col0[0][1], 0.0f, 1.0f);
74 v->color[0].blue = CLAMP(col0[0][2], 0.0f, 1.0f);
75 col0 = (GLfloat (*)[4])((GLubyte *)col0 + col0_stride);
76 #if (IND & (FFB_VB_TWOSIDE_BIT))
77 v->color[1].alpha = CLAMP(col1[0][3], 0.0f, 1.0f);
78 v->color[1].red = CLAMP(col1[0][0], 0.0f, 1.0f);
79 v->color[1].green = CLAMP(col1[0][1], 0.0f, 1.0f);
80 v->color[1].blue = CLAMP(col1[0][2], 0.0f, 1.0f);
81 col1 = (GLfloat (*)[4])((GLubyte *)col1 + col1_stride);
82 #endif
83 #endif
84 }
85 }
86 }
87
88 static void TAG(interp)(GLcontext *ctx, GLfloat t,
89 GLuint edst, GLuint eout, GLuint ein,
90 GLboolean force_boundary)
91 {
92 #if (IND & (FFB_VB_XYZ_BIT | FFB_VB_RGBA_BIT))
93 ffbContextPtr fmesa = FFB_CONTEXT(ctx);
94 #endif
95 #if (IND & (FFB_VB_XYZ_BIT))
96 struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
97 const GLfloat *dstclip = VB->ClipPtr->data[edst];
98 GLfloat oow = 1.0 / dstclip[3];
99 #endif
100 #if (IND & (FFB_VB_XYZ_BIT | FFB_VB_RGBA_BIT))
101 ffb_vertex *dst = &fmesa->verts[edst];
102 #endif
103 #if (IND & (FFB_VB_RGBA_BIT))
104 ffb_vertex *in = &fmesa->verts[eout];
105 ffb_vertex *out = &fmesa->verts[ein];
106 #endif
107
108 #ifdef VB_DEBUG
109 fprintf(stderr, "FFB: ffb_interp ["
110 #if (IND & (FFB_VB_XYZ_BIT))
111 " XYZ"
112 #endif
113 #if (IND & (FFB_VB_RGBA_BIT))
114 " RGBA"
115 #endif
116 #if (IND & (FFB_VB_TWOSIDE_BIT))
117 " TWOSIDE"
118 #endif
119 "] edst(%d) eout(%d) ein(%d)\n",
120 edst, eout, ein);
121 #endif
122
123 #if (IND & (FFB_VB_XYZ_BIT))
124 dst->x = dstclip[0] * oow;
125 dst->y = dstclip[1] * oow;
126 dst->z = dstclip[2] * oow;
127 #endif
128
129 #if (IND & (FFB_VB_RGBA_BIT))
130 INTERP_F(t, dst->color[0].alpha, out->color[0].alpha, in->color[0].alpha);
131 INTERP_F(t, dst->color[0].red, out->color[0].red, in->color[0].red);
132 INTERP_F(t, dst->color[0].green, out->color[0].green, in->color[0].green);
133 INTERP_F(t, dst->color[0].blue, out->color[0].blue, in->color[0].blue);
134 #if (IND & (FFB_VB_TWOSIDE_BIT))
135 INTERP_F(t, dst->color[1].alpha, out->color[1].alpha, in->color[1].alpha);
136 INTERP_F(t, dst->color[1].red, out->color[1].red, in->color[1].red);
137 INTERP_F(t, dst->color[1].green, out->color[1].green, in->color[1].green);
138 INTERP_F(t, dst->color[1].blue, out->color[1].blue, in->color[1].blue);
139 #endif
140 #endif
141 }
142
143 static void TAG(init)(void)
144 {
145 setup_tab[IND].emit = TAG(emit);
146 setup_tab[IND].interp = TAG(interp);
147 }
148
149 #undef IND
150 #undef TAG