~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/lib/GL/mesa/src/drv/ffb/ffb_vbtmp.h

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

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