glx/dri: only report DRI2 extensions when DRI2 is enabled.
[mesa.git] / src / glx / x11 / eval.c
1 /* $XFree86$ */
2 /*
3 ** License Applicability. Except to the extent portions of this file are
4 ** made subject to an alternative license as permitted in the SGI Free
5 ** Software License B, Version 1.1 (the "License"), the contents of this
6 ** file are subject only to the provisions of the License. You may not use
7 ** this file except in compliance with the License. You may obtain a copy
8 ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
9 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
10 **
11 ** http://oss.sgi.com/projects/FreeB
12 **
13 ** Note that, as provided in the License, the Software is distributed on an
14 ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
15 ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
16 ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
17 ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
18 **
19 ** Original Code. The Original Code is: OpenGL Sample Implementation,
20 ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
21 ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
22 ** Copyright in any portions created by third parties is as indicated
23 ** elsewhere herein. All Rights Reserved.
24 **
25 ** Additional Notice Provisions: The application programming interfaces
26 ** established by SGI in conjunction with the Original Code are The
27 ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
28 ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
29 ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
30 ** Window System(R) (Version 1.3), released October 19, 1998. This software
31 ** was created using the OpenGL(R) version 1.2.1 Sample Implementation
32 ** published by SGI, but has not been independently verified as being
33 ** compliant with the OpenGL(R) version 1.2.1 Specification.
34 **
35 */
36
37 #include "packrender.h"
38
39 /*
40 ** Routines to pack evaluator maps into the transport buffer. Maps are
41 ** allowed to have extra arbitrary data, so these routines extract just
42 ** the information that the GL needs.
43 */
44
45 void __glFillMap1f(GLint k, GLint order, GLint stride,
46 const GLfloat *points, GLubyte *pc)
47 {
48 if (stride == k) {
49 /* Just copy the data */
50 __GLX_PUT_FLOAT_ARRAY(0, points, order * k);
51 } else {
52 GLint i;
53
54 for (i = 0; i < order; i++) {
55 __GLX_PUT_FLOAT_ARRAY(0, points, k);
56 points += stride;
57 pc += k * __GLX_SIZE_FLOAT32;
58 }
59 }
60 }
61
62 void __glFillMap1d(GLint k, GLint order, GLint stride,
63 const GLdouble *points, GLubyte *pc)
64 {
65 if (stride == k) {
66 /* Just copy the data */
67 __GLX_PUT_DOUBLE_ARRAY(0, points, order * k);
68 } else {
69 GLint i;
70 for (i = 0; i < order; i++) {
71 __GLX_PUT_DOUBLE_ARRAY(0, points, k);
72 points += stride;
73 pc += k * __GLX_SIZE_FLOAT64;
74 }
75 }
76 }
77
78 void __glFillMap2f(GLint k, GLint majorOrder, GLint minorOrder,
79 GLint majorStride, GLint minorStride,
80 const GLfloat *points, GLfloat *data)
81 {
82 GLint i, j, x;
83
84 if ((minorStride == k) && (majorStride == minorOrder*k)) {
85 /* Just copy the data */
86 __GLX_MEM_COPY(data, points, majorOrder * majorStride *
87 __GLX_SIZE_FLOAT32);
88 return;
89 }
90 for (i = 0; i < majorOrder; i++) {
91 for (j = 0; j < minorOrder; j++) {
92 for (x = 0; x < k; x++) {
93 data[x] = points[x];
94 }
95 points += minorStride;
96 data += k;
97 }
98 points += majorStride - minorStride * minorOrder;
99 }
100 }
101
102 void __glFillMap2d(GLint k, GLint majorOrder, GLint minorOrder,
103 GLint majorStride, GLint minorStride,
104 const GLdouble *points, GLdouble *data)
105 {
106 int i,j,x;
107
108 if ((minorStride == k) && (majorStride == minorOrder*k)) {
109 /* Just copy the data */
110 __GLX_MEM_COPY(data, points, majorOrder * majorStride *
111 __GLX_SIZE_FLOAT64);
112 return;
113 }
114
115 #ifdef __GLX_ALIGN64
116 x = k * __GLX_SIZE_FLOAT64;
117 #endif
118 for (i = 0; i<majorOrder; i++) {
119 for (j = 0; j<minorOrder; j++) {
120 #ifdef __GLX_ALIGN64
121 __GLX_MEM_COPY(data, points, x);
122 #else
123 for (x = 0; x<k; x++) {
124 data[x] = points[x];
125 }
126 #endif
127 points += minorStride;
128 data += k;
129 }
130 points += majorStride - minorStride * minorOrder;
131 }
132 }