2
* (C) Copyright IBM Corporation 2005
5
* Permission is hereby granted, free of charge, to any person obtaining a
6
* copy of this software and associated documentation files (the "Software"),
7
* to deal in the Software without restriction, including without limitation
8
* the rights to use, copy, modify, merge, publish, distribute, sub license,
9
* and/or sell copies of the Software, and to permit persons to whom the
10
* Software is furnished to do so, subject to the following conditions:
12
* The above copyright notice and this permission notice (including the next
13
* paragraph) shall be included in all copies or substantial portions of the
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20
* AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
#include "glxclient.h"
30
#include "indirect_vertex_array.h"
31
#include <GL/glxproto.h>
34
do_vertex_attrib_enable( GLuint index, GLboolean val )
36
__GLXcontext *gc = __glXGetCurrentContext();
37
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
39
if ( ! __glXSetArrayEnable( state, GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB,
41
__glXSetError(gc, GL_INVALID_ENUM);
46
void __indirect_glEnableVertexAttribArrayARB( GLuint index )
48
do_vertex_attrib_enable( index, GL_TRUE );
52
void __indirect_glDisableVertexAttribArrayARB( GLuint index )
54
do_vertex_attrib_enable( index, GL_FALSE );
59
get_parameter( unsigned opcode, unsigned size, GLenum target, GLuint index,
62
__GLXcontext * const gc = __glXGetCurrentContext();
63
Display * const dpy = gc->currentDpy;
64
const GLuint cmdlen = 12;
66
if (__builtin_expect(dpy != NULL, 1)) {
67
GLubyte const * pc = __glXSetupVendorRequest(gc,
68
X_GLXVendorPrivateWithReply,
71
*((GLenum *)(pc + 0)) = target;
72
*((GLuint *)(pc + 4)) = index;
73
*((GLuint *)(pc + 8)) = 0;
75
(void) __glXReadReply(dpy, size, params, GL_FALSE);
76
UnlockDisplay(dpy); SyncHandle();
82
void __indirect_glGetProgramEnvParameterfvARB( GLenum target, GLuint index,
85
get_parameter( 1296, 4, target, index, params );
89
void __indirect_glGetProgramEnvParameterdvARB( GLenum target, GLuint index,
92
get_parameter( 1297, 8, target, index, params );
96
void __indirect_glGetProgramLocalParameterfvARB( GLenum target, GLuint index,
99
get_parameter( 1305, 4, target, index, params );
103
void __indirect_glGetProgramLocalParameterdvARB( GLenum target, GLuint index,
106
get_parameter( 1306, 8, target, index, params );
110
void __indirect_glGetVertexAttribPointervNV( GLuint index, GLenum pname,
113
__GLXcontext * const gc = __glXGetCurrentContext();
114
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
116
if ( pname != GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB ) {
117
__glXSetError( gc, GL_INVALID_ENUM );
120
if ( ! __glXGetArrayPointer( state, GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB,
122
__glXSetError( gc, GL_INVALID_VALUE );
128
* Get the selected attribute from the vertex array state vector.
131
* On success \c GL_TRUE is returned. Otherwise, \c GL_FALSE is returned.
134
get_attrib_array_data( __GLXattribute * state, GLuint index, GLenum cap,
137
GLboolean retval = GL_FALSE;
138
const GLenum attrib = GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB;
141
case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
142
retval = __glXGetArrayEnable( state, attrib, index, data );
145
case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB:
146
retval = __glXGetArraySize( state, attrib, index, data );
149
case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
150
retval = __glXGetArrayStride( state, attrib, index, data );
153
case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
154
retval = __glXGetArrayType( state, attrib, index, data );
157
case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB:
158
retval = __glXGetArrayNormalized( state, attrib, index, data );
167
static void get_vertex_attrib( __GLXcontext * gc, unsigned vop,
168
GLuint index, GLenum pname,
171
Display * const dpy = gc->currentDpy;
172
GLubyte * const pc = __glXSetupVendorRequest(gc,
173
X_GLXVendorPrivateWithReply,
176
*((uint32_t *)(pc + 0)) = index;
177
*((uint32_t *)(pc + 4)) = pname;
179
(void) _XReply( dpy, reply, 0, False );
183
void __indirect_glGetVertexAttribivARB( GLuint index, GLenum pname,
186
__GLXcontext * const gc = __glXGetCurrentContext();
187
Display * const dpy = gc->currentDpy;
188
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
189
xGLXSingleReply reply;
192
get_vertex_attrib( gc, 1303, index, pname, (xReply *) & reply );
194
if ( reply.size != 0 ) {
195
if ( ! get_attrib_array_data( state, index, pname, params ) ) {
196
if (reply.size == 1) {
197
*params = (GLint) reply.pad3;
200
_XRead(dpy, (void *) params, 4 * reply.size);
210
void __indirect_glGetVertexAttribfvARB( GLuint index, GLenum pname,
213
__GLXcontext * const gc = __glXGetCurrentContext();
214
Display * const dpy = gc->currentDpy;
215
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
216
xGLXSingleReply reply;
219
get_vertex_attrib( gc, 1302, index, pname, (xReply *) & reply );
221
if ( reply.size != 0 ) {
225
if ( get_attrib_array_data( state, index, pname, & data ) ) {
226
*params = (GLfloat) data;
229
if (reply.size == 1) {
230
(void) memcpy( params, & reply.pad3, sizeof( GLfloat ) );
233
_XRead(dpy, (void *) params, 4 * reply.size);
243
void __indirect_glGetVertexAttribdvARB( GLuint index, GLenum pname,
246
__GLXcontext * const gc = __glXGetCurrentContext();
247
Display * const dpy = gc->currentDpy;
248
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
249
xGLXSingleReply reply;
252
get_vertex_attrib( gc, 1301, index, pname, (xReply *) & reply );
254
if ( reply.size != 0 ) {
258
if ( get_attrib_array_data( state, index, pname, & data ) ) {
259
*params = (GLdouble) data;
262
if (reply.size == 1) {
263
(void) memcpy( params, & reply.pad3, sizeof( GLdouble ) );
266
_XRead(dpy, (void *) params, 8 * reply.size);